gwenhywfar 5.10.1
gtk2/w_checkbox.c
Go to the documentation of this file.
1/***************************************************************************
2 begin : Mon Jul 12 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10
11
12
13
14static GWENHYWFAR_CB
17 GWEN_UNUSED int index,
18 int value,
19 GWEN_UNUSED int doSignal)
20{
21 GtkButton *g;
22
24 assert(g);
25
26 switch (prop) {
28 gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
29 return 0;
30
32 gtk_widget_grab_focus(GTK_WIDGET(g));
33 return 0;
34
37 /* just ignore these for now */
38 return 0;
39
41 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g), (value==0)?FALSE:TRUE);
42 return 0;
43
44 default:
45 break;
46 }
47
49 "Function is not appropriate for this type of widget (%s)",
51 return GWEN_ERROR_INVALID;
52}
53
54
55
56
57static GWENHYWFAR_CB
60 GWEN_UNUSED int index,
61 int defaultValue)
62{
63 GtkButton *g;
64
66 assert(g);
67
68 switch (prop) {
70 return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
71
73 return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
74
77 /* just ignore these for now */
78 return 0;
79
81 return (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g))==TRUE)?1:0;
82
83 default:
84 break;
85 }
86
88 "Function is not appropriate for this type of widget (%s)",
90 return defaultValue;
91}
92
93
94
95static GWENHYWFAR_CB
98 GWEN_UNUSED int index,
99 const char *value,
100 GWEN_UNUSED int doSignal)
101{
102 GtkButton *g;
103
105 assert(g);
106
107 switch (prop) {
109 gtk_button_set_label(g, value);
110 return 0;
111 default:
112 break;
113 }
114
116 "Function is not appropriate for this type of widget (%s)",
118 return GWEN_ERROR_INVALID;
119}
120
121
122
123static GWENHYWFAR_CB
126 GWEN_UNUSED int index,
127 const char *defaultValue)
128{
129 GtkButton *g;
130
132 assert(g);
133
134 switch (prop) {
136 return gtk_button_get_label(g);
137 default:
138 break;
139 }
140
142 "Function is not appropriate for this type of widget (%s)",
144 return defaultValue;
145}
146
147
148
149static void Gtk2Gui_WCheckBox_Toggled_handler(GWEN_UNUSED GtkButton *button, gpointer data)
150{
151 GWEN_WIDGET *w;
152 int rv;
153
154 w=data;
155 assert(w);
163}
164
165
166
168{
169 GtkWidget *g;
170 const char *s;
171 /*uint32_t flags;*/
172 GWEN_WIDGET *wParent;
173 /*gulong toggled_handler_id;*/
174
175 /*flags=GWEN_Widget_GetFlags(w);*/
176 wParent=GWEN_Widget_Tree_GetParent(w);
177 s=GWEN_Widget_GetText(w, 0);
178
179 /* create widget */
180 if (s && *s)
181 g=gtk_check_button_new_with_mnemonic(s);
182 else
183 g=gtk_check_button_new();
184
187
192
193 /*toggled_handler_id=*/g_signal_connect(g,
194 "toggled",
196 w);
197
198 if (wParent)
200
201 return 0;
202}
203
204
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:125
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: dialog.c:321
@ GWEN_DialogEvent_ResultAccept
Definition: dialog.h:122
@ GWEN_DialogEvent_ResultReject
Definition: dialog.h:123
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
@ GWEN_DialogProperty_Title
Definition: dialog.h:263
@ GWEN_DialogProperty_Height
Definition: dialog.h:273
@ GWEN_DialogProperty_Enabled
Definition: dialog.h:267
@ GWEN_DialogProperty_Value
Definition: dialog.h:264
@ GWEN_DialogProperty_Focus
Definition: dialog.h:276
@ GWEN_DialogProperty_Width
Definition: dialog.h:272
@ GWEN_DialogEvent_TypeActivated
Definition: dialog.h:102
#define GWEN_ERROR_INVALID
Definition: error.h:67
int Gtk2Gui_WCheckBox_Setup(GWEN_WIDGET *w)
static GWENHYWFAR_CB const char * Gtk2Gui_WCheckBox_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
static GWENHYWFAR_CB int Gtk2Gui_WCheckBox_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int defaultValue)
static GWENHYWFAR_CB int Gtk2Gui_WCheckBox_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *value, GWEN_UNUSED int doSignal)
static void Gtk2Gui_WCheckBox_Toggled_handler(GWEN_UNUSED GtkButton *button, gpointer data)
static GWENHYWFAR_CB int Gtk2Gui_WCheckBox_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int value, GWEN_UNUSED int doSignal)
#define GTK2_DIALOG_WIDGET_REAL
#define GTK2_DIALOG_WIDGET_CONTENT
void Gtk2Gui_Dialog_Leave(GWEN_DIALOG *dlg, int result)
#define GWEN_UNUSED
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define GWEN_LOGDOMAIN
Definition: logger.h:35
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition: widget.c:732
GWEN_DIALOG * GWEN_Widget_GetTopDialog(const GWEN_WIDGET *w)
Definition: widget.c:102
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition: widget.c:320
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition: widget.c:702
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
GWEN_WIDGET_SETINTPROPERTY_FN GWEN_Widget_SetSetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETINTPROPERTY_FN fn)
Definition: widget.c:687
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:293
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition: widget.c:92
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition: widget.c:717
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34