gwenhywfar 5.10.1
cppwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 begin : Fri Jan 22 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#ifdef HAVE_CONFIG_H
11# include <config.h>
12#endif
13
14#include "cppwidget_p.hpp"
15#include "cppdialog.hpp"
16
17#include <assert.h>
18
19#include <gwenhywfar/inherit.h>
20#include <gwenhywfar/debug.h>
21#include <gwenhywfar/gui_be.h>
22#include <gwenhywfar/widget_be.h>
23#include <gwenhywfar/i18n.h>
24
25#include <gwenhywfar/text.h>
26#include <gwenhywfar/mdigest.h>
27#include <gwenhywfar/debug.h>
28
29
30#define I18N(msg) GWEN_I18N_Translate(PACKAGE, msg)
31
32
33
35
36
37
38
39int CppWidgetLinker::SetIntProperty(GWEN_WIDGET *w,
41 int index,
42 int value,
43 int doSignal) {
44 CppWidget *xw;
45
46 assert(w);
48 assert(xw);
49
50 return xw->setIntProperty(prop, index, value, doSignal);
51}
52
53
54
55
56int CppWidgetLinker::GetIntProperty(GWEN_WIDGET *w,
58 int index,
59 int defaultValue) {
60 CppWidget *xw;
61
62 assert(w);
64 assert(xw);
65
66 return xw->getIntProperty(prop, index, defaultValue);
67}
68
69
70
71int CppWidgetLinker::SetCharProperty(GWEN_WIDGET *w,
73 int index,
74 const char *value,
75 int doSignal) {
76 CppWidget *xw;
77
78 assert(w);
80 assert(xw);
81
82 return xw->setCharProperty(prop, index, value, doSignal);
83}
84
85
86
87const char *CppWidgetLinker::GetCharProperty(GWEN_WIDGET *w,
89 int index,
90 const char *defaultValue) {
91 CppWidget *xw;
92
93 assert(w);
95 assert(xw);
96
97 return xw->getCharProperty(prop, index, defaultValue);
98}
99
100
101
102int CppWidgetLinker::AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild) {
103 CppWidget *xw;
104
105 assert(w);
107 assert(xw);
108
109 return xw->addChildGuiWidget(wChild);
110}
111
112
113
114void CppWidgetLinker::freeData(void *bp, void *p) {
115 CppWidget *xw;
116
117 xw=(CppWidget*) p;
118 if (xw->_widget)
119 xw->_widget=NULL;
120 delete xw;
121}
122
123
124
125
126
128 :_widget(NULL) {
129}
130
131
132
134 :_widget(w) {
136 _widget, this,
137 CppWidgetLinker::freeData);
138
139 _setIntPropertyFn=GWEN_Widget_SetSetIntPropertyFn(_widget, CppWidgetLinker::SetIntProperty);
140 _getIntPropertyFn=GWEN_Widget_SetGetIntPropertyFn(_widget, CppWidgetLinker::GetIntProperty);
141 _setCharPropertyFn=GWEN_Widget_SetSetCharPropertyFn(_widget, CppWidgetLinker::SetCharProperty);
142 _getCharPropertyFn=GWEN_Widget_SetGetCharPropertyFn(_widget, CppWidgetLinker::GetCharProperty);
143 _addChildGuiWidgetFn=GWEN_Widget_SetAddChildGuiWidgetFn(_widget, CppWidgetLinker::AddChildGuiWidget);
144}
145
146
147
149 if (_widget) {
151 }
152}
153
154
155
157 return _widget;
158}
159
160
161
163 CppWidget *xw;
164
165 assert(w);
167 assert(xw);
168
169 return xw;
170}
171
172
173
175 GWEN_DIALOG *dlg;
176
178 if (dlg)
179 return CppDialog::getDialog(dlg);
180 else
181 return NULL;
182}
183
184
185
187 int index,
188 int value,
189 int doSignal) {
190 if (_setIntPropertyFn)
191 return _setIntPropertyFn(_widget, prop, index, value, doSignal);
192 else
194}
195
196
197
199 int index,
200 int defaultValue) {
201 if (_getIntPropertyFn)
202 return _getIntPropertyFn(_widget, prop, index, defaultValue);
203 else
204 return defaultValue;
205}
206
207
208
210 int index,
211 const char *value,
212 int doSignal) {
213 if (_setCharPropertyFn)
214 return _setCharPropertyFn(_widget, prop, index, value, doSignal);
215 else
217}
218
219
220
222 int index,
223 const char *defaultValue) {
224 if (_getCharPropertyFn)
225 return _getCharPropertyFn(_widget, prop, index, defaultValue);
226 else
227 return defaultValue;
228}
229
230
231
233 if (_addChildGuiWidgetFn)
234 return _addChildGuiWidgetFn(_widget, wChild);
235 else
237}
238
239
240
241const char *CppWidget::getName() {
243}
244
245
246
249}
250
251
252
255}
256
257
258
261}
262
263
264
267}
268
269
270
273}
274
275
276
279}
280
281
282
285}
286
287
288
289const char *CppWidget::getText(int idx) {
290 return GWEN_Widget_GetText(_widget, idx);
291}
292
293
294
297}
298
299
300
303}
304
305
306
307
308
309
310
311
#define NULL
Definition: binreloc.c:300
A C++ binding for the C module GWEN_DIALOG.
Definition: cppdialog.hpp:32
static CPPGUI_API CppDialog * getDialog(GWEN_DIALOG *dlg)
Definition: cppdialog.cpp:146
A C++ binding for the C module GWEN_WIDGET.
Definition: cppwidget.hpp:32
int getHeight()
Definition: cppwidget.cpp:283
GWEN_WIDGET_TYPE getType()
Definition: cppwidget.cpp:247
const char * getName()
Definition: cppwidget.cpp:241
int getRows()
Definition: cppwidget.cpp:259
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
static CPPGUI_API CppWidget * getWidget(GWEN_WIDGET *w)
Definition: cppwidget.cpp:162
const char * getIconFileName()
Definition: cppwidget.cpp:295
virtual int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
Definition: cppwidget.cpp:186
const char * getImageFileName()
Definition: cppwidget.cpp:301
int getWidth()
Definition: cppwidget.cpp:277
virtual const char * getCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
Definition: cppwidget.cpp:221
int getColumns()
Definition: cppwidget.cpp:253
virtual int addChildGuiWidget(GWEN_WIDGET *wChild)
Definition: cppwidget.cpp:232
CppDialog * getDialog()
Definition: cppwidget.cpp:174
virtual int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
Definition: cppwidget.cpp:198
const char * getText(int idx)
Definition: cppwidget.cpp:289
virtual ~CppWidget()
Definition: cppwidget.cpp:148
uint32_t getFlags()
Definition: cppwidget.cpp:265
virtual int setCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
Definition: cppwidget.cpp:209
int getGroupId()
Definition: cppwidget.cpp:271
GWEN_WIDGET * getCInterface()
Definition: cppwidget.cpp:156
struct GWEN_DIALOG GWEN_DIALOG
Definition: dialog.h:54
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
#define GWEN_ERROR_NOT_SUPPORTED
Definition: error.h:109
#define GWEN_INHERIT_UNLINK(bt, t, element)
Definition: inherit.h:318
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition: inherit.h:292
#define GWEN_INHERIT(bt, t)
Definition: inherit.h:264
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition: inherit.h:271
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition: widget.c:732
int GWEN_Widget_GetColumns(const GWEN_WIDGET *w)
Definition: widget.c:203
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition: widget.c:320
int GWEN_Widget_GetWidth(const GWEN_WIDGET *w)
Definition: widget.c:257
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition: widget.c:702
GWEN_WIDGET_ADDCHILDGUIWIDGET_FN GWEN_Widget_SetAddChildGuiWidgetFn(GWEN_WIDGET *w, GWEN_WIDGET_ADDCHILDGUIWIDGET_FN fn)
Definition: widget.c:747
const char * GWEN_Widget_GetImageFileName(const GWEN_WIDGET *w)
Definition: widget.c:364
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_GetIconFileName(const GWEN_WIDGET *w)
Definition: widget.c:342
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition: widget.c:92
int GWEN_Widget_GetGroupId(const GWEN_WIDGET *w)
Definition: widget.c:239
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
int GWEN_Widget_GetRows(const GWEN_WIDGET *w)
Definition: widget.c:221
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition: widget.c:717
int GWEN_Widget_GetHeight(const GWEN_WIDGET *w)
Definition: widget.c:275
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
GWEN_WIDGET_TYPE
Definition: widget_be.h:49