1 /*************************************************************************** 2 begin : Tue Jul 13 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 #ifndef CPPWIDGET_HPP 11 #define CPPWIDGET_HPP 12 13 #include <gwenhywfar/dialog_be.h> 14 #include <list> 15 #include <string> 16 17 class CppWidget; 18 class CppDialog; 19 20 #include <gwen-gui-cpp/api.h> 21 22 23 /** 24 * @brief A C++ binding for the C module @ref GWEN_WIDGET 25 * 26 * This class simply is a C++ binding for the C module @ref GWEN_WIDGET. 27 * It redirects C callbacks used by GWEN_WIDGET to virtual functions in 28 * this class. 29 * 30 * @author Martin Preuss<martin@aquamaniac.de> 31 */ 32 class CPPGUI_API CppWidget { 33 friend class CppWidgetLinker; 34 35 private: 36 GWEN_WIDGET_SETINTPROPERTY_FN _setIntPropertyFn; 37 GWEN_WIDGET_GETINTPROPERTY_FN _getIntPropertyFn; 38 GWEN_WIDGET_SETCHARPROPERTY_FN _setCharPropertyFn; 39 GWEN_WIDGET_GETCHARPROPERTY_FN _getCharPropertyFn; 40 GWEN_WIDGET_ADDCHILDGUIWIDGET_FN _addChildGuiWidgetFn; 41 42 public: 43 CppWidget(GWEN_WIDGET *w); 44 virtual ~CppWidget(); 45 46 GWEN_WIDGET *getCInterface(); 47 static CPPGUI_API CppWidget *getWidget(GWEN_WIDGET *w); 48 49 CppDialog *getDialog(); 50 51 const char *getName(); 52 GWEN_WIDGET_TYPE getType(); 53 int getColumns(); 54 int getRows(); 55 uint32_t getFlags(); 56 57 int getGroupId(); 58 int getWidth(); 59 int getHeight(); 60 const char *getText(int idx); 61 const char *getIconFileName(); 62 const char *getImageFileName(); 63 64 65 protected: 66 GWEN_WIDGET *_widget; 67 68 CppWidget(); 69 70 virtual int setIntProperty(GWEN_DIALOG_PROPERTY prop, 71 int index, 72 int value, 73 int doSignal); 74 75 virtual int getIntProperty(GWEN_DIALOG_PROPERTY prop, 76 int index, 77 int defaultValue); 78 79 virtual int setCharProperty(GWEN_DIALOG_PROPERTY prop, 80 int index, 81 const char *value, 82 int doSignal); 83 84 virtual const char *getCharProperty(GWEN_DIALOG_PROPERTY prop, 85 int index, 86 const char *defaultValue); 87 88 virtual int addChildGuiWidget(GWEN_WIDGET *wChild); 89 90 }; 91 92 93 94 95 #endif /* CPPWIDGET_HPP */ 96 97 98