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