gwenhywfar  4.7.0beta
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 
14 static GWENHYWFAR_CB
17  int index,
18  int value,
19  int doSignal) {
20  GtkButton *g;
21 
23  assert(g);
24 
25  switch(prop) {
27  gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
28  return 0;
29 
31  gtk_widget_grab_focus(GTK_WIDGET(g));
32  return 0;
33 
36  /* just ignore these for now */
37  return 0;
38 
40  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g), (value==0)?FALSE:TRUE);
41  return 0;
42 
43  default:
44  break;
45  }
46 
48  "Function is not appropriate for this type of widget (%s)",
50  return GWEN_ERROR_INVALID;
51 }
52 
53 
54 
55 
56 static GWENHYWFAR_CB
59  int index,
60  int defaultValue) {
61  GtkButton *g;
62 
64  assert(g);
65 
66  switch(prop) {
68  return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
69 
71  return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
72 
75  /* just ignore these for now */
76  return 0;
77 
79  return (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g))==TRUE)?1:0;
80 
81  default:
82  break;
83  }
84 
86  "Function is not appropriate for this type of widget (%s)",
88  return defaultValue;
89 }
90 
91 
92 
93 static GWENHYWFAR_CB
96  int index,
97  const char *value,
98  int doSignal) {
99  GtkButton *g;
100 
102  assert(g);
103 
104  switch(prop) {
106  gtk_button_set_label(g, value);
107  return 0;
108  default:
109  break;
110  }
111 
113  "Function is not appropriate for this type of widget (%s)",
115  return GWEN_ERROR_INVALID;
116 }
117 
118 
119 
120 static GWENHYWFAR_CB
123  int index,
124  const char *defaultValue) {
125  GtkButton *g;
126 
128  assert(g);
129 
130  switch(prop) {
132  return gtk_button_get_label(g);
133  default:
134  break;
135  }
136 
138  "Function is not appropriate for this type of widget (%s)",
140  return defaultValue;
141 }
142 
143 
144 
145 static void Gtk2Gui_WCheckBox_Toggled_handler(GtkButton *button, gpointer data) {
146  GWEN_WIDGET *w;
147  int rv;
148 
149  w=data;
150  assert(w);
156  else if (rv==GWEN_DialogEvent_ResultReject)
158 }
159 
160 
161 
163  GtkWidget *g;
164  const char *s;
165  uint32_t flags;
166  GWEN_WIDGET *wParent;
167  gulong toggled_handler_id;
168 
169  flags=GWEN_Widget_GetFlags(w);
170  wParent=GWEN_Widget_Tree_GetParent(w);
171  s=GWEN_Widget_GetText(w, 0);
172 
173  /* create widget */
174  if (s && *s)
175  g=gtk_check_button_new_with_mnemonic(s);
176  else
177  g=gtk_check_button_new();
178 
181 
186 
187  toggled_handler_id=g_signal_connect(g,
188  "toggled",
190  w);
191 
192  if (wParent)
193  GWEN_Widget_AddChildGuiWidget(wParent, w);
194 
195  return 0;
196 }
197 
198