Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <gwen-gui-cpp/cppwidget.hpp>
00012
00013
00014 class Qt4_W_SpinBox: public Qt4_W_Widget {
00015 public:
00016 Qt4_W_SpinBox(GWEN_WIDGET *w):Qt4_W_Widget(w) {
00017 }
00018
00019
00020
00021 ~Qt4_W_SpinBox() {
00022 }
00023
00024
00025
00026 virtual int setup() {
00027 QSpinBox *qw;
00028 uint32_t flags;
00029 GWEN_WIDGET *wParent;
00030 QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
00031 QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
00032 QT4_GuiDialog *qtDialog;
00033
00034 flags=GWEN_Widget_GetFlags(_widget);
00035 wParent=GWEN_Widget_Tree_GetParent(_widget);
00036
00037 qw=new QSpinBox();
00038
00039
00040 if (flags & GWEN_WIDGET_FLAGS_FILLX)
00041 hpolicy=QSizePolicy::Expanding;
00042 if (flags & GWEN_WIDGET_FLAGS_FILLY)
00043 vpolicy=QSizePolicy::Expanding;
00044 qw->setSizePolicy(hpolicy, vpolicy);
00045
00046 GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw);
00047
00048 qtDialog=dynamic_cast<QT4_GuiDialog*>(getDialog());
00049 assert(qtDialog);
00050
00051 qw->connect(qw, SIGNAL(valueChanged(int)),
00052 qtDialog->getMainWindow(),
00053 SLOT(slotValueChanged()));
00054
00055
00056 if (wParent)
00057 GWEN_Widget_AddChildGuiWidget(wParent, _widget);
00058 return 0;
00059 }
00060
00061
00062
00063 int setIntProperty(GWEN_DIALOG_PROPERTY prop,
00064 int index,
00065 int value,
00066 int doSignal) {
00067 QSpinBox *qw;
00068
00069 qw=(QSpinBox*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
00070 assert(qw);
00071
00072 switch(prop) {
00073 case GWEN_DialogProperty_Value:
00074 qw->setValue(value);
00075 return 0;
00076
00077 case GWEN_DialogProperty_MinValue:
00078 qw->setMinimum(value);
00079 return 0;
00080
00081 case GWEN_DialogProperty_MaxValue:
00082 qw->setMaximum(value);
00083 return 0;
00084
00085 default:
00086 return Qt4_W_Widget::setIntProperty(prop, index, value, doSignal);
00087 }
00088 };
00089
00090
00091
00092 int getIntProperty(GWEN_DIALOG_PROPERTY prop,
00093 int index,
00094 int defaultValue) {
00095 QSpinBox *qw;
00096
00097 qw=(QSpinBox*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
00098 assert(qw);
00099
00100 switch(prop) {
00101 case GWEN_DialogProperty_Value:
00102 return qw->value();
00103
00104 case GWEN_DialogProperty_MinValue:
00105 return qw->minimum();
00106
00107 case GWEN_DialogProperty_MaxValue:
00108 return qw->maximum();
00109
00110 default:
00111 return Qt4_W_Widget::getIntProperty(prop, index, defaultValue);
00112 }
00113 };
00114
00115
00116 };
00117
00118
00119
00120
00121
00122
00123