gwenhywfar  4.3.3
cpp/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 
36 int 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 
54 int 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 
70 int 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 
87 const 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 
103 void 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 
122 
124 :_dialog(NULL)
125 {
126  _dialog=dlg;
127 
129  _dialog, this,
130  CppDialogLinker::freeData);
131 
132  _setIntPropertyFn=GWEN_Dialog_SetSetIntPropertyFn(_dialog, CppDialogLinker::SetIntProperty);
133  _getIntPropertyFn=GWEN_Dialog_SetGetIntPropertyFn(_dialog, CppDialogLinker::GetIntProperty);
134  _setCharPropertyFn=GWEN_Dialog_SetSetCharPropertyFn(_dialog, CppDialogLinker::SetCharProperty);
135  _getCharPropertyFn=GWEN_Dialog_SetGetCharPropertyFn(_dialog, CppDialogLinker::GetCharProperty);
136 }
137 
138 
139 
141  if (_dialog) {
143  }
144 }
145 
146 
147 
149  CppDialog *xdlg;
150  GWEN_DIALOG *pdlg;
151 
152  while( (pdlg=GWEN_Dialog_GetParentDialog(dlg)) )
153  dlg=pdlg;
154 
155  assert(dlg);
157  assert(xdlg);
158 
159  return xdlg;
160 }
161 
162 
163 
165  return _dialog;
166 }
167 
168 
169 
172  int index,
173  int value,
174  int doSignal) {
175  if (_setIntPropertyFn)
176  return _setIntPropertyFn(_dialog, w, prop, index, value, doSignal);
177  else
179 }
180 
181 
182 
185  int index,
186  int defaultValue) {
187  if (_getIntPropertyFn)
188  return _getIntPropertyFn(_dialog, w, prop, index, defaultValue);
189  else
190  return defaultValue;
191 }
192 
193 
194 
197  int index,
198  const char *value,
199  int doSignal) {
200  if (_setCharPropertyFn)
201  return _setCharPropertyFn(_dialog, w, prop, index, value, doSignal);
202  else
204 }
205 
206 
207 
210  int index,
211  const char *defaultValue) {
212  if (_getCharPropertyFn)
213  return _getCharPropertyFn(_dialog, w, prop, index, defaultValue);
214  else
215  return defaultValue;
216 }
217 
218 
219 
220 int CppDialog::emitSignal(GWEN_DIALOG_EVENTTYPE t, const char *sender) {
221  assert(_dialog);
222  return GWEN_Dialog_EmitSignal(_dialog, t, sender);
223 }
224 
225 
226 
227 GWEN_WIDGET_TREE *CppDialog::getWidgets() const {
228  assert(_dialog);
230 }
231 
232 
233 
235  assert(_dialog);
237 }
238 
239 
240 
242  assert(_dialog);
243  return GWEN_Dialog_FindWidgetByImplData(_dialog, index, ptr);
244 }
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256