Correct backtrace() array size argument
[forms.git] / F / F_Types.H
blob862ba89b006a3115b356f6eeaa2e9b6667f521f5
2  /*
3   *   Copyright (C) 2007, Harbour, All rights reserved.
4   */
6 #ifndef _F_TYPES_H_
7 #define _F_TYPES_H_
9 #include <sys/types.h>
10 #include <sys/time.h>
11 #include <F_Version.H>
12 #include <string>
14 // TODO: F_Types ÄÏÌÖÅΠÓÏÄÅÒÖÁÔØ ÏÂÝÉÅ ÄÌÑ ×ÓÅÈ ÉÎÔÅÒÆÅÊÓÏ× ÔÉÐÙ, Á ÎÅ 
15 // ÔÉÐÙ ÄÌÑ ÔÅËÓÔÁ
17 namespace F {
19  extern const char *demangled_(const char *mngl);
20  // ËÏÏÒÄÉÎÁÔÙ ÍÏÇÕÔ ÂÙÔØ ÏÔÒÉÃÁÔÅÌØÎÙÍÉ - ÅÓÌÉ ×ÙÈÏÄÑÔ ÚÁ ÇÒÁÎÉÃÙ ÜËÒÁÎÁ
21  typedef int16_t coord_t;
22  typedef struct { coord_t x, y; } coords_t;
23  typedef u_int16_t dim_t;
24  typedef struct { dim_t w, h; } dims_t;
26 #define F_MAX_COORD_T   SHRT_MAX
27 #define F_MAX_DIM_T     USHRT_MAX
28 #define F_MAX_WIDGETS   USHRT_MAX
30 #define F_HORIZONTAL    0
31 #define F_VERTICAL      1
33  //! ËÏÎÓÔÁÎÔÁ ×ÒÅÍÅÎÉ ÏÖÉÄÁÎÉÑ × ÆÕÎËÃÉÉ F_App::wait()
34  const int start_only = 0,
35            forever    = 1;
37  enum log_level_t { DEBUG_LEVEL, CHAT_LEVEL, INFO_LEVEL, NOTICE_LEVEL,
38       WARN_LEVEL, ERROR_LEVEL, ALERT_LEVEL, CRITICAL_LEVEL, FATAL_LEVEL };
39       
40  //! ×ÉÄÙ ÐÏÌØÚÏ×ÁÔÅÌØÓËÉÈ ÉÎÔÅÒÆÅÊÓÏ×
41  enum ui_class_t {
42    DAEMON_UI,   // no tty
43    BATCH_UI,    // stdout/stdin
44    TTY_UI,      // /dev/tty
45    CONSOLE_UI,  // /dev/vcsa
46    FBDEV_UI,    // /dev/fb0
47    X11_UI       // X'Ù
48   };
50  //! ÚÁÍÅÎÉÔØ ÍÁÐÏÊ
51  typedef struct val_names_t {
52        int val;
53        const char *name;
54  } val_names_t ;
56 #define F_TRACE_SIGNAL  SIGURG
58  // idea got from mysql-ptrace
59  typedef struct {
60         u_int32_t       foo1;   /* +0x00 */
61         u_int32_t       foo2;
62         u_int32_t       foo3;
63         u_int32_t       foo4;   /* usually 2 */
64         u_int32_t       foo5;   /* +0x10 */
65         u_int32_t       xgs;    /* always zero */
66         u_int32_t       xfs;    /* always zero */
67         u_int32_t       xes;    /* always es=ds=ss */
68         u_int32_t       xds;    /* +0x20 */
69         u_int32_t       edi;
70         u_int32_t       esi;
71         u_int32_t       ebp;
72         u_int32_t       esp;    /* +0x30 */
73         u_int32_t       ebx;
74         u_int32_t       edx;
75         u_int32_t       ecx;
76         u_int32_t       eax;    /* +0x40 */
77         u_int32_t       foo11;  /* usually 0xe */
78         u_int32_t       foo12;  /* usually 0x6 */
79         u_int32_t       eip;    /* instruction pointer */
80         u_int32_t       xcs;    /* +0x50 */
81         u_int32_t       foo21;  /* usually 0x2 */
82         u_int32_t       foo22;  /* second stack pointer?! Probably. */
83         u_int32_t       xss;
84         u_int32_t       foo31;  /* +0x60 */ /* usually 0x0 */
85         u_int32_t       foo32;  /* usually 0x2 */
86         u_int32_t       fault_addr;     /* Address which caused a fault */
87         u_int32_t       foo41;  /* usually 0x2 */
88  } signal_regs_t;
90  enum F_Align_Type_t {
91    F_NO_ALIGN              = 0,
92    F_ALIGN_CENTER          = 1,
93    F_ALIGN_LEFT            = 2,
94    F_ALIGN_RIGHT           = 4,
95    F_ALIGN_TOP             = 8,
96    F_ALIGN_BOTTOM          = 16,
97    F_ALIGN_INSIDE          = 32,
98    F_ALIGN_CLIP            = 64,
99    F_ALIGN_WRAP            = 128,
100    F_ALIGN_TOP_LEFT        = F_ALIGN_TOP | F_ALIGN_LEFT,
101    F_ALIGN_TOP_RIGHT       = F_ALIGN_TOP | F_ALIGN_RIGHT,
102    F_ALIGN_BOTTOM_LEFT     = F_ALIGN_BOTTOM | F_ALIGN_LEFT,
103    F_ALIGN_BOTTOM_RIGHT    = F_ALIGN_BOTTOM | F_ALIGN_RIGHT,
104    F_ALIGN_LEFT_TOP        = F_ALIGN_TOP_LEFT,
105    F_ALIGN_RIGHT_TOP       = F_ALIGN_TOP_RIGHT,
106    F_ALIGN_LEFT_BOTTOM     = F_ALIGN_BOTTOM_LEFT,
107    F_ALIGN_RIGHT_BOTTOM    = F_ALIGN_BOTTOM_RIGHT
108  };
110  // Event Devices
111  enum F_Event_Device_t {
112    F_TYPE_NONE = 0,
113    F_DISPLAY,
114    F_KEYBOARD,
115    F_POINTER
116  };
118  enum F_Event_Type_t {
119    F_EVENT_NONE = 0,
120    // display types
121    F_WINDOW_SHOW,
122    F_WINDOW_HIDE,
123    // draw_buf sync window area
124    F_WINDOW_FLUSH,
125    // draw_buf sync all display area
126    F_DISPLAY_FLUSH,
127    // input types
128    F_POINTER_MOVE,
129    F_POINTER_DRAG,
130    F_POINTER_DROP,
131    // mouse buttons
132    F_POINTER_PRESS,
133    F_POINTER_RELEASE,
134    F_POINTER_SINGLE_CLICK, // ÜÔÏÔ event = input_press & input_release
135    F_POINTER_DOUBLE_CLICK,
136    F_POINTER_TRIPPLE_CLICK,
137    F_POINTER_AUTOREPEAT,
138    // keys
139    F_KEY_PRESS,
140    F_KEY_RELEASE,
141    F_KEY_AUTOREPEAT,
142    // wheel rolling
143    F_POINTER_WHEEL_INCR,
144    F_POINTER_WHEEL_DECR,
145    // general events
146    F_ENTER,
147    F_LEAVE,
148    F_FOCUS,
149    F_UNFOCUS
150  };
152  enum F_Pointer_Event_Code_t {
153    F_POINTER_NONE            = 0,
154    // mouse codes
155    F_POINTER_LEFT_BUTTON,
156    F_POINTER_MIDDLE_BUTTON,
157    F_POINTER_RIGHT_BUTTON,
158    F_POINTER_BUTTON_4,
159    F_POINTER_BUTTON_5,
160    F_POINTER_BUTTON_6,
161    F_POINTER_BUTTON_7,
162    F_POINTER_BUTTON_8,
163    F_POINTER_BUTTON_9,
164    F_POINTER_BUTTON_10,
165    F_POINTER_WHEEL_V, // vertical wheel
166    F_POINTER_WHEEL_H  // horizontal one
167  };
169  class F_Window;
170  class F_Widget;
172  typedef struct F_Event_t {
174   timeval timestamp; // hm ...
175   int delay; // × 10ms ÔÉËÁÈ ÚÁÄÅÒÖËÁ
176   F_Widget *widget; // ËÕÄÙ ÐÏÓÙÌÁÔØ ÓÉÇÎÁÌ
177   // F_DISPLAY / F_POINTER / F_KEY
178   F_Event_Device_t dev;
179   // F_POINTER_PRESS / F_POINTER_RELELASE
180   F_Event_Type_t type;
181   // Event values
182   // device specific state
183   union {
184    struct { // mouse
185     // may be implement as 'F_Point pointer;' ?
186     coord_t x;
187     coord_t y;
188     unsigned int buttons;
189     unsigned int click;
190     F_Pointer_Event_Code_t ev_c;
191    } mouse;
192    struct { // keyboard
193     unsigned int key;
194     unsigned int modifiers;
195    } kbd;
196    struct { // display
197     F_Window *window;
198    } display;
199   };
200  } F_Event_t;
202  // key codes idea is gently borrowed from fltk, naturally with all comments
203  // need to move to specific ui file as will conflict with fltk for ex.
205  #define F_Printable(x) ((x < 0xf000) ? true : false)
207  #define F_Beep         0xf007
208  #define F_BackSpace    0xf008
209  #define F_Tab          0xf009
210  #define F_Enter        0xf00d
211  #define F_Pause        0xf013
212  #define F_Scroll_Lock  0xf014
213  #define F_Escape       0xf01b
214  #define F_Home         0xf050
215  #define F_Left         0xf051
216  #define F_Up           0xf052
217  #define F_Right        0xf053
218  #define F_Down         0xf054
219  #define F_Page_Up      0xf055
220  #define F_Page_Down    0xf056
221  #define F_End          0xf057
222  #define F_Center       0xf058 // Keypad 5
223  #define F_Print        0xf061
224  #define F_Insert       0xf063
225  #define F_Menu_key     0xf067 // the "menu/apps" key on XFree86
226  #define F_Help         0xf068 // the 'help' key on Mac keyboards
227  #define F_Num_Lock     0xf07f
228  #define F_F            0xf090 // F_F + key = functional keys
229  #define F_F1           0xf091
230  #define F_F2           0xf092
231  #define F_F3           0xf093
232  #define F_F4           0xf094
233  #define F_F5           0xf095
234  #define F_F6           0xf096
235  #define F_F7           0xf097
236  #define F_F8           0xf098
237  #define F_F9           0xf099
238  #define F_F10          0xf09a
239  #define F_F11          0xf09b
240  #define F_F12          0xf09c
241  #define F_Shift_L      0xf0e1
242  #define F_Shift_R      0xf0e2
243  #define F_Control_L    0xf0e3
244  #define F_Control_R    0xf0e4
245  #define F_Caps_Lock    0xf0e5
246  #define F_Meta_L       0xf0e7 // the left MSWindows key on XFree86
247  #define F_Meta_R       0xf0e8 // the right MSWindows key on XFree86
248  #define F_Alt_L        0xf0e9
249  #define F_Alt_R        0xf0ea
250  #define F_Delete       0xf0eb
252  // modifiers
253  #define F_SHIFT        0x00010000
254  #define F_CAPS_LOCK    0x00020000
255  #define F_CTRL         0x00040000
256  #define F_ALT          0x00080000
257  #define F_NUM_LOCK     0x00100000 // most X servers do this?
258  #define F_META         0x00400000 // correct for XFree86
259  #define F_SCROLL_LOCK  0x00800000 // correct for XFree86
261  #define F_BUTTON1      0x01000000
262  #define F_BUTTON2      0x02000000
263  #define F_BUTTON3      0x04000000
264  #define F_BUTTONS      0x7f000000 // All possible buttons
265  #define F_BUTTON(n)    (0x00800000<<(n))
267 // Damage ÏÐÒÅÄÅÌÑÅÔ ËÁËÉÅ ÞÁÓÔÉ ×ÉÄÖÅÔÁ ÎÕÖÎÏ ÏÂÎÏ×ÉÔØ ÎÁ ÜËÒÁÎÅ
269 typedef unsigned int F_Damage_t;
271 #define F_DAMAGE_NONE     0x00
272 // ÒÁÍËÁ
273 #define F_DAMAGE_BORDER   0x01
274 // ÓÐÒÑÔÁÔØ/ÐÏËÁÚÁÔØ ×ÉÄÖÅÔ
275 #define F_DAMAGE_EXPOSE   0x02
276 // ÏÂÎÏ×ÉÔØ draw_buf ×ÙÛÅ ÐÏ ÉÅÒÁÒÈÉÉ
277 #define F_DAMAGE_FLUSH    0x04
278 // ÎÕÖÎÏ ÐÅÒÅÒÉÓÏ×ÁÔØ
279 #define F_DAMAGE_DRAW     0x08
280 // ÕÓÅ
281 #define F_DAMAGE_ALL      0xFF
283 typedef unsigned int F_Color_t;
285  // utf-8, where you ?
286  typedef unsigned char F_Char_t;
288  typedef struct F_Color {
289    F_Color_t fg_, bg_;
290  } F_Color;
292 const F_Color_t   F_BLACK           = 0,
293                   F_BLUE            = 1,
294                   F_GREEN           = 2,
295                   F_CYAN            = 3,
296                   F_RED             = 4,
297                   F_MAGENTA         = 5,
298                   F_YELLOW          = 6,
299                   F_WHITE           = 7,
300                   F_GREY            = 8,
301                   F_BRIGHT_BLUE     = 9,
302                   F_BRIGHT_GREEN    = 10,
303                   F_BRIGHT_CYAN     = 11,
304                   F_BRIGHT_RED      = 12,
305                   F_BRIGHT_MAGENTA  = 13,
306                   F_BRIGHT_YELLOW   = 14,
307                   F_BRIGHT_WHITE    = 15,
309                   F_BOLD            = 0x10000000,
310                   F_UNDERLINED      = 0x20000000,
311                   F_DIM             = 0x40000000,
312                   F_BLINK           = 0x80000000;
314 #define F_TRANSPARENT   F_GLASSY
316 #define F_DEFAULT_BG    F_BLUE
317 #define F_DEFAULT_FG    F_WHITE
319 enum F_Box_Type_t {
320   F_NO_BOX = 0,
321   F_UP_BOX,
322   F_DOWN_BOX
325 enum F_Window_Type_t {
326   F_NORMAL_WINDOW = 0,
327   F_MODAL_WINDOW
330 enum F_Wrap_t {
331   F_NO_WRAP = 0,
332   F_WRAP_WORDS,
333   F_WRAP_CHARS
336 typedef unsigned char F_Border_t;
338 const F_Border_t  F_NO_BORDER       = 0,
339                   F_SINGLE_BORDER   = 1,
340                   F_DOUBLE_BORDER   = 2,
341                   F_MOVING_BORDER   = 3;
343  enum F_Button_State_t {
344    F_BUTTON_NORMAL,
345    F_BUTTON_ON_FOCUS,
346    F_BUTTON_PRESSED
347  };
349  enum F_When {
350   F_WHEN_NEVER                  = 0,
351   F_WHEN_CHANGED                = 1,
352   F_WHEN_NOT_CHANGED            = 2,
353   F_WHEN_RELEASE                = 4,
354   F_WHEN_RELEASE_ALWAYS         = 6,
355   F_WHEN_ENTER_KEY              = 8,
356   F_WHEN_ENTER_KEY_ALWAYS       = 10,
357   F_WHEN_ENTER_KEY_CHANGED      = 11
358  };
359 } // namespace F
361 #endif