source: trunk/third/gnome-panel/gnome-panel/basep-widget.h @ 18631

Revision 18631, 8.3 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18630, which included commits to RCS files with non-trunk default branches.
Line 
1/* Gnome panel: basep widget
2 * (C) 1997 the Free Software Foundation
3 *
4 * Authors:  George Lebl
5 *           Jacob Berkman
6 */
7#ifndef BASEP_WIDGET_H
8#define BASEP_WIDGET_H
9
10#include "panel-widget.h"
11
12G_BEGIN_DECLS
13
14#define BASEP_TYPE_WIDGET               (basep_widget_get_type ())
15#define BASEP_WIDGET(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), BASEP_TYPE_WIDGET, BasePWidget))
16#define BASEP_WIDGET_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), BASEP_TYPE_WIDGET, BasePWidgetClass))
17#define BASEP_IS_WIDGET(object)         (G_TYPE_CHECK_INSTANCE_TYPE ((object), BASEP_TYPE_WIDGET))
18#define BASEP_IS_WIDGET_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), BASEP_TYPE_WIDGET))
19#define BASEP_WIDGET_GET_CLASS(object)  (G_TYPE_INSTANCE_GET_CLASS ((object), BASEP_TYPE_WIDGET, BasePWidgetClass))
20
21#define BASEP_TYPE_POS                  (basep_pos_get_type ())
22#define BASEP_POS(object)               (G_TYPE_CHECK_INSTANCE_CAST((object), BASEP_TYPE_POS, BasePPos))
23#define BASEP_POS_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), BASEP_TYPE_POS, BasePPosClass))
24#define BASEP_IS_POS(object)            (G_TYPE_CHECK_INSTANCE_TYPE ((object), BASEP_TYPE_POS))
25#define BASEP_IS_POS_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), BASEP_TYPE_POS))
26#define BASEP_POS_GET_CLASS(k)          (BASEP_POS_CLASS(G_OBJECT_GET_CLASS(BASEP_WIDGET(k)->pos)))
27
28
29typedef struct _BasePWidget             BasePWidget;
30typedef struct _BasePWidgetClass        BasePWidgetClass;
31
32typedef struct _BasePPos                BasePPos;
33typedef struct _BasePPosClass           BasePPosClass;
34
35typedef enum {
36        BASEP_EXPLICIT_HIDE,
37        BASEP_AUTO_HIDE
38} BasePMode;
39
40typedef enum {
41        BASEP_SHOWN,
42        BASEP_AUTO_HIDDEN,
43        BASEP_HIDDEN_LEFT,
44        BASEP_HIDDEN_RIGHT
45} BasePState;
46
47struct _BasePWidget
48{
49        GtkWindow               window;
50        GtkAllocation           shown_alloc;
51
52        int                     screen;
53        int                     monitor;
54
55        GtkWidget               *ebox;
56       
57        GtkWidget               *panel;
58       
59        GtkWidget               *table;
60        GtkWidget               *hidebutton_n;
61        GtkWidget               *hidebutton_e;
62        GtkWidget               *hidebutton_w;
63        GtkWidget               *hidebutton_s;
64       
65        GtkWidget               *frame;
66        GtkWidget               *innerebox;
67
68        BasePPos                *pos;
69
70        BasePMode               mode;
71        BasePState              state;
72        gboolean                moving;
73
74        gboolean                hidebuttons_enabled;
75        gboolean                hidebutton_pixmaps_enabled;
76
77        int                     enter_notify_timer_tag;
78        int                     leave_notify_timer_tag;
79        gboolean                autohide_inhibit;
80        int                     drawers_open;
81
82        gboolean                request_cube;
83        gboolean                keep_in_screen;
84
85        gboolean                compliant_wm;
86
87        /* drag offsets, where the panel was clicked when started
88         * to be moved */
89        int                     offset_x;
90        int                     offset_y;
91
92        /* wm strut */
93        int                     strut_left;
94        int                     strut_right;
95        int                     strut_top;
96        int                     strut_bottom;
97};
98
99struct _BasePWidgetClass
100{
101        GtkWindowClass parent_class;
102
103        /* signals */
104        /*FIXME: perhaps the type_change signal should be implemented
105          so that we don't have to handle the update_config_type in menu.c
106          but in panel.c along with the other update stuff */
107        /*void (*type_change)  (BasePWidget *basep,
108                              PanelType type);*/
109
110        void (* mode_change)  (BasePWidget *basep,
111                               BasePMode old_mode);
112
113        void (* state_change) (BasePWidget *basep,
114                               BasePState old_state);
115
116        void (* screen_change) (BasePWidget *basep,
117                                int          old_screen,
118                                int          old_monitor);
119
120        gboolean (* popup_panel_menu) (BasePWidget *basep);
121};
122
123/* we mostly want the class for this */
124struct _BasePPos {
125        GObject object;
126       
127        BasePWidget *basep;
128};
129
130struct _BasePPosClass {
131        GObjectClass parent_class;
132
133        /* virtual functions */
134        void (*set_hidebuttons) (BasePWidget *basep);
135
136        void (*update_winhints) (BasePWidget *basep);
137
138        PanelOrient
139        (*get_applet_orient) (BasePWidget *basep);
140
141        void (*set_pos)                   (BasePWidget *basep,
142                                           int x, int y,
143                                           int w, int h,
144                                           gboolean force);
145
146        void (*get_pos)                   (BasePWidget *basep,
147                                           int *x, int *y,
148                                           int w, int h);
149
150        void (*get_size)                  (BasePWidget *basep,
151                                           int *w, int *h);
152
153        PanelOrient (*get_hide_orient) (BasePWidget *basep);
154
155        void (*get_hide_size)              (BasePWidget *basep,
156                                            PanelOrient hide_orient,
157                                            int *w, int *h);
158
159        void (*get_hide_pos)               (BasePWidget *basep,
160                                            PanelOrient hide_orient,
161                                            int *x, int *y,
162                                            int w, int h);
163
164        void (*realize)                   (GtkWidget *widget);
165
166        void (*north_clicked)             (BasePWidget *basep);
167        void (*south_clicked)             (BasePWidget *basep);
168        void (*east_clicked)              (BasePWidget *basep);
169        void (*west_clicked)              (BasePWidget *basep);
170
171        void (*pre_convert_hook)          (BasePWidget *basep);
172};
173
174GType           basep_pos_get_type              (void) G_GNUC_CONST;
175GType           basep_widget_get_type           (void) G_GNUC_CONST;
176
177GtkWidget*      basep_widget_construct          (const char *panel_id,
178                                                 BasePWidget *basep,
179                                                 gboolean packed,
180                                                 gboolean reverse_arrows,
181                                                 int screen,
182                                                 int monitor,
183                                                 GtkOrientation orient,
184                                                 int sz,
185                                                 BasePMode mode,
186                                                 BasePState state,
187                                                 gboolean hidebuttons_enabled,
188                                                 gboolean hidebutton_pixmaps_enabled,
189                                                 PanelBackgroundType back_type,
190                                                 const char *back_pixmap,
191                                                 gboolean fit_pixmap_bg,
192                                                 gboolean stretch_pixmap_bg,
193                                                 gboolean rotate_pixmap_bg,
194                                                 PanelColor *back_color);
195
196/* changing parameters */
197void            basep_widget_change_params      (BasePWidget *basep,
198                                                 int screen,
199                                                 int monitor,
200                                                 GtkOrientation orient,
201                                                 int sz,
202                                                 BasePMode mode,
203                                                 BasePState state,
204                                                 gboolean hidebuttons_enabled,
205                                                 gboolean hidebutton_pixmaps_enabled,
206                                                 PanelBackgroundType back_type,
207                                                 const char *pixmap_name,
208                                                 gboolean fit_pixmap_bg,
209                                                 gboolean stretch_pixmap_bg,
210                                                 gboolean rotate_pixmap_bg,
211                                                 PanelColor *back_color);
212
213void            basep_widget_screen_size_changed (BasePWidget *basep,
214                                                  GdkScreen   *screen);
215
216/*gboolean       basep_widget_convert_to         (BasePWidget *basep,
217                                                 PanelType type);*/
218
219void            basep_widget_enable_buttons     (BasePWidget *basep,
220                                                 gboolean     enabled);
221
222void            basep_widget_set_hidebuttons    (BasePWidget *basep);
223void            basep_widget_update_winhints    (BasePWidget *basep);
224
225/*autohide*/
226gboolean        basep_widget_autoshow           (gpointer data);
227gboolean        basep_widget_autohide           (gpointer data);
228
229/*queue an autohide*/
230void            basep_widget_queue_autoshow     (BasePWidget *basep);
231void            basep_widget_queue_autohide     (BasePWidget *basep);
232
233/*explicit hiding*/
234void            basep_widget_explicit_hide      (BasePWidget *basep,
235                                                 BasePState hidestate);
236void            basep_widget_explicit_show      (BasePWidget *basep);
237
238void            basep_widget_do_hiding          (BasePWidget *basep,
239                                                 PanelOrient hide_orient,
240                                                 int leftover,
241                                                 PanelSpeed animation_step);
242
243void            basep_widget_do_showing         (BasePWidget *basep,
244                                                 PanelOrient hide_orient,
245                                                 int leftover,
246                                                 PanelSpeed animation_step);
247
248void            basep_widget_get_position       (BasePWidget *basep,
249                                                 PanelOrient hide_orient,
250                                                 int *x, int *y,
251                                                 int w, int h);
252
253PanelOrient basep_widget_get_applet_orient (BasePWidget *basep);
254
255/* initialize drag offsets according to cursor */
256void            basep_widget_init_offsets      (BasePWidget *basep);
257
258void            basep_widget_set_pos           (BasePWidget *basep,
259                                                int x, int y);
260
261void            basep_widget_get_pos           (BasePWidget *basep,
262                                                int *x, int *y);
263
264void            basep_widget_get_size          (BasePWidget *basep,
265                                                int *w, int *h);
266
267void            basep_widget_pre_convert_hook (BasePWidget *basep);
268
269void            basep_widget_screen_change      (BasePWidget *basep,
270                                                 int          screen,
271                                                 int          monitor);
272
273void            basep_update_frame             (BasePWidget *basep);
274
275/* redo the widget->window based on new compliancy setting */
276void            basep_widget_redo_window        (BasePWidget *basep);
277
278/* -1 means don't set, caller will not get queue resized as optimization */
279
280void            basep_border_recalc             (int          screen,
281                                                 int          monitor);
282void            basep_border_queue_recalc       (int          screen,
283                                                 int          monitor);
284void            basep_border_get                (BasePWidget *basep,
285                                                 BorderEdge   edge,
286                                                 int         *left,
287                                                 int         *center,
288                                                 int         *right);
289
290G_END_DECLS
291
292#endif /* __BASEP_WIDGET_H__ */
Note: See TracBrowser for help on using the repository browser.