gwenhywfar  5.10.1
qt4/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 
virtual int setup()
GWEN_DIALOG_PROPERTY
Definition: dialog.h:260
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition: widget.c:149
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition: widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition: widget.c:122
int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition: widget.c:828
#define GWEN_WIDGET_FLAGS_FILLY
Definition: dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition: dialog.h:61
int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
#define QT4_DIALOG_WIDGET_REAL
Qt4_W_SpinBox(GWEN_WIDGET *w)
int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
CppDialog * getDialog()
Definition: cppwidget.cpp:174
GWEN_WIDGET * _widget
Definition: cppwidget.hpp:66
QT4_DialogBox * getMainWindow()