1/* 2 * Copyright 2011-2013 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/interface/InterfaceDefs.h hrev45737 10 * src/kits/interface/InterfaceDefs.cpp hrev45737 11 */ 12 13 14/*! 15 \file InterfaceDefs.h 16 \ingroup interface 17 \ingroup libbe 18 \brief Defines standard interface definitions for controls. 19 20 \since BeOS R3 21*/ 22 23 24/*! 25 \enum color_which { 26 \ingroup interface 27 28 System default colors. 29 If you want to use these make sure to always pick a matching set for your foreground and 30 background. 31 For example B_PANEL_TEXT_COLOR goes ontop of B_PANEL_BACKGROUND_COLOR. 32 33 \since Haiku R1 34*/ 35 36 37/*! 38 \var color_which B_NO_COLOR 39 40 This indicates that no color has been configured for the View. 41 42 \since Haiku R1 43*/ 44 45 46/*! 47 \var color_which B_PANEL_BACKGROUND_COLOR 48 49 The background color of a panel, a panel in this context is a window area on which controls are 50 added. 51 For example the background of preferences/appearence 52 53 use with B_PANEL_TEXT_COLOR 54 55 \since BeOS 56*/ 57 58 59/*! 60 \var color_which B_PANEL_TEXT_COLOR 61 62 The text color matching B_PANEL_BACKGROUND_COLOR. 63 64 \since Haiku R1 65*/ 66 67 68/*! 69 \var color_which B_DOCUMENT_BACKGROUND_COLOR 70 71 The background color of a text view. 72 For example the background of a BTextView. 73 74 use with B_DOCUMENT_TEXT_COLOR 75 76 \since Haiku R1 77*/ 78 79 80/*! 81 \var color_which B_DOCUMENT_TEXT_COLOR 82 83 The text color matching B_DOCUMENT_BACKGROUND_COLOR. 84 85 \since Haiku R1 86*/ 87 88 89/*! 90 \var color_which B_CONTROL_BACKGROUND_COLOR 91 92 The background of a control. 93 For example a Button. 94 95 use with B_CONTROL_TEXT_COLOR 96 97 \since Haiku R1 98*/ 99 100 101/*! 102 \var color_which B_CONTROL_TEXT_COLOR 103 104 The text color matching B_CONTROL_BACKGROUND_COLOR. 105 106 \since Haiku R1 107*/ 108 109 110/*! 111 \var color_which B_CONTROL_BORDER_COLOR 112 113 The border of a control. 114 For example a Button. 115 116 use with B_CONTROL_BACKGROUND_COLOR 117 118 \since Haiku R1 119*/ 120 121 122/*! 123 \var color_which B_CONTROL_HIGHLIGHT_COLOR 124 125 \since Haiku R1 126*/ 127 128 129/*! 130 \var color_which B_CONTROL_MARK_COLOR 131 132 \since Haiku R1 133*/ 134 135 136/*! 137 \var color_which B_NAVIGATION_BASE_COLOR 138 139 This is used to the keyboard focus. 140 141 \since Haiku R1 142*/ 143 144 145/*! 146 \var color_which B_NAVIGATION_PULSE_COLOR 147 148 \since Haiku R1 149*/ 150 151 152/*! 153 \var color_which B_SHINE_COLOR 154 155 \deprecated This should not be used anymore. 156 157 \since Haiku R1 158*/ 159 160 161/*! 162 \var color_which B_SHADOW_COLOR 163 164 \deprecated This should not be used anymore. 165 166 \since Haiku R1 167*/ 168 169 170/*! 171 \var color_which B_LINK_TEXT_COLOR 172 173 The color of links (URLs). 174 175 \since Haiku R1 176*/ 177 178 179/*! 180 \var color_which B_LINK_HOVER_COLOR 181 182 The color of a link (URL) that is currently hovered by the mouse. 183 184 \since Haiku R1 185*/ 186 187 188/*! 189 \var color_which B_LINK_VISITED_COLOR 190 191 The color of a link (URL) that was visited in the past. 192 193 \since Haiku R1 194*/ 195 196 197/*! 198 \var color_which B_LINK_ACTIVE_COLOR 199 200 The color of a link (URL) that is active. 201 This is a link that is currently beeing clicked, but the user has not yet let go of the mouse. 202 203 \since Haiku R1 204*/ 205 206 207/*! 208 \var color_which B_MENU_BACKGROUND_COLOR 209 210 The background color of a menu. 211 212 \since BeOS 213*/ 214 215 216/*! 217 \var color_which B_MENU_SELECTED_BACKGROUND_COLOR 218 219 The background color of selected menu item. 220 221 Relates to B_MENU_BACKGROUND_COLOR 222 223 \since Haiku R1 224*/ 225 226 227/*! 228 \var color_which B_MENU_ITEM_TEXT_COLOR 229 230 The text color of a menu item. 231 232 Use with B_MENU_BACKGROUND_COLOR. 233 234 \since BeOS 235*/ 236 237 238/*! 239 \var color_which B_MENU_SELECTED_ITEM_TEXT_COLOR 240 241 The text color of a selected menu item. 242 243 Use with B_MENU_SELECTED_BACKGROUND_COLOR. 244 245 \since BeOS 246*/ 247 248 249/*! 250 \var color_which B_MENU_SELECTED_BORDER_COLOR 251 252 \deprecated This should not be used anymore. 253 254 \since Haiku R1 255*/ 256 257 258/*! 259 \var color_which B_LIST_BACKGROUND_COLOR 260 261 The background color of a list. 262 This is used by BListView. 263 264 \since Haiku R1 265*/ 266 267 268/*! 269 \var color_which B_LIST_SELECTED_BACKGROUND_COLOR 270 271 The background color of a selected list item. 272 273 \since Haiku R1 274*/ 275 276 277/*! 278 \var color_which B_LIST_ITEM_TEXT_COLOR 279 280 The text color of a list item. 281 282 Use with B_LIST_BACKGROUND_COLOR. 283 284 \since Haiku R1 285*/ 286 287 288/*! 289 \var color_which B_LIST_SELECTED_ITEM_TEXT_COLOR 290 291 The text color of a selected list item. 292 293 Use with B_LIST_SELECTED_BACKGROUND_COLOR. 294 295 \since Haiku R1 296*/ 297 298 299/*! 300 \var color_which B_SCROLL_BAR_THUMB_COLOR 301 302 The color of the thumb of a scrollbar. 303 This is the part you can drag. 304 305 \since Haiku R1 306*/ 307 308 309/*! 310 \var color_which B_TOOL_TIP_BACKGROUND_COLOR 311 312 The background color of a tooltip. 313 314 \since Haiku R1 315*/ 316 317 318/*! 319 \var color_which B_TOOL_TIP_TEXT_COLOR 320 321 The text color of a tooltip. 322 323 Use with B_TOOL_TIP_BACKGROUND_COLOR. 324 325 \since Haiku R1 326*/ 327 328 329/*! 330 \var color_which B_STATUS_BAR_COLOR 331 332 This is used by progress bars. 333 For example by BStatusBar. 334 335 \since Haiku R1 336*/ 337 338 339/*! 340 \var color_which B_SUCCESS_COLOR 341 342 This marks operations that suceeded. 343 For example downloads in WebPositive that completed. 344 345 \since Haiku R1 346*/ 347 348 349/*! 350 \var color_which B_FAILURE_COLOR 351 352 This marks operations that failed. 353 For example downloads in WebPositive that failed or wrong user input. 354 Used by BTextControl::MarkAsInvalid 355 356 \since Haiku R1 357*/ 358 359 360/*! 361 \var color_which B_WINDOW_TAB_COLOR 362 363 The background color of the active window tab. 364 365 \since BeOS 366*/ 367 368 369/*! 370 \var color_which B_WINDOW_TEXT_COLOR 371 372 The text color of the active window tab. 373 374 Use with B_WINDOW_TAB_COLOR. 375 376 \since Haiku R1 377*/ 378 379 380/*! 381 \var color_which B_WINDOW_INACTIVE_TAB_COLOR 382 383 The background color of inactive window tabs. 384 385 \since Haiku R1 386*/ 387 388 389/*! 390 \var color_which B_WINDOW_INACTIVE_TEXT_COLOR 391 392 The text color of inactive window tabs. 393 394 Use with B_WINDOW_INACTIVE_TAB_COLOR. 395 396 \since Haiku R1 397*/ 398 399 400/*! 401 \var color_which B_WINDOW_BORDER_COLOR 402 403 The border color of the active window. 404 405 Relates to B_WINDOW_TAB_COLOR. 406 407 \since Haiku R1 408*/ 409 410 411/*! 412 \var color_which B_WINDOW_INACTIVE_BORDER_COLOR 413 414 The border color of the inactive windows. 415 416 Relates to B_WINDOW_INACTIVE_TAB_COLOR. 417 418 \since Haiku R1 419*/ 420 421 422/*! 423 \enum border_style 424 \ingroup interface 425 426 Collection of flags that determine the border style drawn around a BBox. 427 428 \since BeOS R3 429*/ 430 431 432/*! 433 \var border_style B_PLAIN_BORDER 434 435 \image html B_PLAIN_BORDER.png 436 437 The right and bottom sides of the box are darker than the top and 438 left sides to produce a shadow effect and make the box look like it 439 is raised slightly above the surrounding surface. 440 441 \since BeOS R3 442*/ 443 444 445/*! 446 \var border_style B_FANCY_BORDER 447 448 \image html B_FANCY_BORDER.png 449 450 The border is a bevelled to give it a 3D effect. The border is uniform 451 in appearance on all four sides. This is the default appearance. 452 453 \since BeOS R3 454*/ 455 456 457/*! 458 \var border_style B_NO_BORDER 459 460 No border. 461 462 \since BeOS R3 463*/ 464 465 466/*! 467 \enum orientation 468 469 Orientation flag sets the layout to either horizontal or vertical 470 alignment. 471 472 \since BeOS R3 473*/ 474 475 476/*! 477 \var orientation B_HORIZONTAL 478 479 Horizontal alignment 480 481 \since BeOS R3 482*/ 483 484 485/*! 486 \var orientation B_VERTICAL 487 488 Vertical alignment 489 490 \since BeOS R3 491*/ 492 493 494/*! 495 \enum button_width 496 497 Collection of flags that determine how wide to draw the buttons in a 498 BAlert dialog. 499 500 \since BeOS R3 501*/ 502 503 504/*! 505 \var button_width B_WIDTH_AS_USUAL 506 507 Set the width of each button based on the standard width. 508 509 \since BeOS R3 510*/ 511 512 513/*! 514 \var button_width B_WIDTH_FROM_WIDEST 515 516 Set the width of each button based on the width of the widest button. 517 518 \since BeOS R3 519*/ 520 521 522/*! 523 \var button_width B_WIDTH_FROM_LABEL 524 525 Set the width of each button to accommodate the label. 526 527 \since BeOS R5 528*/ 529 530 531// Line join and cap modes 532 533 534/*! 535 \enum join_mode 536 537 PostScript-style line join modes used by BView::SetLineMode() 538 539 \since BeOS R3 540*/ 541 542 543/*! 544 \var join_mode B_ROUND_JOIN 545 546 Round join mode. 547 548 \since BeOS R3 549*/ 550 551 552/*! 553 \var join_mode B_MITER_JOIN 554 555 Miter join mode. 556 557 \since BeOS R3 558*/ 559 560 561/*! 562 \var join_mode B_BEVEL_JOIN 563 564 Bevel join mode. 565 566 \since BeOS R3 567*/ 568 569 570/*! 571 \var join_mode B_BUTT_JOIN 572 573 Butt join mode. 574 575 \since BeOS R3 576*/ 577 578/*! 579 \var join_mode B_SQUARE_JOIN 580 581 Square join mode. 582 583 \since BeOS R3 584*/ 585 586 587/*! 588 \enum cap_mode 589 590 PostScript-style line cap modes used by BView::SetLineMode() 591 592 \since BeOS R3 593*/ 594 595 596/*! 597 \var cap_mode B_ROUND_CAP 598 599 Round cap mode. 600 601 \since BeOS R3 602*/ 603 604 605/*! 606 \var cap_mode B_BUTT_CAP 607 608 Butt cap mode. 609 610 \since BeOS R3 611*/ 612 613 614/*! 615 \var cap_mode B_SQUARE_CAP 616 617 Square cap mode. 618 619 \since BeOS R3 620*/ 621 622 623/*! 624 \var B_DEFAULT_MITER_LIMIT 625 626 Default miter limit used to calculate the angle cut off for miter joins. 627 628 \since BeOS R3 629*/ 630 631 632///// Keyboard related functions 633 634 635/*! 636 \fn uint32 modifiers() 637 \brief Gets a bitmap of each modifier key pressed down and each active 638 keyboard lock. 639 640 Test the bitmap returned using a bit mask composed of the following 641 modifier key constants: 642 - \c B_CAPS_LOCK 643 - \c B_COMMAND_KEY 644 - \c B_CONTROL_KEY 645 - \c B_MENU_KEY 646 - \c B_NUM_LOCK 647 - \c B_OPTION_KEY 648 - \c B_SCROLL_LOCK 649 - \c B_SHIFT_KEY 650 651 You may use a bit mask of 0 to test that no modifier keys are pressed. 652 If it is important to know if the left or right modifier key is pressed 653 down you can use the following additional constants: 654 - \c B_LEFT_SHIFT_KEY 655 - \c B_RIGHT_SHIFT_KEY 656 - \c B_LEFT_CONTROL_KEY 657 - \c B_RIGHT_CONTROL_KEY 658 - \c B_LEFT_OPTION_KEY 659 - \c B_RIGHT_OPTION_KEY 660 - \c B_LEFT_COMMAND_KEY 661 - \c B_RIGHT_COMMAND_KEY 662 663 \returns A bitmap containing each active modifier keys and locks. 664 665 \since BeOS R3 666*/ 667 668 669/*! 670 \fn status_t get_key_info(key_info* info) 671 \brief Fills out the key_info struct with the current state of the 672 keyboard. 673 674 \param info The key_info struct to fill out. 675 676 \retval B_OK Everything went fine. 677 \retval B_ERROR There was an error retrieving the key_info struct. 678 679 \since BeOS R3 680*/ 681 682 683/*! 684 \fn void get_key_map(key_map** _map, char** _keyBuffer) 685 \brief Provides a copy of the system keymap. 686 687 \attention You must free \a _map and \a _keyBuffer when you are done 688 with them. 689 690 \param _map A pointer to the system keymap structure. 691 \param _keyBuffer A pointer containing the UTF-8 character encodings. 692 693 \since BeOS R3 694*/ 695 696 697/*! 698 \fn status_t get_keyboard_id(uint16* _id) 699 \brief Fills out \a _id with the id of the currently attached keyboard. 700 701 \retval B_OK Everything went fine. 702 \retval B_ERROR There was an error retrieving the keyboard id. 703 704 \since BeOS R3 705*/ 706 707 708/*! 709 \fn status_t get_modifier_key(uint32 modifier, uint32 *key) 710 \brief Gets the code of the requested \a modifier key from the 711 system keymap. 712 713 \param modifier The modifier key to get from the system keymap. 714 \param key A pointer to an int32 to store the key code. 715 716 \retval B_OK Everything went fine. 717 \retval B_ERROR There was an error retrieving the modifier key. 718 719 \since BeOS R3 720*/ 721 722 723/*! 724 \fn void set_modifier_key(uint32 modifier, uint32 key) 725 \brief Set the \a modifier \a key to the specified code in the 726 system keymap. 727 728 \param modifier The modifier key to set in the system keymap. 729 \param key The key code to set the modifier key to. 730 731 \since BeOS R3 732*/ 733 734 735/*! 736 \fn void set_keyboard_locks(uint32 modifiers) 737 \brief Set the keyboard locks. 738 739 Pass in a bit mask containing the following constants: 740 - \c B_CAPS_LOCK 741 - \c B_NUM_LOCK 742 - \c B_SCROLL_LOCK 743 744 The constants present in the bit mask will turn the lock on, those 745 absent will turn the lock off. Pass 0 in to turn off all locks. 746 747 \param modifiers A bitmap of lock keys to set. 748 749 \since BeOS R3 750*/ 751 752 753/*! 754 \fn status_t get_mouse_type(int32* type) 755 \brief Get the number of buttons of the mouse. 756 757 If there are multiple mouses connected, the number of buttons for one of 758 them picked at random will be returned. 759 760 \deprecated Use \ref "get_mouse_type(const char* mouse_name, int32* type)" 761 instead. 762*/ 763 764 765/*! 766 \fn status_t get_mouse_type(const char* mouse_name, int32* type) 767 \brief Get the number of buttons for a specific mouse. 768 769 Mouse names can be known from BInputDevice. 770 771 \since Haiku R1 772*/ 773 774 775/*! 776 \fn status_t set_mouse_type(const char* mouse_name, int32 type) 777 \brief Configure the number of buttons for a specific mouse. 778 779 The setting is saved and persists accross reboots. 780 781 \since Haiku R1 782*/ 783 784 785/*! 786 \fn status_t get_mouse_map(mouse_map* map) 787 \brief Get the button map of the mouse. 788 789 \deprecated Use \ref "get_mouse_map(const char* mouse_name, mouse_map* map)" 790 instead. 791*/ 792 793 794/*! 795 \fn status_t get_mouse_map(const char* mouse_name, mouse_map* map) 796 \brief Get the button map for a specific mouse. 797 798 \since Haiku R1 799*/ 800 801 802/*! 803 \fn status_t set_mouse_map(mouse_map* map) 804 \brief Set the button map of the mouse. 805 806 \deprecated Use \ref "set_mouse_map(const char* mouse_name, mouse_map* map)" 807 instead. 808*/ 809 810 811/*! 812 \fn status_t set_mouse_map(const char* mouse_name, mouse_map* map) 813 \brief Set the button map for a specific mouse. 814 815 The setting is saved and persists accross reboots. 816 817 \since Haiku R1 818*/ 819 820 821/*! 822 \fn status_t get_click_speed(bigtime_t* speed) 823 \brief Get the double-click maximum delay. 824 825 \deprecated Use \ref "get_click_speed(const char* mouse_name, bigtime_t* speed)" 826 instead. 827*/ 828 829 830/*! 831 \fn status_t get_click_speed(const char* mouse_name, bigtime_t* speed) 832 \brief Get the double-click maximum delay for a specific mouse. 833 834 \since Haiku R1 835*/ 836 837 838/*! 839 \fn status_t set_click_speed(bigtime_t speed) 840 \brief Set the double-click maximum delay. 841 842 \deprecated Use \ref "get_click_speed(const char* mouse_name, bigtime_t* speed)" 843 instead. 844*/ 845 846 847/*! 848 \fn status_t set_click_speed(const char* mouse_name, bigtime_t speed) 849 \brief Set the double-click maximum delay for a specific mouse. 850 851 \since Haiku R1 852*/ 853 854 855/*! 856 \fn status_t get_mouse_speed(int32* speed) 857 \brief Get the mouse speed. 858 859 If there are multiple mouses connected, this function returns the speed 860 from a random one. 861 862 \deprecated Use \ref "get_mouse_speed(const char* mouse_name, int32* speed)" 863 instead. 864*/ 865 866 867/*! 868 \fn status_t get_mouse_speed(const char* mouse_name, int32* speed) 869 \brief Get the mouse speed setting for a specific mouse. 870 871 \since Haiku R1 872*/ 873 874 875/*! 876 \fn status_t set_mouse_speed(const char* mouse_name, int32 speed) 877 \brief Set the mouse speed for a specific mouse. 878 879 The setting is saved and persists accross reboots. 880 881 \since Haiku R1 882*/ 883 884 885/*! 886 \fn status_t get_mouse_acceleration(int32* speed) 887 \brief Get the mouse acceleration. 888 889 If there are multiple mouses connected, this function returns the speed 890 from a random one. 891 892 \deprecated Use \ref "get_mouse_acceleration(const char* mouse_name, int32* speed)" 893 instead. 894*/ 895 896 897/*! 898 \fn status_t get_mouse_acceleration(const char* mouse_name, int32* speed) 899 \brief Get the mouse acceleration setting for a specific mouse. 900 901 \since Haiku R1 902*/ 903 904 905/*! 906 \fn status_t set_mouse_acceleration(const char* mouse_name, int32 speed) 907 \brief Set the mouse acceleration for a specific mouse. 908 909 The setting is saved and persists accross reboots. 910 911 \since Haiku R1 912*/ 913