gwenhywfar 5.14.1
gtk3/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
14static GWENHYWFAR_CB
17 GWEN_UNUSED int index,
18 int value,
19 GWEN_UNUSED int doSignal)
20{
21 GtkLabel *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
40 default:
41 break;
42 }
43
45 "Function is not appropriate for this type of widget (%s)",
47 return GWEN_ERROR_INVALID;
48}
49
50
51
52
53static GWENHYWFAR_CB
56 GWEN_UNUSED int index,
57 int defaultValue)
58{
59 GtkLabel *g;
60
62 assert(g);
63
64 switch (prop) {
66 return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
67
69 return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
70 return 0;
71
74 /* just ignore these for now */
75 return 0;
76
77 default:
78 break;
79 }
80
82 "Function is not appropriate for this type of widget (%s)",
84 return defaultValue;
85}
86
87
88
89static GWENHYWFAR_CB
92 GWEN_UNUSED int index,
93 const char *value,
94 GWEN_UNUSED int doSignal)
95{
96 GtkLabel *g;
97 GWEN_BUFFER *tbuf;
98
100 assert(g);
101
102 tbuf=GWEN_Buffer_new(0, 128, 0, 1);
103 if (value && *value)
104 Gtk3Gui_GetRawText(value, tbuf);
105
106 switch (prop) {
108 gtk_label_set_text(g, GWEN_Buffer_GetStart(tbuf));
109 GWEN_Buffer_free(tbuf);
110 return 0;
111 default:
112 break;
113 }
114
116 "Function is not appropriate for this type of widget (%s)",
118 GWEN_Buffer_free(tbuf);
119 return GWEN_ERROR_INVALID;
120}
121
122
123
124static GWENHYWFAR_CB
127 GWEN_UNUSED int index,
128 const char *defaultValue)
129{
130 GtkLabel *g;
131
133 assert(g);
134
135 switch (prop) {
137 return gtk_label_get_label(g);
138 default:
139 break;
140 }
141
143 "Function is not appropriate for this type of widget (%s)",
145 return defaultValue;
146}
147
148
149
151{
152 GtkWidget *g;
153 const char *s;
154 GWEN_WIDGET *wParent;
155 GWEN_BUFFER *tbuf;
156
157 wParent=GWEN_Widget_Tree_GetParent(w);
158 s=GWEN_Widget_GetText(w, 0);
159
160 tbuf=GWEN_Buffer_new(0, 128, 0, 1);
161 if (s && *s)
162 Gtk3Gui_GetRawText(s, tbuf);
163
164 g=gtk_label_new(GWEN_Buffer_GetStart(tbuf));
165 GWEN_Buffer_free(tbuf);
168
173
174 if (wParent)
176
177 return 0;
178}
179
180
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition buffer.c:42
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition buffer.c:89
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition buffer.c:235
#define DBG_WARN(dbg_logger, format,...)
Definition debug.h:125
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_Focus
Definition dialog.h:276
@ GWEN_DialogProperty_Width
Definition dialog.h:272
#define GWEN_ERROR_INVALID
Definition error.h:67
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
static GWENHYWFAR_CB int Gtk3Gui_WLabel_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *value, GWEN_UNUSED int doSignal)
static GWENHYWFAR_CB int Gtk3Gui_WLabel_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int value, GWEN_UNUSED int doSignal)
int Gtk3Gui_WLabel_Setup(GWEN_WIDGET *w)
static GWENHYWFAR_CB int Gtk3Gui_WLabel_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int defaultValue)
static GWENHYWFAR_CB const char * Gtk3Gui_WLabel_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
#define GTK3_DIALOG_WIDGET_CONTENT
#define GTK3_DIALOG_WIDGET_REAL
int Gtk3Gui_GetRawText(const char *text, GWEN_BUFFER *tbuf)
#define GWEN_UNUSED
#define GWENHYWFAR_CB
#define GWEN_LOGDOMAIN
Definition logger.h:32
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition widget.c:740
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition widget.c:710
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:836
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:695
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:456
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:725
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34