1 | #ifndef BUTTON_WIDGET_H |
---|
2 | #define BUTTON_WIDGET_H |
---|
3 | |
---|
4 | #include <gtk/gtk.h> |
---|
5 | #include <gnome.h> |
---|
6 | #include "panel-types.h" |
---|
7 | |
---|
8 | #ifdef __cplusplus |
---|
9 | extern "C" { |
---|
10 | #endif /* __cplusplus */ |
---|
11 | |
---|
12 | #define TYPE_BUTTON_WIDGET (button_widget_get_type ()) |
---|
13 | #define BUTTON_WIDGET(obj) GTK_CHECK_CAST (obj, button_widget_get_type (), ButtonWidget) |
---|
14 | #define BUTTON_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, button_widget_get_type (), ButtonWidgetClass) |
---|
15 | #define IS_BUTTON_WIDGET(obj) GTK_CHECK_TYPE (obj, button_widget_get_type ()) |
---|
16 | |
---|
17 | typedef struct _ButtonWidget ButtonWidget; |
---|
18 | typedef struct _ButtonWidgetClass ButtonWidgetClass; |
---|
19 | |
---|
20 | struct _ButtonWidget |
---|
21 | { |
---|
22 | GtkWidget pixmap; |
---|
23 | |
---|
24 | GdkPixbuf *pixbuf; |
---|
25 | GdkPixbuf *pixbuf_hc; |
---|
26 | |
---|
27 | GdkPixmap *cache; |
---|
28 | |
---|
29 | char *filename; |
---|
30 | int size; |
---|
31 | |
---|
32 | GdkWindow *event_window; |
---|
33 | |
---|
34 | char *text; |
---|
35 | |
---|
36 | guint pressed:1; /*true if the button is pressed*/ |
---|
37 | guint in_button:1; |
---|
38 | |
---|
39 | guint ignore_leave:1; /*ignore the leave notify, |
---|
40 | if you do this remember to |
---|
41 | set the in_button properly |
---|
42 | later!*/ |
---|
43 | |
---|
44 | guint tile:2; /*the tile number, only used if tiles |
---|
45 | are on*/ |
---|
46 | guint arrow:1; /*0 no arrow, 1 simple arrow, more |
---|
47 | to do*/ |
---|
48 | guint dnd_highlight:1; |
---|
49 | |
---|
50 | guint no_alpha:1; /*we don't have any alpha to speak |
---|
51 | of, so we don't have to dump the |
---|
52 | cache all the time*/ |
---|
53 | |
---|
54 | PanelOrientType orient; |
---|
55 | |
---|
56 | guint pressed_timeout; |
---|
57 | }; |
---|
58 | |
---|
59 | struct _ButtonWidgetClass |
---|
60 | { |
---|
61 | GtkWidgetClass parent_class; |
---|
62 | |
---|
63 | void (* clicked) (ButtonWidget *button); |
---|
64 | void (* pressed) (ButtonWidget *button); |
---|
65 | void (* unpressed) (ButtonWidget *button); |
---|
66 | }; |
---|
67 | |
---|
68 | guint button_widget_get_type (void) G_GNUC_CONST; |
---|
69 | |
---|
70 | GtkWidget* button_widget_new (const char *pixmap, |
---|
71 | int size, |
---|
72 | int tile, |
---|
73 | gboolean arrow, |
---|
74 | PanelOrientType orient, |
---|
75 | const char *text); |
---|
76 | |
---|
77 | void button_widget_draw (ButtonWidget *button, |
---|
78 | guchar *rgb, |
---|
79 | int rowstride); |
---|
80 | /* draw the xlib part (arrow/text) */ |
---|
81 | void button_widget_draw_xlib (ButtonWidget *button, |
---|
82 | GdkPixmap *pixmap); |
---|
83 | |
---|
84 | gboolean button_widget_set_pixmap (ButtonWidget *button, |
---|
85 | const char *pixmap, |
---|
86 | int size); |
---|
87 | |
---|
88 | void button_widget_set_text (ButtonWidget *button, |
---|
89 | const char *text); |
---|
90 | |
---|
91 | void button_widget_set_params (ButtonWidget *button, |
---|
92 | int tile, |
---|
93 | gboolean arrow, |
---|
94 | PanelOrientType orient); |
---|
95 | |
---|
96 | void button_widget_set_dnd_highlight (ButtonWidget *button, |
---|
97 | gboolean highlight); |
---|
98 | |
---|
99 | void button_widget_clicked (ButtonWidget *button); |
---|
100 | void button_widget_down (ButtonWidget *button); |
---|
101 | void button_widget_up (ButtonWidget *button); |
---|
102 | |
---|
103 | /*load a tile of a given type/class, note that depth applies to a class |
---|
104 | wheather or not there is a tile or not, so this is basically a class |
---|
105 | initialization function*/ |
---|
106 | void button_widget_load_tile (int tile, |
---|
107 | const char *tile_up, |
---|
108 | const char *tile_down, |
---|
109 | int border, |
---|
110 | int depth); |
---|
111 | |
---|
112 | void button_widget_set_flags (int tile, |
---|
113 | gboolean tiles_enabled, |
---|
114 | gboolean pixmaps_enabled, |
---|
115 | gboolean always_text); |
---|
116 | |
---|
117 | void button_widget_redo_all (void); |
---|
118 | #ifdef __cplusplus |
---|
119 | } |
---|
120 | #endif /* __cplusplus */ |
---|
121 | |
---|
122 | |
---|
123 | #endif /* __BUTTON_WIDGET_H__ */ |
---|