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_TabBook: public Qt4_W_Widget {
00015 public:
00016 Qt4_W_TabBook(GWEN_WIDGET *w):Qt4_W_Widget(w) {
00017 }
00018
00019
00020
00021 ~Qt4_W_TabBook() {
00022 }
00023
00024
00025
00026 virtual int setup() {
00027 QWidget *qw;
00028 uint32_t flags;
00029 GWEN_WIDGET *wParent;
00030 QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
00031 QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
00032
00033 flags=GWEN_Widget_GetFlags(_widget);
00034 wParent=GWEN_Widget_Tree_GetParent(_widget);
00035
00036 qw=new QTabWidget();
00037
00038
00039 if (flags & GWEN_WIDGET_FLAGS_FILLX)
00040 hpolicy=QSizePolicy::Expanding;
00041 if (flags & GWEN_WIDGET_FLAGS_FILLY)
00042 vpolicy=QSizePolicy::Expanding;
00043 qw->setSizePolicy(hpolicy, vpolicy);
00044
00045 GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw);
00046 GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_CONTENT, (void*) qw);
00047
00048 if (wParent)
00049 GWEN_Widget_AddChildGuiWidget(wParent, _widget);
00050 return 0;
00051 }
00052
00053
00054
00055 int addChildGuiWidget(GWEN_WIDGET *wChild) {
00056 QTabWidget *qw;
00057 QWidget *qChild;
00058 const char *s;
00059 QString text;
00060
00061 qw=(QTabWidget*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
00062 assert(qw);
00063
00064 if (GWEN_Widget_GetType(wChild)!=GWEN_Widget_TypeTabPage) {
00065 DBG_ERROR(GWEN_LOGDOMAIN, "You can only add TabPages to a TabBook");
00066 return GWEN_ERROR_INVALID;
00067 }
00068
00069 qChild=getQWidget(wChild);
00070 assert(qChild);
00071
00072 s=GWEN_Widget_GetText(wChild, 0);
00073 if (s)
00074 text=QString::fromUtf8(s);
00075
00076 qw->addTab(qChild, text);
00077
00078 return 0;
00079 }
00080
00081 };
00082
00083
00084
00085
00086
00087
00088