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