gwenhywfar 5.14.1
qt4/w_tabbook.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 QTabWidget();
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
56 QTabWidget *qw;
57 QWidget *qChild;
58 const char *s;
59 QString text;
60
62 assert(qw);
63
65 DBG_ERROR(GWEN_LOGDOMAIN, "You can only add TabPages to a TabBook");
66 return GWEN_ERROR_INVALID;
67 }
68
69 qChild=getQWidget(wChild);
70 assert(qChild);
71
72 s=GWEN_Widget_GetText(wChild, 0);
73 if (s)
74 text=QString::fromUtf8(s);
75
76 qw->addTab(qChild, text);
77
78 return 0;
79 }
80
81};
82
83
84
85
86
87
88
GWEN_WIDGET * _widget
Definition cppwidget.hpp:66
virtual int setup()
Qt4_W_TabBook(GWEN_WIDGET *w)
int addChildGuiWidget(GWEN_WIDGET *wChild)
static QWidget * getQWidget(GWEN_WIDGET *w)
Qt4_W_Widget(GWEN_WIDGET *w)
#define DBG_ERROR(dbg_logger, format,...)
Definition debug.h:97
#define GWEN_WIDGET_FLAGS_FILLY
Definition dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition dialog.h:61
#define GWEN_ERROR_INVALID
Definition error.h:67
#define GWEN_LOGDOMAIN
Definition logger.h:32
#define QT4_DIALOG_WIDGET_REAL
#define QT4_DIALOG_WIDGET_CONTENT
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:836
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
const char * GWEN_Widget_GetText(const GWEN_WIDGET *w, int idx)
Definition widget.c:293
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition widget.c:149
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition widget.c:185
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34
@ GWEN_Widget_TypeTabPage
Definition widget_be.h:68