gwenhywfar  4.3.3
fox16_gui.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 
11 #ifndef FOX16_GUI_HPP
12 #define FOX16_GUI_HPP
13 
14 #include <gwen-gui-fox16/cppgui.hpp>
15 
16 #include <gwenhywfar/htmlfont_be.h>
17 
18 
19 #include <fx.h>
20 
21 #include <list>
22 
23 
24 /* TODO:
25  * - catch closing of dialog and send GWEN_DialogEvent_TypeClose.
26  *
27  */
28 
29 
30 class FOX16_GuiUpdater;
31 
32 
33 class FOX16GUI_API FOX16_Gui: public CppGui {
34 public:
35 
36  class FOX16GUI_API WinScope {
37  friend class FOX16_Gui;
38 
39  public:
40  typedef enum {
41  WIN_SCOPE_TYPE_WINDOW=0,
42  } WIN_SCOPE_TYPE;
43 
44  WinScope(uint32_t parentId, FXWindow *w);
45  WinScope(FXWindow *w);
46  ~WinScope();
47 
48  uint32_t getParentId() const { return m_parentId;};
49  uint32_t getId() const { return m_id;};
50  FXWindow *getWindow() const { return m_window;};
51 
52  protected:
53  WinScope(WIN_SCOPE_TYPE t, uint32_t parentId, FXWindow *w);
54  WIN_SCOPE_TYPE getType() const { return m_type;};
55 
56  uint32_t m_parentId;
57  uint32_t m_id;
58  FXWindow *m_window;
60 
61  };
62  typedef std::list<WinScope*> WinScopePtrList;
63 
64  enum {
66  };
67 
68  FOX16_Gui(FXApp* a);
69  ~FOX16_Gui();
70 
71  FXApp *getApp() { return m_app;};
72 
73  FOX16GUI_API static FXString getRawText(const char *text);
74  FOX16GUI_API static FXString getHtmlText(const char *text);
75 
76  FXWindow *getGuiWindow(uint32_t id);
77 
78  FOX16GUI_API static FOX16_Gui *getFgGui();
79 
80  virtual int openDialog(GWEN_DIALOG *dlg, uint32_t guiid);
81  virtual int closeDialog(GWEN_DIALOG *dlg);
82  virtual int runDialog(GWEN_DIALOG *dlg, int untilEnd);
83 
84  HTML_FONT *getFont(const char *fontName,
85  int fontSize,
86  uint32_t fontFlags);
87 
88 protected:
89  uint32_t getNextId();
90  uint32_t getIdOfLastScope();
91 
92  void addWinScope(WinScope *ws);
93  void delWinScope(WinScope *ws);
94 
95  void dumpScopeList();
96 
97  HTML_FONT *findFont(const char *fontName,
98  int fontSize,
99  uint32_t fontFlags);
100 
101 
102  int print(const char *docTitle,
103  const char *docType,
104  const char *descr,
105  const char *text,
106  uint32_t guiid);
107 
108  int execDialog(GWEN_DIALOG *dlg, uint32_t guiid);
109 
110  int getFileName(const char *caption,
112  uint32_t flags,
113  const char *patterns,
114  GWEN_BUFFER *pathBuffer,
115  uint32_t guiid);
116 
117 
118  WinScope *findWinScope(uint32_t id);
119 
120  WinScope *findWinScopeExt(uint32_t id);
121 
122  FXApp *m_app;
124  uint32_t m_lastId;
125 
127 
128  HTML_FONT_LIST *m_fontList;
129 };
130 
131 
132 
133 
134 
135 #endif
136 
137 
138 
139