xref: /haiku/src/apps/autoraise/common.h (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 #ifndef COMMON_H
2 #define COMMON_H
3 
4 #include <stdio.h>
5 
6 #include <AppKit.h>
7 #include <InterfaceKit.h>
8 #include <String.h>
9 #include <StorageKit.h>
10 
11 
12 // R5.1 has a very helpful API...
13 #if (B_BEOS_VERSION == 0x0510)
14 #define USE_DANO_HACK
15 #endif
16 
17 /***************************************************
18 	common.h
19 	Constants used by app
20 ***************************************************/
21 
22 // used to check the image to use to get the resources
23 #define APP_NAME "AutoRaise"
24 #define APP_SIG "application/x-vnd.mmu.AutoRaise"
25 #define SETTINGS_FILE "x-vnd.mmu.AutoRaise_settings"
26 
27 //names of data segments in settings file
28 //also used in messages
29 
30 #define DEFAULT_DELAY 500000LL
31 
32 // float: delay before raise
33 #define AR_DELAY "ar:delay"
34 // bool: last state
35 #define AR_ACTIVE "ar:active"
36 
37 #define AR_MODE "ar:mode"
38 enum {
39 	Mode_All,
40 	Mode_DeskbarOver,
41 	Mode_DeskbarTouch
42 };
43 
44 #define AR_BEHAVIOUR "ar:behaviour"
45 
46 // resources
47 #define ACTIVE_ICON "AR:ON"
48 #define INACTIVE_ICON "AR:OFF"
49 
50 // messages
51 
52 #define ADD_TO_TRAY 'zATT'
53 #define REMOVE_FROM_TRAY 'zRFT'
54 
55 #define OPEN_SETTINGS 'zOPS'
56 
57 
58 #define MSG_DELAY_POPUP 'arDP'
59 
60 #define MSG_TOGGLE_ACTIVE 'arTA'
61 #define MSG_SET_ACTIVE 'arSA'
62 #define MSG_SET_INACTIVE 'arSI'
63 #define MSG_SET_DELAY 'arSD'
64 #define MSG_SET_MODE 'arSM'
65 #define MSG_SET_BEHAVIOUR 'arSB'
66 
67 /* from OpenTracker deskbar/WindowMenuItem.h */
68 
69 // from interface_defs.h
70 struct window_info {
71         team_id         team;
72     int32       id;                       /* window's token */
73 
74         int32           thread;
75         int32           client_token;
76         int32           client_port;
77         uint32          workspaces;
78 
79         int32           layer;
80     uint32              w_type;           /* B_TITLED_WINDOW, etc. */
81     uint32      flags;            /* B_WILL_FLOAT, etc. */
82         int32           window_left;
83         int32           window_top;
84         int32           window_right;
85         int32           window_bottom;
86         int32           show_hide_level;
87         bool            is_mini;
88         char                name[1];
89 };
90 
91 // from interface_misc.h
92 enum window_action {
93         B_MINIMIZE_WINDOW,
94         B_BRING_TO_FRONT
95 };
96 
97 // from interface_misc.h
98 void                do_window_action(int32 window_id, int32 action,
99                                                          BRect zoomRect, bool zoom);
100 window_info     *get_window_info(int32 a_token);
101 int32           *get_token_list(team_id app, int32 *count);
102 void do_minimize_team(BRect zoomRect, team_id team, bool zoom);
103 void do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom);
104 
105 
106 #endif
107