gwenhywfar  4.6.0beta
w_label.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Sun May 16 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  GtkLabel *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 
39  default:
40  break;
41  }
42 
44  "Function is not appropriate for this type of widget (%s)",
46  return GWEN_ERROR_INVALID;
47 }
48 
49 
50 
51 
52 static GWENHYWFAR_CB
55  int index,
56  int defaultValue) {
57  GtkLabel *g;
58 
60  assert(g);
61 
62  switch(prop) {
64  return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
65 
67  return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
68  return 0;
69 
72  /* just ignore these for now */
73  return 0;
74 
75  default:
76  break;
77  }
78 
80  "Function is not appropriate for this type of widget (%s)",
82  return defaultValue;
83 }
84 
85 
86 
87 static GWENHYWFAR_CB
90  int index,
91  const char *value,
92  int doSignal) {
93  GtkLabel *g;
94  GWEN_BUFFER *tbuf;
95 
97  assert(g);
98 
99  tbuf=GWEN_Buffer_new(0, 128, 0, 1);
100  if (value && *value)
101  Gtk2Gui_GetRawText(value, tbuf);
102 
103  switch(prop) {
105  gtk_label_set_text(g, GWEN_Buffer_GetStart(tbuf));
106  GWEN_Buffer_free(tbuf);
107  return 0;
108  default:
109  break;
110  }
111 
113  "Function is not appropriate for this type of widget (%s)",
115  GWEN_Buffer_free(tbuf);
116  return GWEN_ERROR_INVALID;
117 }
118 
119 
120 
121 static GWENHYWFAR_CB
124  int index,
125  const char *defaultValue) {
126  GtkLabel *g;
127 
129  assert(g);
130 
131  switch(prop) {
133  return gtk_label_get_label(g);
134  default:
135  break;
136  }
137 
139  "Function is not appropriate for this type of widget (%s)",
141  return defaultValue;
142 }
143 
144 
145 
147  GtkWidget *g;
148  const char *s;
149  uint32_t flags;
150  GWEN_WIDGET *wParent;
151  GWEN_BUFFER *tbuf;
152 
153  flags=GWEN_Widget_GetFlags(w);
154  wParent=GWEN_Widget_Tree_GetParent(w);
155  s=GWEN_Widget_GetText(w, 0);
156 
157  tbuf=GWEN_Buffer_new(0, 128, 0, 1);
158  if (s && *s)
159  Gtk2Gui_GetRawText(s, tbuf);
160 
161  g=gtk_label_new(GWEN_Buffer_GetStart(tbuf));
162  GWEN_Buffer_free(tbuf);
165 
170 
171  if (wParent)
172  GWEN_Widget_AddChildGuiWidget(wParent, w);
173 
174  return 0;
175 }
176 
177