gwenhywfar  4.6.0beta
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 
39 int 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 
56 int 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 
71 int 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 
87 const 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 
102 int 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 
114 void 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 
133 
135 :_widget(w)
136 {
138  _widget, this,
139  CppWidgetLinker::freeData);
140 
141  _setIntPropertyFn=GWEN_Widget_SetSetIntPropertyFn(_widget, CppWidgetLinker::SetIntProperty);
142  _getIntPropertyFn=GWEN_Widget_SetGetIntPropertyFn(_widget, CppWidgetLinker::GetIntProperty);
143  _setCharPropertyFn=GWEN_Widget_SetSetCharPropertyFn(_widget, CppWidgetLinker::SetCharProperty);
144  _getCharPropertyFn=GWEN_Widget_SetGetCharPropertyFn(_widget, CppWidgetLinker::GetCharProperty);
145  _addChildGuiWidgetFn=GWEN_Widget_SetAddChildGuiWidgetFn(_widget, CppWidgetLinker::AddChildGuiWidget);
146 }
147 
148 
149 
151  if (_widget) {
153  }
154 }
155 
156 
157 
159  return _widget;
160 }
161 
162 
163 
165  CppWidget *xw;
166 
167  assert(w);
169  assert(xw);
170 
171  return xw;
172 }
173 
174 
175 
177  GWEN_DIALOG *dlg;
178 
180  if (dlg)
181  return CppDialog::getDialog(dlg);
182  else
183  return NULL;
184 }
185 
186 
187 
189  int index,
190  int value,
191  int doSignal) {
192  if (_setIntPropertyFn)
193  return _setIntPropertyFn(_widget, prop, index, value, doSignal);
194  else
196 }
197 
198 
199 
201  int index,
202  int defaultValue) {
203  if (_getIntPropertyFn)
204  return _getIntPropertyFn(_widget, prop, index, defaultValue);
205  else
206  return defaultValue;
207 }
208 
209 
210 
212  int index,
213  const char *value,
214  int doSignal) {
215  if (_setCharPropertyFn)
216  return _setCharPropertyFn(_widget, prop, index, value, doSignal);
217  else
219 }
220 
221 
222 
224  int index,
225  const char *defaultValue) {
226  if (_getCharPropertyFn)
227  return _getCharPropertyFn(_widget, prop, index, defaultValue);
228  else
229  return defaultValue;
230 }
231 
232 
233 
235  if (_addChildGuiWidgetFn)
236  return _addChildGuiWidgetFn(_widget, wChild);
237  else
239 }
240 
241 
242 
243 const char *CppWidget::getName() {
245 }
246 
247 
248 
251 }
252 
253 
254 
257 }
258 
259 
260 
263 }
264 
265 
266 
269 }
270 
271 
272 
275 }
276 
277 
278 
281 }
282 
283 
284 
287 }
288 
289 
290 
291 const char *CppWidget::getText(int idx) {
292  return GWEN_Widget_GetText(_widget, idx);
293 }
294 
295 
296 
299 }
300 
301 
302 
305 }
306 
307 
308 
309 
310 
311 
312 
313