gwenhywfar
4.3.3
|
00001 /*************************************************************************** 00002 begin : Mon Feb 15 2010 00003 copyright : (C) 2010 by Martin Preuss 00004 email : martin@libchipcard.de 00005 00006 *************************************************************************** 00007 * Please see toplevel file COPYING for license details * 00008 ***************************************************************************/ 00009 00010 00011 #include <gwen-gui-cpp/cppwidget.hpp> 00012 00013 00014 class Qt4_W_WidgetStack: public Qt4_W_Widget { 00015 public: 00016 Qt4_W_WidgetStack(GWEN_WIDGET *w):Qt4_W_Widget(w) { 00017 } 00018 00019 00020 00021 ~Qt4_W_WidgetStack() { 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 QStackedWidget(); 00037 00038 /* handle flags */ 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 00047 if (wParent) 00048 GWEN_Widget_AddChildGuiWidget(wParent, _widget); 00049 return 0; 00050 } 00051 00052 00053 00054 int setIntProperty(GWEN_DIALOG_PROPERTY prop, 00055 int index, 00056 int value, 00057 int doSignal) { 00058 QStackedWidget *qw; 00059 00060 qw=(QStackedWidget*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL); 00061 assert(qw); 00062 00063 switch(prop) { 00064 case GWEN_DialogProperty_Value: 00065 qw->setCurrentIndex(value); 00066 return 0; 00067 00068 default: 00069 return Qt4_W_Widget::setIntProperty(prop, index, value, doSignal); 00070 } 00071 }; 00072 00073 00074 00075 int getIntProperty(GWEN_DIALOG_PROPERTY prop, 00076 int index, 00077 int defaultValue) { 00078 QStackedWidget *qw; 00079 00080 qw=(QStackedWidget*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL); 00081 assert(qw); 00082 00083 switch(prop) { 00084 case GWEN_DialogProperty_Value: 00085 return qw->currentIndex(); 00086 00087 default: 00088 return Qt4_W_Widget::getIntProperty(prop, index, defaultValue); 00089 } 00090 }; 00091 00092 00093 int addChildGuiWidget(GWEN_WIDGET *wChild) { 00094 QStackedWidget *qw; 00095 QWidget *qChild; 00096 00097 qw=(QStackedWidget*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL); 00098 assert(qw); 00099 00100 qChild=getQWidget(wChild); 00101 assert(qChild); 00102 00103 qw->addWidget(qChild); 00104 00105 return 0; 00106 }; 00107 00108 00109 }; 00110 00111 00112 00113 00114 00115 00116