gwenhywfar 5.14.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
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
153
154
155
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
250
251
252
256
257
258
262
263
264
267}
268
269
270
274
275
276
280
281
282
286
287
288
289const char *CppWidget::getText(int idx) {
290 return GWEN_Widget_GetText(_widget, idx);
291}
292
293
294
298
299
300
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)
friend class CppWidget
A C++ binding for the C module GWEN_WIDGET.
Definition cppwidget.hpp:32
int getHeight()
GWEN_WIDGET_TYPE getType()
const char * getName()
int getRows()
CppWidget(GWEN_WIDGET *w)
GWEN_WIDGET * _widget
Definition cppwidget.hpp:66
static CPPGUI_API CppWidget * getWidget(GWEN_WIDGET *w)
const char * getIconFileName()
virtual int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
const char * getImageFileName()
int getWidth()
virtual const char * getCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
int getColumns()
virtual int addChildGuiWidget(GWEN_WIDGET *wChild)
CppDialog * getDialog()
virtual int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
const char * getText(int idx)
virtual ~CppWidget()
uint32_t getFlags()
virtual int setCharProperty(GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
int getGroupId()
GWEN_WIDGET * getCInterface()
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:326
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition inherit.h:300
#define GWEN_INHERIT(bt, t)
Definition inherit.h:264
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition inherit.h:279
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition widget.c:740
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:710
GWEN_WIDGET_ADDCHILDGUIWIDGET_FN GWEN_Widget_SetAddChildGuiWidgetFn(GWEN_WIDGET *w, GWEN_WIDGET_ADDCHILDGUIWIDGET_FN fn)
Definition widget.c:755
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:695
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:725
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