gwenhywfar  4.7.0beta
w_widget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Mon Feb 15 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 
11 #include <gwen-gui-cpp/cppwidget.hpp>
12 
13 
14 class Qt4_W_Widget: public CppWidget {
15 public:
17  }
18 
19 
20 
22  }
23 
24 
25 
26  virtual int setup() {
27  QWidget *qw;
28  uint32_t flags;
29  GWEN_WIDGET *wParent;
30  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
31  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
32 
34  wParent=GWEN_Widget_Tree_GetParent(_widget);
35 
36  qw=new QWidget();
37 
38  /* handle flags */
39  if (flags & GWEN_WIDGET_FLAGS_FILLX)
40  hpolicy=QSizePolicy::Expanding;
41  if (flags & GWEN_WIDGET_FLAGS_FILLY)
42  vpolicy=QSizePolicy::Expanding;
43  qw->setSizePolicy(hpolicy, vpolicy);
44 
47 
48  if (wParent)
50  return 0;
51  }
52 
53 
54 
55  static QWidget *getQWidget(GWEN_WIDGET *w) {
56  QWidget *qw;
57 
59  assert(qw);
60 
61  return qw;
62  }
63 
64 
66  int index,
67  int value,
68  int doSignal) {
69  QWidget *qw;
70 
72  assert(qw);
73 
74  switch(prop) {
76  qw->resize(value, qw->height());
77  return 0;
78 
80  qw->resize(qw->width(), value);
81  return 0;
82 
84  qw->setEnabled((value==0)?false:true);
85  return 0;
86 
88  qw->setFocus();
89  return 0;
90 
92  if (value==0)
93  qw->hide();
94  else
95  qw->show();
96  return 0;
97 
98  default:
99  break;
100  }
101 
103  "Function is not appropriate for this type of widget (%s)",
105  return GWEN_ERROR_INVALID;
106  };
107 
108 
109 
111  int index,
112  int defaultValue) {
113  QWidget *qw;
114 
116  assert(qw);
117 
118  switch(prop) {
120  return qw->width();
121 
123  return qw->height();
124 
126  return (qw->isEnabled())?1:0;
127 
129  return (qw->hasFocus())?1:0;
130 
131  default:
132  break;
133  }
134 
136  "Function is not appropriate for this type of widget (%s)",
138  return defaultValue;
139  };
140 
141 
142 
144  int index,
145  const char *value,
146  int doSignal) {
148  "Function is not appropriate for this type of widget (%s)",
150  return GWEN_ERROR_INVALID;
151  };
152 
153 
154 
156  int index,
157  const char *defaultValue) {
159  "Function is not appropriate for this type of widget (%s)",
161  return defaultValue;
162  };
163 
164 };
165 
166 
167 
168 
169 
170 
171