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