gwenhywfar 5.12.0
qt4/w_widgetstack.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
15public:
18
19
20
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 QStackedWidget();
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
46
47 if (wParent)
49 return 0;
50 }
51
52
53
55 int index,
56 int value,
57 int doSignal) {
58 QStackedWidget *qw;
59
61 assert(qw);
62
63 switch(prop) {
65 qw->setCurrentIndex(value);
66 return 0;
67
68 default:
69 return Qt4_W_Widget::setIntProperty(prop, index, value, doSignal);
70 }
71 };
72
73
74
76 int index,
77 int defaultValue) {
78 QStackedWidget *qw;
79
81 assert(qw);
82
83 switch(prop) {
85 return qw->currentIndex();
86
87 default:
88 return Qt4_W_Widget::getIntProperty(prop, index, defaultValue);
89 }
90 };
91
92
94 QStackedWidget *qw;
95 QWidget *qChild;
96
98 assert(qw);
99
100 qChild=getQWidget(wChild);
101 assert(qChild);
102
103 qw->addWidget(qChild);
104
105 return 0;
106 };
107
108
109};
110
111
112
113
114
115
116
GWEN_WIDGET * _widget
Definition cppwidget.hpp:66
int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
int addChildGuiWidget(GWEN_WIDGET *wChild)
int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
Qt4_W_WidgetStack(GWEN_WIDGET *w)
static QWidget * getQWidget(GWEN_WIDGET *w)
Qt4_W_Widget(GWEN_WIDGET *w)
int setIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
int getIntProperty(GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
#define GWEN_WIDGET_FLAGS_FILLY
Definition dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition dialog.h:61
GWEN_DIALOG_PROPERTY
Definition dialog.h:260
@ GWEN_DialogProperty_Value
Definition dialog.h:264
#define QT4_DIALOG_WIDGET_REAL
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:828
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
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition widget.c:149
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34