gwenhywfar  4.3.3
w_spinbox.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_SpinBox: public Qt4_W_Widget {
15 public:
17  }
18 
19 
20 
22  }
23 
24 
25 
26  virtual int setup() {
27  QSpinBox *qw;
28  uint32_t flags;
29  GWEN_WIDGET *wParent;
30  QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
31  QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
32  QT4_GuiDialog *qtDialog;
33 
35  wParent=GWEN_Widget_Tree_GetParent(_widget);
36 
37  qw=new QSpinBox();
38 
39  /* handle flags */
40  if (flags & GWEN_WIDGET_FLAGS_FILLX)
41  hpolicy=QSizePolicy::Expanding;
42  if (flags & GWEN_WIDGET_FLAGS_FILLY)
43  vpolicy=QSizePolicy::Expanding;
44  qw->setSizePolicy(hpolicy, vpolicy);
45 
47 
48  qtDialog=dynamic_cast<QT4_GuiDialog*>(getDialog());
49  assert(qtDialog);
50 
51  qw->connect(qw, SIGNAL(valueChanged(int)),
52  qtDialog->getMainWindow(),
53  SLOT(slotValueChanged()));
54 
55 
56  if (wParent)
58  return 0;
59  }
60 
61 
62 
64  int index,
65  int value,
66  int doSignal) {
67  QSpinBox *qw;
68 
70  assert(qw);
71 
72  switch(prop) {
74  qw->setValue(value);
75  return 0;
76 
78  qw->setMinimum(value);
79  return 0;
80 
82  qw->setMaximum(value);
83  return 0;
84 
85  default:
86  return Qt4_W_Widget::setIntProperty(prop, index, value, doSignal);
87  }
88  };
89 
90 
91 
93  int index,
94  int defaultValue) {
95  QSpinBox *qw;
96 
98  assert(qw);
99 
100  switch(prop) {
102  return qw->value();
103 
105  return qw->minimum();
106 
108  return qw->maximum();
109 
110  default:
111  return Qt4_W_Widget::getIntProperty(prop, index, defaultValue);
112  }
113  };
114 
115 
116 };
117 
118 
119 
120 
121 
122 
123