annotate console/libgnt/gntwidget.c @ 14983:8186cb621d2b

[gaim-migrate @ 17762] GTK+ Theme selection will now choose the system-wide theme if the installer is being run by the admin user. Also, the theme checkboxes can now be all unselected and we wont mess with the current theme selection. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 17 Nov 2006 01:11:18 +0000
parents 94c69d2efae5
children 7589733ba1aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
1 /* Stuff brutally ripped from Gflib */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
3 #include "gntwidget.h"
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
4 #include "gntstyle.h"
13935
cd2da4b079cf [gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13930
diff changeset
5 #include "gntmarshal.h"
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
6 #include "gnt.h"
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
7
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8 enum
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 SIG_DESTROY,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 SIG_DRAW,
14613
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
12 SIG_HIDE,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13 SIG_GIVE_FOCUS,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 SIG_LOST_FOCUS,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15 SIG_KEY_PRESSED,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
16 SIG_MAP,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
17 SIG_ACTIVATE,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
18 SIG_EXPOSE,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
19 SIG_SIZE_REQUEST,
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
20 SIG_CONFIRM_SIZE,
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
21 SIG_SIZE_CHANGED,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
22 SIG_POSITION,
14343
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
23 SIG_CLICKED,
14834
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
24 SIG_CONTEXT_MENU,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
25 SIGS
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
26 };
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
27
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
28 static GObjectClass *parent_class = NULL;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29 static guint signals[SIGS] = { 0 };
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
31 static void init_widget(GntWidget *widget);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
32
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33 static void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34 gnt_widget_init(GTypeInstance *instance, gpointer class)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
35 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36 GntWidget *widget = GNT_WIDGET(instance);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 widget->priv.name = NULL;
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14343
diff changeset
38 GNTDEBUG;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
40
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41 static void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
42 gnt_widget_map(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
43 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
44 /* Get some default size for the widget */
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14343
diff changeset
45 GNTDEBUG;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
46 g_signal_emit(widget, signals[SIG_MAP], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
47 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_MAPPED);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
48 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
49
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
50 static void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
51 gnt_widget_dispose(GObject *obj)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
52 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
53 GntWidget *self = GNT_WIDGET(obj);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
54
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
55 if(!(GNT_WIDGET_FLAGS(self) & GNT_WIDGET_DESTROYING)) {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
56 GNT_WIDGET_SET_FLAGS(self, GNT_WIDGET_DESTROYING);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
57
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
58 g_signal_emit(self, signals[SIG_DESTROY], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
59
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
60 GNT_WIDGET_UNSET_FLAGS(self, GNT_WIDGET_DESTROYING);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
61 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
62
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
63 parent_class->dispose(obj);
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14343
diff changeset
64 GNTDEBUG;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
65 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
66
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
67 static void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
68 gnt_widget_focus_change(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
69 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
70 if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_MAPPED)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 gnt_widget_draw(widget);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
73
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
74 static gboolean
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
75 gnt_widget_dummy_confirm_size(GntWidget *widget, int width, int height)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
76 {
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
77 if (width < widget->priv.minw || height < widget->priv.minh)
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
78 return FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
79 if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
80 return FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
81 if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
82 return FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
83 return TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
84 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
85
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14011
diff changeset
86 static gboolean
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
87 context_menu(GntBindable *bind, GList *null)
14834
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
88 {
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
89 gboolean ret = FALSE;
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
90 g_signal_emit(bind, signals[SIG_CONTEXT_MENU], 0, &ret);
14834
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
91 return ret;
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
92 }
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
93
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94 static void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
95 gnt_widget_class_init(GntWidgetClass *klass)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
96 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99 parent_class = g_type_class_peek_parent(klass);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
100
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
101 obj_class->dispose = gnt_widget_dispose;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
102
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103 klass->destroy = gnt_widget_destroy;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104 klass->show = gnt_widget_show;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 klass->draw = gnt_widget_draw;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 klass->expose = gnt_widget_expose;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 klass->map = gnt_widget_map;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108 klass->lost_focus = gnt_widget_focus_change;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
109 klass->gained_focus = gnt_widget_focus_change;
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
110 klass->confirm_size = gnt_widget_dummy_confirm_size;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
112 klass->key_pressed = NULL;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
113 klass->activate = NULL;
14343
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
114 klass->clicked = NULL;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
115
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
116 signals[SIG_DESTROY] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
117 g_signal_new("destroy",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
118 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
119 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120 G_STRUCT_OFFSET(GntWidgetClass, destroy),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
122 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
123 G_TYPE_NONE, 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
124 signals[SIG_GIVE_FOCUS] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125 g_signal_new("gained-focus",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
126 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
127 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
128 G_STRUCT_OFFSET(GntWidgetClass, gained_focus),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
129 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
130 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
131 G_TYPE_NONE, 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
132 signals[SIG_LOST_FOCUS] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
133 g_signal_new("lost-focus",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
134 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
135 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
136 G_STRUCT_OFFSET(GntWidgetClass, lost_focus),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
137 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
138 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
139 G_TYPE_NONE, 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
140 signals[SIG_ACTIVATE] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
141 g_signal_new("activate",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
142 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
143 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
144 G_STRUCT_OFFSET(GntWidgetClass, activate),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
145 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
146 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
147 G_TYPE_NONE, 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
148 signals[SIG_MAP] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
149 g_signal_new("map",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
150 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
151 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
152 G_STRUCT_OFFSET(GntWidgetClass, map),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
153 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
154 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
155 G_TYPE_NONE, 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
156 signals[SIG_DRAW] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
157 g_signal_new("draw",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
158 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
159 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
160 G_STRUCT_OFFSET(GntWidgetClass, draw),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
161 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
162 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
163 G_TYPE_NONE, 0);
14613
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
164 signals[SIG_HIDE] =
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
165 g_signal_new("hide",
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
166 G_TYPE_FROM_CLASS(klass),
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
167 G_SIGNAL_RUN_LAST,
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
168 G_STRUCT_OFFSET(GntWidgetClass, hide),
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
169 NULL, NULL,
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
170 g_cclosure_marshal_VOID__VOID,
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
171 G_TYPE_NONE, 0);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
172 signals[SIG_EXPOSE] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
173 g_signal_new("expose",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
174 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
175 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
176 G_STRUCT_OFFSET(GntWidgetClass, expose),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
177 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
178 gnt_closure_marshal_VOID__INT_INT_INT_INT,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
179 G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
180 signals[SIG_POSITION] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
181 g_signal_new("position-set",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
182 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
183 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
184 G_STRUCT_OFFSET(GntWidgetClass, set_position),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
185 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
186 gnt_closure_marshal_VOID__INT_INT,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
187 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
188 signals[SIG_SIZE_REQUEST] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
189 g_signal_new("size_request",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
190 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
191 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
192 G_STRUCT_OFFSET(GntWidgetClass, size_request),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
193 NULL, NULL,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
194 g_cclosure_marshal_VOID__VOID,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
195 G_TYPE_NONE, 0);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
196 signals[SIG_SIZE_CHANGED] =
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
197 g_signal_new("size_changed",
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
198 G_TYPE_FROM_CLASS(klass),
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
199 G_SIGNAL_RUN_LAST,
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
200 G_STRUCT_OFFSET(GntWidgetClass, size_changed),
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
201 NULL, NULL,
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
202 gnt_closure_marshal_VOID__INT_INT,
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
203 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
204 signals[SIG_CONFIRM_SIZE] =
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
205 g_signal_new("confirm_size",
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
206 G_TYPE_FROM_CLASS(klass),
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
207 G_SIGNAL_RUN_LAST,
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
208 G_STRUCT_OFFSET(GntWidgetClass, confirm_size),
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
209 NULL, NULL,
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
210 gnt_closure_marshal_BOOLEAN__INT_INT,
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
211 G_TYPE_BOOLEAN, 2, G_TYPE_INT, G_TYPE_INT);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
212 signals[SIG_KEY_PRESSED] =
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
213 g_signal_new("key_pressed",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
214 G_TYPE_FROM_CLASS(klass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
215 G_SIGNAL_RUN_LAST,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
216 G_STRUCT_OFFSET(GntWidgetClass, key_pressed),
14091
ae4cbed1b309 [gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14011
diff changeset
217 gnt_boolean_handled_accumulator, NULL,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
218 gnt_closure_marshal_BOOLEAN__STRING,
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
219 G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
14239
a0b1ab181316 [gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
220
14343
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
221 signals[SIG_CLICKED] =
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
222 g_signal_new("clicked",
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
223 G_TYPE_FROM_CLASS(klass),
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
224 G_SIGNAL_RUN_LAST,
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
225 G_STRUCT_OFFSET(GntWidgetClass, clicked),
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
226 gnt_boolean_handled_accumulator, NULL,
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
227 gnt_closure_marshal_BOOLEAN__INT_INT_INT,
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
228 G_TYPE_BOOLEAN, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
229
14834
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
230 signals[SIG_CONTEXT_MENU] =
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
231 g_signal_new("context-menu",
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
232 G_TYPE_FROM_CLASS(klass),
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
233 G_SIGNAL_RUN_LAST,
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
234 0,
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
235 gnt_boolean_handled_accumulator, NULL,
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
236 gnt_closure_marshal_BOOLEAN__VOID,
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
237 G_TYPE_BOOLEAN, 0);
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
238
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
239 /* This is relevant for all widgets */
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
240 gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "context-menu", context_menu,
14876
70623f0d5cdc [gaim-migrate @ 17645]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14847
diff changeset
241 GNT_KEY_POPUP, NULL);
14834
52022b0a9405 [gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14829
diff changeset
242
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
243 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass));
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14343
diff changeset
244 GNTDEBUG;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
245 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
246
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
247 /******************************************************************************
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
248 * GntWidget API
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
249 *****************************************************************************/
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
250 GType
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
251 gnt_widget_get_gtype(void)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
252 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
253 static GType type = 0;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
254
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
255 if(type == 0) {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
256 static const GTypeInfo info = {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
257 sizeof(GntWidgetClass),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
258 NULL, /* base_init */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
259 NULL, /* base_finalize */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
260 (GClassInitFunc)gnt_widget_class_init,
14239
a0b1ab181316 [gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
261 NULL,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
262 NULL, /* class_data */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
263 sizeof(GntWidget),
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
264 0, /* n_preallocs */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
265 gnt_widget_init, /* instance_init */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
266 };
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
267
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
268 type = g_type_register_static(GNT_TYPE_BINDABLE,
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
269 "GntWidget",
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
270 &info, G_TYPE_FLAG_ABSTRACT);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
271 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
272
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
273 return type;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
274 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
275
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
276 void gnt_widget_set_take_focus(GntWidget *widget, gboolean can)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
277 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
278 if (can)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
279 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
280 else
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
281 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
282 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
283
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
284 /**
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
285 * gnt_widget_destroy:
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
286 * @obj: The #GntWidget instance.
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
287 *
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
288 * Emits the "destroy" signal notifying all reference holders that they
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
289 * should release @obj.
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
290 */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
291 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
292 gnt_widget_destroy(GntWidget *obj)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
293 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
294 g_return_if_fail(GNT_IS_WIDGET(obj));
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
295
13860
c1e3f7c75c3f [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13858
diff changeset
296 gnt_widget_hide(obj);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
297 delwin(obj->window);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
298 if(!(GNT_WIDGET_FLAGS(obj) & GNT_WIDGET_DESTROYING))
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
299 g_object_run_dispose(G_OBJECT(obj));
14432
3ac156db9cb6 [gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14343
diff changeset
300 GNTDEBUG;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
301 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
302
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
303 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
304 gnt_widget_show(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
305 {
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
306 gnt_widget_draw(widget);
14919
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
307 gnt_screen_occupy(widget);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
308 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
309
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
310 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
311 gnt_widget_draw(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
312 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
313 /* Draw the widget */
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
314 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_DRAWING))
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
315 return;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
316
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
317 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_DRAWING);
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
318 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_MAPPED)) {
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
319 gnt_widget_map(widget);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
320 }
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
321
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
322 if (widget->window == NULL)
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
323 {
14919
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
324 int x, y, maxx, maxy, w, h;
14932
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
325 int oldw, oldh;
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
326 gboolean shadow = TRUE;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
327
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
328 if (!gnt_widget_has_shadow(widget))
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
329 shadow = FALSE;
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
330
14919
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
331 x = widget->priv.x;
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
332 y = widget->priv.y;
14932
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
333 w = oldw = widget->priv.width + shadow;
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
334 h = oldh = widget->priv.height + shadow;
14919
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
335
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
336 getmaxyx(stdscr, maxy, maxx);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
337 maxy -= 1; /* room for the taskbar */
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
338
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
339 x = MAX(0, x);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
340 y = MAX(0, y);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
341 if (x + w >= maxx)
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
342 x = MAX(0, maxx - w);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
343 if (y + h >= maxy)
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
344 y = MAX(0, maxy - h);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
345
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
346 w = MIN(w, maxx);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
347 h = MIN(h, maxy);
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
348
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
349 widget->priv.x = x;
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
350 widget->priv.y = y;
14932
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
351 if (w != oldw || h != oldh) {
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
352 widget->priv.width = w - shadow;
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
353 widget->priv.height = h - shadow;
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
354 g_signal_emit(widget, signals[SIG_SIZE_CHANGED], 0, oldw, oldh);
94c69d2efae5 [gaim-migrate @ 17704]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14919
diff changeset
355 }
14919
056c8a27668c [gaim-migrate @ 17691]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14900
diff changeset
356
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
357 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow,
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
358 widget->priv.y, widget->priv.x);
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
359 init_widget(widget);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
360 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
361
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
362 g_signal_emit(widget, signals[SIG_DRAW], 0);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
363 gnt_widget_queue_update(widget);
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
364 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_DRAWING);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
365 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
366
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
367 gboolean
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
368 gnt_widget_key_pressed(GntWidget *widget, const char *keys)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
369 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
370 gboolean ret;
13855
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13850
diff changeset
371 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS))
5b288502a382 [gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13850
diff changeset
372 return FALSE;
14239
a0b1ab181316 [gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14091
diff changeset
373
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
374 if (gnt_bindable_perform_action_key(GNT_BINDABLE(widget), keys))
14793
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14613
diff changeset
375 return TRUE;
8a0cfee11af8 [gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14613
diff changeset
376
14900
065e7ac30338 [gaim-migrate @ 17672]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14881
diff changeset
377 keys = gnt_bindable_remap_keys(GNT_BINDABLE(widget), keys);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
378 g_signal_emit(widget, signals[SIG_KEY_PRESSED], 0, keys, &ret);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
379 return ret;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
380 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
381
14343
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
382 gboolean
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
383 gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y)
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
384 {
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
385 gboolean ret;
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
386 g_signal_emit(widget, signals[SIG_CLICKED], 0, event, x, y, &ret);
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
387 return ret;
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
388 }
0387a167f342 [gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14335
diff changeset
389
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
390 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
391 gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
392 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
393 g_signal_emit(widget, signals[SIG_EXPOSE], 0, x, y, width, height);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
394 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
395
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
396 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
397 gnt_widget_hide(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
398 {
14613
62bb53609a36 [gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14432
diff changeset
399 g_signal_emit(widget, signals[SIG_HIDE], 0);
13860
c1e3f7c75c3f [gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13858
diff changeset
400 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL));
14298
6e2e9e84b99d [gaim-migrate @ 16988]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14292
diff changeset
401 #if 0
6e2e9e84b99d [gaim-migrate @ 16988]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14292
diff changeset
402 /* XXX: I have no clue why, but this seemed to be necessary. */
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
403 if (gnt_widget_has_shadow(widget))
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
404 mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height);
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
405 #endif
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
406 gnt_screen_release(widget);
13980
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
407 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE);
13907
cc60d0861337 [gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13896
diff changeset
408 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_MAPPED);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
409 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
410
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
411 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
412 gnt_widget_set_position(GntWidget *wid, int x, int y)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
413 {
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
414 g_signal_emit(wid, signals[SIG_POSITION], 0, x, y);
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
415 /* XXX: Need to install properties for these and g_object_notify */
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
416 wid->priv.x = x;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
417 wid->priv.y = y;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
418 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
419
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
420 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
421 gnt_widget_get_position(GntWidget *wid, int *x, int *y)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
422 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
423 if (x)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
424 *x = wid->priv.x;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
425 if (y)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
426 *y = wid->priv.y;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
427 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
428
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
429 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
430 gnt_widget_size_request(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
431 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
432 g_signal_emit(widget, signals[SIG_SIZE_REQUEST], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
433 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
434
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
435 void
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
436 gnt_widget_get_size(GntWidget *wid, int *width, int *height)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
437 {
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
438 gboolean shadow = TRUE;
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
439 if (!gnt_widget_has_shadow(wid))
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
440 shadow = FALSE;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
441
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
442 if (width)
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
443 *width = wid->priv.width + shadow;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
444 if (height)
13927
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
445 *height = wid->priv.height + shadow;
9309d27d780c [gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13916
diff changeset
446
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
447 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
448
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
449 static void
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
450 init_widget(GntWidget *widget)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
451 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
452 gboolean shadow = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
453
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
454 if (!gnt_widget_has_shadow(widget))
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
455 shadow = FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
456
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
457 wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL));
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
458 werase(widget->window);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
459
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
460 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
461 {
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
462 /* - This is ugly. */
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
463 /* - What's your point? */
14011
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
464 mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height);
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
465 mvwvline(widget->window, 0, widget->priv.width - 1,
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
466 ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height);
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
467 mvwhline(widget->window, widget->priv.height - 1, 0,
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
468 ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width);
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
469 mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width);
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
470 mvwaddch(widget->window, 0, 0, ACS_ULCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
471 mvwaddch(widget->window, 0, widget->priv.width - 1,
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
472 ACS_URCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
473 mvwaddch(widget->window, widget->priv.height - 1, 0,
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
474 ACS_LLCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
475 mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1,
735c4e927eb8 [gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
476 ACS_LRCORNER | COLOR_PAIR(GNT_COLOR_NORMAL));
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
477 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
478
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
479 if (shadow)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
480 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
481 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_SHADOW));
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
482 mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
483 mvwhline(widget->window, widget->priv.height, 1, ' ', widget->priv.width);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
484 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
485 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
486
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
487 gboolean
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
488 gnt_widget_set_size(GntWidget *widget, int width, int height)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
489 {
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
490 gboolean ret = TRUE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
491
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
492 if (gnt_widget_has_shadow(widget))
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
493 {
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
494 width--;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
495 height--;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
496 }
14847
d478f3853671 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14836
diff changeset
497 if (width <= 0)
d478f3853671 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14836
diff changeset
498 width = widget->priv.width;
d478f3853671 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14836
diff changeset
499 if (height <= 0)
d478f3853671 [gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14836
diff changeset
500 height = widget->priv.height;
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
501
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
502 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
503 {
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
504 ret = gnt_widget_confirm_size(widget, width, height);
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
505 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
506
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
507 if (ret)
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
508 {
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
509 gboolean shadow = TRUE;
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
510 int oldw, oldh;
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
511
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
512 if (!gnt_widget_has_shadow(widget))
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
513 shadow = FALSE;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
514
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
515 oldw = widget->priv.width;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
516 oldh = widget->priv.height;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
517
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
518 widget->priv.width = width;
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
519 widget->priv.height = height;
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
520
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
521 g_signal_emit(widget, signals[SIG_SIZE_CHANGED], 0, oldw, oldh);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
522
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
523 if (widget->window)
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
524 {
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
525 wresize(widget->window, height + shadow, width + shadow);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
526 init_widget(widget);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
527 }
13930
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
528 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
529 init_widget(widget);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
530 else
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
531 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_MAPPED);
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
532 }
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
533
3dbcbc5e57e1 [gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13927
diff changeset
534 return ret;
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
535 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
536
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
537 gboolean
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
538 gnt_widget_set_focus(GntWidget *widget, gboolean set)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
539 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
540 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_CAN_TAKE_FOCUS))
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
541 return FALSE;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
542
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
543 if (set && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS))
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
544 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
545 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
546 g_signal_emit(widget, signals[SIG_GIVE_FOCUS], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
547 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
548 else if (!set)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
549 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
550 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
551 g_signal_emit(widget, signals[SIG_LOST_FOCUS], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
552 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
553 else
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
554 return FALSE;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
555
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
556 return TRUE;
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
557 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
558
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
559 void gnt_widget_set_name(GntWidget *widget, const char *name)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
560 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
561 g_free(widget->priv.name);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
562 widget->priv.name = g_strdup(name);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
563 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
564
14335
b1b76fb9c739 [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14298
diff changeset
565 const char *gnt_widget_get_name(GntWidget *widget)
b1b76fb9c739 [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14298
diff changeset
566 {
b1b76fb9c739 [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14298
diff changeset
567 return widget->priv.name;
b1b76fb9c739 [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14298
diff changeset
568 }
b1b76fb9c739 [gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14298
diff changeset
569
13850
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
570 void gnt_widget_activate(GntWidget *widget)
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
571 {
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
572 g_signal_emit(widget, signals[SIG_ACTIVATE], 0);
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
573 }
0e1e59770cb0 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
574
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
575 static gboolean
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
576 update_queue_callback(gpointer data)
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
577 {
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
578 GntWidget *widget = GNT_WIDGET(data);
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
579
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
580 if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update"))
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
581 return FALSE;
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
582 gnt_screen_update(widget);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
583 g_object_set_data(G_OBJECT(widget), "gnt:queue_update", NULL);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
584 return FALSE;
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
585 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
586
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
587 void gnt_widget_queue_update(GntWidget *widget)
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
588 {
13979
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
589 if (widget->window == NULL)
a71678d2da16 [gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13943
diff changeset
590 return;
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
591 while (widget->parent)
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
592 widget = widget->parent;
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
593
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
594 if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update"))
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
595 {
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
596 int id = g_timeout_add(0, update_queue_callback, widget);
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
597 g_object_set_data_full(G_OBJECT(widget), "gnt:queue_update", GINT_TO_POINTER(id),
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
598 (GDestroyNotify)g_source_remove);
13878
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
599 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
600 }
0d0ab1e39d0a [gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13869
diff changeset
601
13943
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
602 gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height)
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
603 {
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
604 gboolean ret = FALSE;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
605 g_signal_emit(widget, signals[SIG_CONFIRM_SIZE], 0, width, height, &ret);
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
606 return ret;
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
607 }
25be562aaca8 [gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13935
diff changeset
608
13980
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
609 void gnt_widget_set_visible(GntWidget *widget, gboolean set)
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
610 {
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
611 if (set)
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
612 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_INVISIBLE);
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
613 else
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
614 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE);
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
615 }
c9509bd42d7a [gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13979
diff changeset
616
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
617 gboolean gnt_widget_has_shadow(GntWidget *widget)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
618 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
619 return (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW) &&
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
620 gnt_style_get_bool(GNT_STYLE_SHADOW, FALSE));
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
621 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 13980
diff changeset
622