gwenhywfar
4.3.1
|
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_ProgressBar: public Qt4_W_Widget { 00015 public: 00016 Qt4_W_ProgressBar(GWEN_WIDGET *w):Qt4_W_Widget(w) { 00017 } 00018 00019 00020 00021 ~Qt4_W_ProgressBar() { 00022 } 00023 00024 00025 00026 virtual int setup() { 00027 QProgressBar *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 QProgressBar(); 00037 qw->setTextVisible(true); 00038 00039 /* handle flags */ 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 if (wParent) 00049 GWEN_Widget_AddChildGuiWidget(wParent, _widget); 00050 return 0; 00051 } 00052 00053 00054 00055 int setIntProperty(GWEN_DIALOG_PROPERTY prop, 00056 int index, 00057 int value, 00058 int doSignal) { 00059 QProgressBar *qw; 00060 00061 qw=(QProgressBar*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL); 00062 assert(qw); 00063 00064 switch(prop) { 00065 case GWEN_DialogProperty_Value: 00066 qw->setValue(value); 00067 return 0; 00068 00069 case GWEN_DialogProperty_MinValue: 00070 qw->setMinimum(value); 00071 return 0; 00072 00073 case GWEN_DialogProperty_MaxValue: 00074 qw->setMaximum(value); 00075 return 0; 00076 00077 default: 00078 return Qt4_W_Widget::setIntProperty(prop, index, value, doSignal); 00079 } 00080 }; 00081 00082 00083 00084 int getIntProperty(GWEN_DIALOG_PROPERTY prop, 00085 int index, 00086 int defaultValue) { 00087 QProgressBar *qw; 00088 00089 qw=(QProgressBar*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL); 00090 assert(qw); 00091 00092 switch(prop) { 00093 case GWEN_DialogProperty_Value: 00094 return qw->value(); 00095 00096 case GWEN_DialogProperty_MinValue: 00097 return qw->minimum(); 00098 00099 case GWEN_DialogProperty_MaxValue: 00100 return qw->maximum(); 00101 00102 default: 00103 return Qt4_W_Widget::getIntProperty(prop, index, defaultValue); 00104 } 00105 }; 00106 00107 }; 00108 00109 00110 00111 00112 00113 00114