1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: InterfaceDefs.h 23 // Author: Erik Jaesler (erik@cgsoftware.com) 24 // Description: General Interface Kit definitions and global functions. 25 //------------------------------------------------------------------------------ 26 27 #ifndef _INTERFACE_DEFS_H 28 #define _INTERFACE_DEFS_H 29 30 // Standard Includes ----------------------------------------------------------- 31 32 // System Includes ------------------------------------------------------------- 33 #include <BeBuild.h> 34 #include <GraphicsDefs.h> 35 #include <OS.h> 36 37 // Project Includes ------------------------------------------------------------ 38 39 // Local Includes -------------------------------------------------------------- 40 41 // Local Defines --------------------------------------------------------------- 42 43 // Globals --------------------------------------------------------------------- 44 45 class BRect; 46 47 /*----------------------------------------------------------------*/ 48 49 struct key_info { 50 uint32 modifiers; 51 uint8 key_states[16]; 52 }; 53 54 /*----------------------------------------------------------------*/ 55 56 #define B_UTF8_ELLIPSIS "\xE2\x80\xA6" 57 #define B_UTF8_OPEN_QUOTE "\xE2\x80\x9C" 58 #define B_UTF8_CLOSE_QUOTE "\xE2\x80\x9D" 59 #define B_UTF8_COPYRIGHT "\xC2\xA9" 60 #define B_UTF8_REGISTERED "\xC2\xAE" 61 #define B_UTF8_TRADEMARK "\xE2\x84\xA2" 62 #define B_UTF8_SMILING_FACE "\xE2\x98\xBB" 63 #define B_UTF8_HIROSHI "\xE5\xBC\x98" 64 #ifdef COMPILE_FOR_R5 65 #define B_MAX_MOUSE_BUTTONS 3 66 #else 67 #define B_MAX_MOUSE_BUTTONS 16 68 #endif 69 70 /*----------------------------------------------------------------*/ 71 72 enum { B_BACKSPACE = 0x08, 73 B_RETURN = 0x0a, 74 B_ENTER = 0x0a, 75 B_SPACE = 0x20, 76 B_TAB = 0x09, 77 B_ESCAPE = 0x1b, 78 B_SUBSTITUTE = 0x1a, 79 80 B_LEFT_ARROW = 0x1c, 81 B_RIGHT_ARROW = 0x1d, 82 B_UP_ARROW = 0x1e, 83 B_DOWN_ARROW = 0x1f, 84 85 B_INSERT = 0x05, 86 B_DELETE = 0x7f, 87 B_HOME = 0x01, 88 B_END = 0x04, 89 B_PAGE_UP = 0x0b, 90 B_PAGE_DOWN = 0x0c, 91 92 B_FUNCTION_KEY = 0x10 }; 93 94 enum { B_F1_KEY = 0x02, 95 B_F2_KEY = 0x03, 96 B_F3_KEY = 0x04, 97 B_F4_KEY = 0x05, 98 B_F5_KEY = 0x06, 99 B_F6_KEY = 0x07, 100 B_F7_KEY = 0x08, 101 B_F8_KEY = 0x09, 102 B_F9_KEY = 0x0a, 103 B_F10_KEY = 0x0b, 104 B_F11_KEY = 0x0c, 105 B_F12_KEY = 0x0d, 106 B_PRINT_KEY = 0x0e, 107 B_SCROLL_KEY = 0x0f, 108 B_PAUSE_KEY = 0x10 }; 109 110 struct key_map { 111 uint32 version; 112 uint32 caps_key; 113 uint32 scroll_key; 114 uint32 num_key; 115 uint32 left_shift_key; 116 uint32 right_shift_key; 117 uint32 left_command_key; 118 uint32 right_command_key; 119 uint32 left_control_key; 120 uint32 right_control_key; 121 uint32 left_option_key; 122 uint32 right_option_key; 123 uint32 menu_key; 124 uint32 lock_settings; 125 int32 control_map[128]; 126 int32 option_caps_shift_map[128]; 127 int32 option_caps_map[128]; 128 int32 option_shift_map[128]; 129 int32 option_map[128]; 130 int32 caps_shift_map[128]; 131 int32 caps_map[128]; 132 int32 shift_map[128]; 133 int32 normal_map[128]; 134 int32 acute_dead_key[32]; 135 int32 grave_dead_key[32]; 136 int32 circumflex_dead_key[32]; 137 int32 dieresis_dead_key[32]; 138 int32 tilde_dead_key[32]; 139 uint32 acute_tables; 140 uint32 grave_tables; 141 uint32 circumflex_tables; 142 uint32 dieresis_tables; 143 uint32 tilde_tables; 144 }; 145 146 struct mouse_map { 147 uint32 button[B_MAX_MOUSE_BUTTONS]; 148 }; 149 150 /*----------------------------------------------------------------*/ 151 152 enum border_style { 153 B_PLAIN_BORDER, 154 B_FANCY_BORDER, 155 B_NO_BORDER 156 }; 157 158 /*----------------------------------------------------------------*/ 159 160 enum orientation { 161 B_HORIZONTAL, 162 B_VERTICAL 163 }; 164 165 /*----------------------------------------------------------------*/ 166 167 enum button_width { 168 B_WIDTH_AS_USUAL, 169 B_WIDTH_FROM_WIDEST, 170 B_WIDTH_FROM_LABEL 171 }; 172 173 /*----------------------------------------------------------------*/ 174 175 enum join_mode { 176 B_ROUND_JOIN=0, 177 B_MITER_JOIN, 178 B_BEVEL_JOIN, 179 B_BUTT_JOIN, 180 B_SQUARE_JOIN 181 }; 182 183 enum cap_mode { 184 B_ROUND_CAP=B_ROUND_JOIN, 185 B_BUTT_CAP=B_BUTT_JOIN, 186 B_SQUARE_CAP=B_SQUARE_JOIN 187 }; 188 189 const float B_DEFAULT_MITER_LIMIT = 10.0F; 190 191 /*----------------------------------------------------------------*/ 192 193 struct scroll_bar_info { 194 bool proportional; 195 bool double_arrows; 196 int32 knob; 197 int32 min_knob_size; 198 }; 199 200 /*----------------------------------------------------------------*/ 201 202 enum alignment { 203 B_ALIGN_LEFT, 204 B_ALIGN_RIGHT, 205 B_ALIGN_CENTER 206 }; 207 208 enum vertical_alignment { 209 B_ALIGN_TOP = 0x10L, 210 B_ALIGN_MIDDLE = 0x20, 211 B_ALIGN_BOTTOM = 0x30, 212 B_ALIGN_NO_VERTICAL = -1L 213 }; 214 215 /*----------------------------------------------------------------*/ 216 217 enum { 218 B_CONTROL_TABLE = 0x00000001, 219 B_OPTION_CAPS_SHIFT_TABLE = 0x00000002, 220 B_OPTION_CAPS_TABLE = 0x00000004, 221 B_OPTION_SHIFT_TABLE = 0x00000008, 222 B_OPTION_TABLE = 0x00000010, 223 B_CAPS_SHIFT_TABLE = 0x00000020, 224 B_CAPS_TABLE = 0x00000040, 225 B_SHIFT_TABLE = 0x00000080, 226 B_NORMAL_TABLE = 0x00000100 227 }; 228 229 /*----------------------------------------------------------------*/ 230 231 enum { 232 B_SHIFT_KEY = 0x00000001, 233 B_COMMAND_KEY = 0x00000002, 234 B_CONTROL_KEY = 0x00000004, 235 B_CAPS_LOCK = 0x00000008, 236 B_SCROLL_LOCK = 0x00000010, 237 B_NUM_LOCK = 0x00000020, 238 B_OPTION_KEY = 0x00000040, 239 B_MENU_KEY = 0x00000080, 240 B_LEFT_SHIFT_KEY = 0x00000100, 241 B_RIGHT_SHIFT_KEY = 0x00000200, 242 B_LEFT_COMMAND_KEY = 0x00000400, 243 B_RIGHT_COMMAND_KEY = 0x00000800, 244 B_LEFT_CONTROL_KEY = 0x00001000, 245 B_RIGHT_CONTROL_KEY = 0x00002000, 246 B_LEFT_OPTION_KEY = 0x00004000, 247 B_RIGHT_OPTION_KEY = 0x00008000 248 }; 249 250 /*----------------------------------------------------------------*/ 251 252 enum bitmap_tiling { 253 B_TILE_BITMAP_X = 0x00000001, 254 B_TILE_BITMAP_Y = 0x00000002, 255 B_TILE_BITMAP = 0x00000003 256 }; 257 258 enum overlay_options { 259 B_OVERLAY_FILTER_HORIZONTAL = 0x00010000, 260 B_OVERLAY_FILTER_VERTICAL = 0x00020000, 261 B_OVERLAY_MIRROR = 0x00040000, 262 B_OVERLAY_TRANSFER_CHANNEL = 0x00080000 263 }; 264 265 /*----------------------------------------------------------------*/ 266 267 _IMPEXP_BE status_t get_deskbar_frame(BRect *frame); 268 269 _IMPEXP_BE const color_map *system_colors(); 270 271 _IMPEXP_BE status_t set_screen_space(int32 index, uint32 res, 272 bool stick = true); 273 274 _IMPEXP_BE status_t get_scroll_bar_info(scroll_bar_info *info); 275 _IMPEXP_BE status_t set_scroll_bar_info(scroll_bar_info *info); 276 277 _IMPEXP_BE status_t get_mouse_type(int32 *type); 278 _IMPEXP_BE status_t set_mouse_type(int32 type); 279 _IMPEXP_BE status_t get_mouse_map(mouse_map *map); 280 _IMPEXP_BE status_t set_mouse_map(mouse_map *map); 281 _IMPEXP_BE status_t get_click_speed(bigtime_t *speed); 282 _IMPEXP_BE status_t set_click_speed(bigtime_t speed); 283 _IMPEXP_BE status_t get_mouse_speed(int32 *speed); 284 _IMPEXP_BE status_t set_mouse_speed(int32 speed); 285 _IMPEXP_BE status_t get_mouse_acceleration(int32 *speed); 286 _IMPEXP_BE status_t set_mouse_acceleration(int32 speed); 287 288 _IMPEXP_BE status_t get_key_repeat_rate(int32 *rate); 289 _IMPEXP_BE status_t set_key_repeat_rate(int32 rate); 290 _IMPEXP_BE status_t get_key_repeat_delay(bigtime_t *delay); 291 _IMPEXP_BE status_t set_key_repeat_delay(bigtime_t delay); 292 293 _IMPEXP_BE uint32 modifiers(); 294 _IMPEXP_BE status_t get_key_info(key_info *info); 295 _IMPEXP_BE void get_key_map(key_map **map, char **key_buffer); 296 _IMPEXP_BE status_t get_keyboard_id(uint16 *id); 297 _IMPEXP_BE void set_modifier_key(uint32 modifier, uint32 key); 298 _IMPEXP_BE void set_keyboard_locks(uint32 modifiers); 299 300 _IMPEXP_BE rgb_color keyboard_navigation_color(); 301 302 _IMPEXP_BE int32 count_workspaces(); 303 _IMPEXP_BE void set_workspace_count(int32 count); 304 _IMPEXP_BE int32 current_workspace(); 305 _IMPEXP_BE void activate_workspace(int32 workspace); 306 307 _IMPEXP_BE bigtime_t idle_time(); 308 309 _IMPEXP_BE void run_select_printer_panel(); 310 _IMPEXP_BE void run_add_printer_panel(); 311 _IMPEXP_BE void run_be_about(); 312 313 _IMPEXP_BE void set_focus_follows_mouse(bool follow); 314 _IMPEXP_BE bool focus_follows_mouse(); 315 316 enum mode_mouse { 317 B_NORMAL_MOUSE = 0, 318 B_FOCUS_FOLLOWS_MOUSE = 1, 319 B_WARP_MOUSE = 3, 320 B_INSTANT_WARP_MOUSE = 7 321 }; 322 323 _IMPEXP_BE void set_mouse_mode(mode_mouse mode); 324 _IMPEXP_BE mode_mouse mouse_mode(); 325 326 enum color_which { 327 B_PANEL_BACKGROUND_COLOR = 1, 328 B_PANEL_TEXT_COLOR = 10, 329 B_DOCUMENT_BACKGROUND_COLOR = 11, 330 B_DOCUMENT_TEXT_COLOR = 12, 331 B_CONTROL_BACKGROUND_COLOR = 13, 332 B_CONTROL_TEXT_COLOR = 14, 333 B_CONTROL_BORDER_COLOR = 15, 334 B_CONTROL_HIGHLIGHT_COLOR = 16, 335 B_NAVIGATION_BASE_COLOR = 4, 336 B_NAVIGATION_PULSE_COLOR = 17, 337 B_SHINE_COLOR = 18, 338 B_SHADOW_COLOR = 19, 339 340 B_MENU_BACKGROUND_COLOR = 2, 341 B_MENU_SELECTED_BACKGROUND_COLOR = 6, 342 B_MENU_ITEM_TEXT_COLOR = 7, 343 B_MENU_SELECTED_ITEM_TEXT_COLOR = 8, 344 B_MENU_SELECTED_BORDER_COLOR = 9, 345 346 B_TOOLTIP_BACKGROUND_COLOR = 20, 347 B_TOOLTIP_TEXT_COLOR = 21, 348 349 B_SUCCESS_COLOR = 100, 350 B_FAILURE_COLOR = 101, 351 352 // Old name synonyms. 353 B_KEYBOARD_NAVIGATION_COLOR = B_NAVIGATION_BASE_COLOR, 354 B_MENU_SELECTION_BACKGROUND_COLOR = B_MENU_SELECTED_BACKGROUND_COLOR, 355 356 // These are deprecated -- do not use in new code. See BScreen for 357 // the replacement for B_DESKTOP_COLOR. 358 B_DESKTOP_COLOR = 5, 359 B_WINDOW_TAB_COLOR = 3, 360 361 B_RANDOM_COLOR = 0x80000000, 362 B_MICHELANGELO_FAVORITE_COLOR, 363 B_DSANDLER_FAVORITE_SKY_COLOR, 364 B_DSANDLER_FAVORITE_INK_COLOR, 365 B_DSANDLER_FAVORITE_SHOES_COLOR 366 }; 367 368 _IMPEXP_BE rgb_color ui_color(color_which which); 369 _IMPEXP_BE rgb_color tint_color(rgb_color color, float tint); 370 371 extern "C" status_t _init_interface_kit_(); 372 /* effects on standard gray level */ 373 const float B_LIGHTEN_MAX_TINT = 0.0F; /* 216 --> 255.0 (255) */ 374 const float B_LIGHTEN_2_TINT = 0.385F; /* 216 --> 240.0 (240) */ 375 const float B_LIGHTEN_1_TINT = 0.590F; /* 216 --> 232.0 (232) */ 376 377 const float B_NO_TINT = 1.0F; /* 216 --> 216.0 (216) */ 378 379 const float B_DARKEN_1_TINT = 1.147F; /* 216 --> 184.2 (184) */ 380 const float B_DARKEN_2_TINT = 1.295F; /* 216 --> 152.3 (152) */ 381 const float B_DARKEN_3_TINT = 1.407F; /* 216 --> 128.1 (128) */ 382 const float B_DARKEN_4_TINT = 1.555F; /* 216 --> 96.1 (96) */ 383 const float B_DARKEN_MAX_TINT = 2.0F; /* 216 --> 0.0 (0) */ 384 385 const float B_DISABLED_LABEL_TINT = B_DARKEN_3_TINT; 386 const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT; 387 const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT; 388 389 /*-------------------------------------------------------------*/ 390 /*-------------------------------------------------------------*/ 391 392 #endif // _INTERFACE_DEFS_H 393