gwenhywfar  4.99.8beta
gtk2/w_lineedit.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  GtkWidget *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  GtkWidget *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  GtkWidget *g;
94 
96  assert(g);
97 
98  switch(prop) {
100  gtk_entry_set_text(GTK_ENTRY(g), value);
101  return 0;
102  default:
103  break;
104  }
105 
107  "Function is not appropriate for this type of widget (%s)",
109  return GWEN_ERROR_INVALID;
110 }
111 
112 
113 
114 static GWENHYWFAR_CB
117  int index,
118  const char *defaultValue) {
119  GtkWidget *g;
120 
122  assert(g);
123 
124  switch(prop) {
126  return gtk_entry_get_text(GTK_ENTRY(g));
127  default:
128  break;
129  }
130 
132  "Function is not appropriate for this type of widget (%s)",
134  return defaultValue;
135 }
136 
137 
138 
139 static void Gtk2Gui_WLineEdit_Deleted_text_handler(GtkEntryBuffer *entrybuffer,
140  guint arg1,
141  guint arg2,
142  gpointer data) {
143  GWEN_WIDGET *w;
144  int rv;
145 
146  w=data;
147  assert(w);
153  else if (rv==GWEN_DialogEvent_ResultReject)
155 }
156 
157 
158 
159 static void Gtk2Gui_WLineEdit_Inserted_text_handler(GtkEntryBuffer *entrybuffer,
160  guint arg1,
161  gchar *arg2,
162  guint arg3,
163  gpointer data) {
164  GWEN_WIDGET *w;
165  int rv;
166 
167  w=data;
168  assert(w);
174  else if (rv==GWEN_DialogEvent_ResultReject)
176 }
177 
178 
179 
181  GtkWidget *g;
182  const char *s;
183  uint32_t flags;
184  GWEN_WIDGET *wParent;
185  gulong deleted_text_handler_id;
186  gulong inserted_text_handler_id;
187  gboolean text_is_visible;
188 
189  flags=GWEN_Widget_GetFlags(w);
190  text_is_visible = (flags & GWEN_WIDGET_FLAGS_PASSWORD) == 0;
191  wParent=GWEN_Widget_Tree_GetParent(w);
192  s=GWEN_Widget_GetText(w, 0);
193 
194  /* create widget */
195  g=gtk_entry_new();
196  if (s && *s)
197  gtk_entry_set_text(GTK_ENTRY(g), s);
198  gtk_entry_set_visibility(GTK_ENTRY(g), text_is_visible);
199 
202 
207 
208  deleted_text_handler_id=g_signal_connect(gtk_entry_get_buffer(GTK_ENTRY(g)),
209  "deleted-text",
211  w);
212 
213  inserted_text_handler_id=g_signal_connect(gtk_entry_get_buffer(GTK_ENTRY(g)),
214  "inserted-text",
216  w);
217 
218  if (wParent)
219  GWEN_Widget_AddChildGuiWidget(wParent, w);
220 
221  return 0;
222 }
223 
224 
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:175
#define GWEN_ERROR_INVALID
Definition: error.h:67
int Gtk2Gui_WLineEdit_Setup(GWEN_WIDGET *w)
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition: widget.c:294
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition: widget.c:663
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition: widget.c:677
GWEN_DIALOG_PROPERTY
Definition: dialog.h:215
static GWENHYWFAR_CB int Gtk2Gui_WLineEdit_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:143
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:118
#define GWEN_LOGDOMAIN
Definition: logger.h:35
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:131
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition: widget.c:649
static void Gtk2Gui_WLineEdit_Inserted_text_handler(GtkEntryBuffer *entrybuffer, guint arg1, gchar *arg2, guint arg3, gpointer data)
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:118
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition: widget.c:90
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define GTK2_DIALOG_WIDGET_REAL
#define GWEN_WIDGET_FLAGS_PASSWORD
Definition: dialog.h:64
GWEN_WIDGET_SETINTPROPERTY_FN GWEN_Widget_SetSetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETINTPROPERTY_FN fn)
Definition: widget.c:635
GWEN_DIALOG * GWEN_Widget_GetTopDialog(const GWEN_WIDGET *w)
Definition: widget.c:99
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:767
static void Gtk2Gui_WLineEdit_Deleted_text_handler(GtkEntryBuffer *entrybuffer, guint arg1, guint arg2, gpointer data)
static GWENHYWFAR_CB const char * Gtk2Gui_WLineEdit_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: dialog.c:258
#define GTK2_DIALOG_WIDGET_CONTENT
static GWENHYWFAR_CB int Gtk2Gui_WLineEdit_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
void Gtk2Gui_Dialog_Leave(GWEN_DIALOG *dlg, int result)
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:413
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition: widget.c:271
static GWENHYWFAR_CB int Gtk2Gui_WLineEdit_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)