gwenhywfar  4.7.0beta
fox16_gui_dialog_l.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Fri Jan 22 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 FOX16_GUI_DIALOG_L_HPP
11 #define FOX16_GUI_DIALOG_L_HPP
12 
13 #include "fox16_gui.hpp"
14 #include <gwen-gui-cpp/cppdialog.hpp>
15 
16 #include <fx.h>
17 
18 #include <gwenhywfar/dialog_be.h>
19 #include <gwenhywfar/widget_be.h>
20 
21 #include <list>
22 #include <string>
23 
24 
25 
26 class FOX16_GuiDialog: public FXObject, public CppDialog {
27  FXDECLARE(FOX16_GuiDialog)
28 
29 protected:
31  protected:
32  FXDataTarget m_radioTarget;
33  int m_groupId;
34  FXint m_radioValue;
36  std::list<FXRadioButton*> m_buttonList;
37 
38  public:
39  RadioButtonGroup(int groupId, FXObject* tgt=NULL, FXSelector sel=0)
40  :m_radioTarget(m_radioValue, tgt, sel), m_groupId(groupId), m_radioValue(0), m_buttonCount(0) {};
42  std::list<FXRadioButton*>::iterator it;
43 
44  for (it=m_buttonList.begin(); it!=m_buttonList.end(); it++)
45  /* reset target pointer in buttons because we are about to destroy the FXDataTarget */
46  (*it)->setTarget(NULL);
47  };
48 
49  int getGroupId() { return m_groupId;};
50 
51  FXDataTarget *getDataTarget() { return &m_radioTarget;};
52 
53  int getButtonCount() { return m_buttonList.size();};
54 
55  FXint getRadioValue() const { return m_radioValue;};
56 
57  void addButton(FXRadioButton *rb) {
58  m_buttonList.push_back(rb);
59  };
60  };
61 
62 
63 public:
64  enum {
68  };
69 
71  virtual ~FOX16_GuiDialog();
72 
74 
75  long onSelCommand(FXObject *sender, FXSelector sel, void *ptr);
76  long onSelChanged(FXObject *sender, FXSelector sel, void *ptr);
77  long onSelKeyPress(FXObject *sender, FXSelector sel, void *ptr);
78  long onSelKeyRelease(FXObject *sender, FXSelector sel, void *ptr);
79 
80  FXIcon *getIcon(const char *fileName);
81 
82  bool setup(FXWindow *parentWindow);
83 
84  int execute();
85  int cont();
86 
87  int openDialog();
88  int closeDialog();
89 
90 
91  FXDialogBox *getMainWindow() { return _mainWidget;};
92 
93 protected:
94  FOX16_Gui *_gui;
96  FXDialogBox *_mainWidget;
97  FXIconSource *m_iconSource;
98  std::list<FXIcon*> m_iconList;
99  std::list<RadioButtonGroup*> m_radioGroups;
100 
101  FOX16_GuiDialog();
102 
103  FXWindow *setupTree(FXWindow *parentWindow, GWEN_WIDGET *w);
104 
105  void guiUpdate();
106 
107  virtual int setIntProperty(GWEN_WIDGET *w,
109  int index,
110  int value,
111  int doSignal);
112 
113  virtual int getIntProperty(GWEN_WIDGET *w,
115  int index,
116  int defaultValue);
117 
118  virtual int setCharProperty(GWEN_WIDGET *w,
120  int index,
121  const char *value,
122  int doSignal);
123 
124  virtual const char *getCharProperty(GWEN_WIDGET *w,
126  int index,
127  const char *defaultValue);
128 
129 };
130 
131 
132 
133 
134 #endif /* FOX16_DIALOG_L_HPP */
135 
136