Mercurial > pidgin
annotate finch/libgnt/gntwm.h @ 16942:2d2c2913548b
merge of '6c5cdf9bfd5c1acf1c24c55338915947e844d91d'
and 'b7ac78b8beb039f7545d74bbc3075947bb5d27e5'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 08 May 2007 03:38:21 +0000 |
parents | 82b6fdd899a9 |
children | 56d2ae9cbb5c 8410511f4dbb |
rev | line source |
---|---|
15817 | 1 |
2 #include "gntwidget.h" | |
3 #include "gntmenu.h" | |
4 | |
5 #include <panel.h> | |
15981
a741ec4dafa0
sf patch #1691784, from William Ehlhardt
Mark Doliner <mark@kingant.net>
parents:
15928
diff
changeset
|
6 #include <time.h> |
15817 | 7 |
8 #define GNT_TYPE_WM (gnt_wm_get_gtype()) | |
9 #define GNT_WM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_WM, GntWM)) | |
10 #define GNT_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_WM, GntWMClass)) | |
11 #define GNT_IS_WM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_WM)) | |
12 #define GNT_IS_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_WM)) | |
13 #define GNT_WM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_WM, GntWMClass)) | |
14 | |
15 typedef enum | |
16 { | |
17 GNT_KP_MODE_NORMAL, | |
18 GNT_KP_MODE_RESIZE, | |
19 GNT_KP_MODE_MOVE, | |
20 } GntKeyPressMode; | |
21 | |
22 typedef struct | |
23 { | |
24 GntWidget *me; | |
25 | |
26 WINDOW *window; | |
27 int scroll; | |
28 PANEL *panel; | |
29 } GntNode; | |
30 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
31 typedef struct _GnttWM GntWM; |
15817 | 32 |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
33 typedef struct _GntPosition |
15817 | 34 { |
35 int x; | |
36 int y; | |
37 } GntPosition; | |
38 | |
39 /** | |
40 * An application can register actions which will show up in a 'start-menu' like popup | |
41 */ | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
42 typedef struct _GntAction |
15817 | 43 { |
44 const char *label; | |
45 void (*callback)(); | |
46 } GntAction; | |
47 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
48 struct _GnttWM |
15817 | 49 { |
50 GntBindable inherit; | |
51 | |
52 GMainLoop *loop; | |
53 | |
54 GList *list; /* List of windows ordered on their creation time */ | |
55 GList *ordered; /* List of windows ordered on their focus */ | |
56 | |
57 struct { | |
58 GntWidget *window; | |
59 GntWidget *tree; | |
60 } _list, | |
61 *windows, /* Window-list window */ | |
62 *actions; /* Action-list window */ | |
63 | |
64 GHashTable *nodes; /* GntWidget -> GntNode */ | |
65 | |
66 GList *acts; /* List of actions */ | |
67 | |
68 /** | |
69 * There can be at most one menu at a time on the screen. | |
70 * If there is a menu being displayed, then all the keystrokes will be sent to | |
71 * the menu until it is closed, either when the user activates a menuitem, or | |
72 * presses Escape to cancel the menu. | |
73 */ | |
74 GntMenu *menu; /* Currently active menu */ | |
75 | |
76 /** | |
77 * 'event_stack' will be set to TRUE when a user-event, ie. a mouse-click | |
78 * or a key-press is being processed. This variable will be used to determine | |
79 * whether to give focus to a new window. | |
80 */ | |
81 gboolean event_stack; | |
82 | |
83 GntKeyPressMode mode; | |
84 | |
85 GHashTable *positions; | |
86 | |
87 void *res1; | |
88 void *res2; | |
89 void *res3; | |
90 void *res4; | |
91 }; | |
92 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
93 typedef struct _GntWMClass GntWMClass; |
15817 | 94 |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
95 struct _GntWMClass |
15817 | 96 { |
97 GntBindableClass parent; | |
98 | |
99 /* This is called when a new window is shown */ | |
100 void (*new_window)(GntWM *wm, GntWidget *win); | |
101 | |
102 void (*decorate_window)(GntWM *wm, GntWidget *win); | |
103 /* This is called when a window is being closed */ | |
104 gboolean (*close_window)(GntWM *wm, GntWidget *win); | |
105 | |
106 /* The WM may want to confirm a size for a window first */ | |
107 gboolean (*window_resize_confirm)(GntWM *wm, GntWidget *win, int *w, int *h); | |
108 | |
109 void (*window_resized)(GntWM *wm, GntNode *node); | |
110 | |
111 /* The WM may want to confirm the position of a window */ | |
112 gboolean (*window_move_confirm)(GntWM *wm, GntWidget *win, int *x, int *y); | |
113 | |
114 void (*window_moved)(GntWM *wm, GntNode *node); | |
115 | |
116 /* This gets called when: | |
117 * - the title of the window changes | |
118 * - the 'urgency' of the window changes | |
119 */ | |
120 void (*window_update)(GntWM *wm, GntNode *node); | |
121 | |
122 /* This should usually return NULL if the keys were processed by the WM. | |
123 * If not, the WM can simply return the original string, which will be | |
124 * processed by the default WM. The custom WM can also return a different | |
125 * static string for the default WM to process. | |
126 */ | |
127 gboolean (*key_pressed)(GntWM *wm, const char *key); | |
128 | |
129 gboolean (*mouse_clicked)(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget); | |
130 | |
131 /* Whatever the WM wants to do when a window is given focus */ | |
132 void (*give_focus)(GntWM *wm, GntWidget *widget); | |
133 | |
134 /* List of windows. Although the WM can keep a list of its own for the windows, | |
135 * it'd be better if there was a way to share between the 'core' and the WM. | |
136 */ | |
137 /*const GList *(*window_list)();*/ | |
138 | |
139 void (*res1)(void); | |
140 void (*res2)(void); | |
141 void (*res3)(void); | |
142 void (*res4)(void); | |
143 }; | |
144 | |
145 G_BEGIN_DECLS | |
146 | |
147 GType gnt_wm_get_gtype(void); | |
148 | |
149 void gnt_wm_new_window(GntWM *wm, GntWidget *widget); | |
150 | |
151 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget); | |
152 | |
153 void gnt_wm_window_close(GntWM *wm, GntWidget *widget); | |
154 | |
155 gboolean gnt_wm_process_input(GntWM *wm, const char *string); | |
156 | |
157 gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget); | |
158 | |
159 void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height); | |
160 | |
161 void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y); | |
162 | |
163 void gnt_wm_update_window(GntWM *wm, GntWidget *widget); | |
164 | |
165 void gnt_wm_raise_window(GntWM *wm, GntWidget *widget); | |
166 | |
16281
82b6fdd899a9
Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15981
diff
changeset
|
167 void gnt_wm_set_event_stack(GntWM *wm, gboolean set); |
82b6fdd899a9
Dialogs opened resulting from a mouse-click should fain focus.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15981
diff
changeset
|
168 |
15817 | 169 time_t gnt_wm_get_idle_time(void); |
170 | |
171 G_END_DECLS |