gwenhywfar 5.10.1
cppdialog.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 "cppdialog_p.hpp"
15#include <assert.h>
16
17#include <gwenhywfar/inherit.h>
18#include <gwenhywfar/debug.h>
19#include <gwenhywfar/gui_be.h>
20#include <gwenhywfar/i18n.h>
21
22#include <gwenhywfar/text.h>
23#include <gwenhywfar/mdigest.h>
24#include <gwenhywfar/debug.h>
25
26
27#define I18N(msg) GWEN_I18N_Translate(PACKAGE, msg)
28
29
30
32
33
34
35
36int CppDialogLinker::SetIntProperty(GWEN_DIALOG *dlg,
37 GWEN_WIDGET *w,
39 int index,
40 int value,
41 int doSignal) {
42 CppDialog *xdlg;
43
44 assert(dlg);
46 assert(xdlg);
47
48 return xdlg->setIntProperty(w, prop, index, value, doSignal);
49}
50
51
52
53
54int CppDialogLinker::GetIntProperty(GWEN_DIALOG *dlg,
55 GWEN_WIDGET *w,
57 int index,
58 int defaultValue) {
59 CppDialog *xdlg;
60
61 assert(dlg);
63 assert(xdlg);
64
65 return xdlg->getIntProperty(w, prop, index, defaultValue);
66}
67
68
69
70int CppDialogLinker::SetCharProperty(GWEN_DIALOG *dlg,
71 GWEN_WIDGET *w,
73 int index,
74 const char *value,
75 int doSignal) {
76 CppDialog *xdlg;
77
78 assert(dlg);
80 assert(xdlg);
81
82 return xdlg->setCharProperty(w, prop, index, value, doSignal);
83}
84
85
86
87const char *CppDialogLinker::GetCharProperty(GWEN_DIALOG *dlg,
88 GWEN_WIDGET *w,
90 int index,
91 const char *defaultValue) {
92 CppDialog *xdlg;
93
94 assert(dlg);
96 assert(xdlg);
97
98 return xdlg->getCharProperty(w, prop, index, defaultValue);
99}
100
101
102
103void CppDialogLinker::freeData(void *bp, void *p) {
104 CppDialog *xdlg;
105
106 xdlg=(CppDialog*) p;
107 if (xdlg->_dialog)
108 xdlg->_dialog=NULL;
109 delete xdlg;
110}
111
112
113
114
115
117 :_dialog(NULL) {
118}
119
120
121
123 :_dialog(NULL) {
124 _dialog=dlg;
125
127 _dialog, this,
128 CppDialogLinker::freeData);
129
130 _setIntPropertyFn=GWEN_Dialog_SetSetIntPropertyFn(_dialog, CppDialogLinker::SetIntProperty);
131 _getIntPropertyFn=GWEN_Dialog_SetGetIntPropertyFn(_dialog, CppDialogLinker::GetIntProperty);
132 _setCharPropertyFn=GWEN_Dialog_SetSetCharPropertyFn(_dialog, CppDialogLinker::SetCharProperty);
133 _getCharPropertyFn=GWEN_Dialog_SetGetCharPropertyFn(_dialog, CppDialogLinker::GetCharProperty);
134}
135
136
137
139 if (_dialog) {
141 }
142}
143
144
145
147 CppDialog *xdlg;
148 GWEN_DIALOG *pdlg;
149
150 while( (pdlg=GWEN_Dialog_GetParentDialog(dlg)) )
151 dlg=pdlg;
152
153 assert(dlg);
155 assert(xdlg);
156
157 return xdlg;
158}
159
160
161
163 return _dialog;
164}
165
166
167
170 int index,
171 int value,
172 int doSignal) {
173 if (_setIntPropertyFn)
174 return _setIntPropertyFn(_dialog, w, prop, index, value, doSignal);
175 else
177}
178
179
180
183 int index,
184 int defaultValue) {
185 if (_getIntPropertyFn)
186 return _getIntPropertyFn(_dialog, w, prop, index, defaultValue);
187 else
188 return defaultValue;
189}
190
191
192
195 int index,
196 const char *value,
197 int doSignal) {
198 if (_setCharPropertyFn)
199 return _setCharPropertyFn(_dialog, w, prop, index, value, doSignal);
200 else
202}
203
204
205
208 int index,
209 const char *defaultValue) {
210 if (_getCharPropertyFn)
211 return _getCharPropertyFn(_dialog, w, prop, index, defaultValue);
212 else
213 return defaultValue;
214}
215
216
217
219 assert(_dialog);
220 return GWEN_Dialog_EmitSignal(_dialog, t, sender);
221}
222
223
224
225GWEN_WIDGET_TREE *CppDialog::getWidgets() const {
226 assert(_dialog);
228}
229
230
231
233 assert(_dialog);
235}
236
237
238
240 assert(_dialog);
241 return GWEN_Dialog_FindWidgetByImplData(_dialog, index, ptr);
242}
243
244
245
246
247
248
249
250
251
252
253
254
#define NULL
Definition: binreloc.c:300
A C++ binding for the C module GWEN_DIALOG.
Definition: cppdialog.hpp:32
virtual int setIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
Definition: cppdialog.cpp:168
int emitSignal(GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: cppdialog.cpp:218
GWEN_DIALOG * getCInterface()
Definition: cppdialog.cpp:162
GWEN_WIDGET_TREE * getWidgets() const
Definition: cppdialog.cpp:225
GWEN_WIDGET * findWidgetByName(const char *name)
Definition: cppdialog.cpp:232
virtual const char * getCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
Definition: cppdialog.cpp:206
virtual int setCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
Definition: cppdialog.cpp:193
GWEN_DIALOG * _dialog
Definition: cppdialog.hpp:50
static CPPGUI_API CppDialog * getDialog(GWEN_DIALOG *dlg)
Definition: cppdialog.cpp:146
virtual int getIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
Definition: cppdialog.cpp:181
GWEN_WIDGET * findWidgetByImplData(int index, void *ptr)
Definition: cppdialog.cpp:239
virtual ~CppDialog()
Definition: cppdialog.cpp:138
GWEN_WIDGET * GWEN_Dialog_FindWidgetByName(const GWEN_DIALOG *dlg, const char *name)
Definition: dialog.c:567
GWEN_WIDGET_TREE * GWEN_Dialog_GetWidgets(const GWEN_DIALOG *dlg)
Definition: dialog.c:629
GWEN_WIDGET * GWEN_Dialog_FindWidgetByImplData(const GWEN_DIALOG *dlg, int index, const void *ptr)
Definition: dialog.c:605
GWEN_DIALOG_GETINTPROPERTY_FN GWEN_Dialog_SetGetIntPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_GETINTPROPERTY_FN fn)
Definition: dialog.c:655
GWEN_DIALOG * GWEN_Dialog_GetParentDialog(const GWEN_DIALOG *dlg)
Definition: dialog.c:172
GWEN_DIALOG_SETINTPROPERTY_FN GWEN_Dialog_SetSetIntPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_SETINTPROPERTY_FN fn)
Definition: dialog.c:640
GWEN_DIALOG_GETCHARPROPERTY_FN GWEN_Dialog_SetGetCharPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_GETCHARPROPERTY_FN fn)
Definition: dialog.c:685
GWEN_DIALOG_SETCHARPROPERTY_FN GWEN_Dialog_SetSetCharPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_SETCHARPROPERTY_FN fn)
Definition: dialog.c:670
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: dialog.c:321
struct GWEN_DIALOG GWEN_DIALOG
Definition: dialog.h:54
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
GWEN_DIALOG_EVENTTYPE
Definition: dialog.h:98
#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
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34