Mercurial > pidgin.yaz
comparison console/libgnt/gntline.c @ 13943:25be562aaca8
[gaim-migrate @ 16480]
New widget GntLine to use as a separator.
A partial dialog for add-account callback. Updating the dialog
as a result of selection-change in the prpl dropdown is way ickier
than I had expected it to be. It 'works' now, but quite a bit
quirky. I will try to smooth things up later, perhaps next week.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 10 Jul 2006 23:55:24 +0000 |
parents | |
children | 7573bd40a190 |
comparison
equal
deleted
inserted
replaced
13942:b14fdab68eac | 13943:25be562aaca8 |
---|---|
1 #include "gntline.h" | |
2 | |
3 enum | |
4 { | |
5 SIGS = 1, | |
6 }; | |
7 | |
8 static GntWidgetClass *parent_class = NULL; | |
9 static guint signals[SIGS] = { 0 }; | |
10 | |
11 static void | |
12 gnt_line_draw(GntWidget *widget) | |
13 { | |
14 GntLine *line = GNT_LINE(widget); | |
15 if (line->vertical) | |
16 mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), | |
17 widget->priv.height - 3); | |
18 else | |
19 mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), | |
20 widget->priv.width - 3); | |
21 } | |
22 | |
23 static void | |
24 gnt_line_size_request(GntWidget *widget) | |
25 { | |
26 if (GNT_LINE(widget)->vertical) | |
27 { | |
28 widget->priv.width = 1; | |
29 widget->priv.height = 5; | |
30 } | |
31 else | |
32 { | |
33 widget->priv.width = 5; | |
34 widget->priv.height = 1; | |
35 } | |
36 } | |
37 | |
38 static void | |
39 gnt_line_map(GntWidget *widget) | |
40 { | |
41 if (widget->priv.width == 0 || widget->priv.height == 0) | |
42 gnt_widget_size_request(widget); | |
43 DEBUG; | |
44 } | |
45 | |
46 static void | |
47 gnt_line_class_init(GntLineClass *klass) | |
48 { | |
49 parent_class = GNT_WIDGET_CLASS(klass); | |
50 parent_class->draw = gnt_line_draw; | |
51 parent_class->map = gnt_line_map; | |
52 parent_class->size_request = gnt_line_size_request; | |
53 | |
54 DEBUG; | |
55 } | |
56 | |
57 static void | |
58 gnt_line_init(GTypeInstance *instance, gpointer class) | |
59 { | |
60 GntWidget *widget = GNT_WIDGET(instance); | |
61 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW | GNT_WIDGET_NO_BORDER); | |
62 widget->priv.minw = 1; | |
63 widget->priv.minh = 1; | |
64 DEBUG; | |
65 } | |
66 | |
67 /****************************************************************************** | |
68 * GntLine API | |
69 *****************************************************************************/ | |
70 GType | |
71 gnt_line_get_gtype(void) | |
72 { | |
73 static GType type = 0; | |
74 | |
75 if(type == 0) | |
76 { | |
77 static const GTypeInfo info = { | |
78 sizeof(GntLineClass), | |
79 NULL, /* base_init */ | |
80 NULL, /* base_finalize */ | |
81 (GClassInitFunc)gnt_line_class_init, | |
82 NULL, /* class_finalize */ | |
83 NULL, /* class_data */ | |
84 sizeof(GntLine), | |
85 0, /* n_preallocs */ | |
86 gnt_line_init, /* instance_init */ | |
87 }; | |
88 | |
89 type = g_type_register_static(GNT_TYPE_WIDGET, | |
90 "GntLine", | |
91 &info, 0); | |
92 } | |
93 | |
94 return type; | |
95 } | |
96 | |
97 GntWidget *gnt_line_new(gboolean vertical) | |
98 { | |
99 GntWidget *widget = g_object_new(GNT_TYPE_LINE, NULL); | |
100 GntLine *line = GNT_LINE(widget); | |
101 | |
102 line->vertical = vertical; | |
103 | |
104 if (vertical) | |
105 { | |
106 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_Y); | |
107 } | |
108 else | |
109 { | |
110 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X); | |
111 } | |
112 | |
113 return widget; | |
114 } | |
115 |