gwenhywfar
4.3.1
|
00001 /*************************************************************************** 00002 begin : Fri Jan 22 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 #ifndef FOX16_GUI_HPP 00012 #define FOX16_GUI_HPP 00013 00014 #include <gwen-gui-fox16/cppgui.hpp> 00015 00016 #include <gwenhywfar/htmlfont_be.h> 00017 00018 00019 #include <fx.h> 00020 00021 #include <list> 00022 00023 00024 /* TODO: 00025 * - catch closing of dialog and send GWEN_DialogEvent_TypeClose. 00026 * 00027 */ 00028 00029 00030 class FOX16_GuiUpdater; 00031 00032 00033 class FOX16GUI_API FOX16_Gui: public CppGui { 00034 public: 00035 00036 class FOX16GUI_API WinScope { 00037 friend class FOX16_Gui; 00038 00039 public: 00040 typedef enum { 00041 WIN_SCOPE_TYPE_WINDOW=0, 00042 } WIN_SCOPE_TYPE; 00043 00044 WinScope(uint32_t parentId, FXWindow *w); 00045 WinScope(FXWindow *w); 00046 ~WinScope(); 00047 00048 uint32_t getParentId() const { return m_parentId;}; 00049 uint32_t getId() const { return m_id;}; 00050 FXWindow *getWindow() const { return m_window;}; 00051 00052 protected: 00053 WinScope(WIN_SCOPE_TYPE t, uint32_t parentId, FXWindow *w); 00054 WIN_SCOPE_TYPE getType() const { return m_type;}; 00055 00056 uint32_t m_parentId; 00057 uint32_t m_id; 00058 FXWindow *m_window; 00059 WIN_SCOPE_TYPE m_type; 00060 00061 }; 00062 typedef std::list<WinScope*> WinScopePtrList; 00063 00064 enum { 00065 ID_MAINWINDOW=1 00066 }; 00067 00068 FOX16_Gui(FXApp* a); 00069 ~FOX16_Gui(); 00070 00071 FXApp *getApp() { return m_app;}; 00072 00073 FOX16GUI_API static FXString getRawText(const char *text); 00074 FOX16GUI_API static FXString getHtmlText(const char *text); 00075 00076 FXWindow *getGuiWindow(uint32_t id); 00077 00078 FOX16GUI_API static FOX16_Gui *getFgGui(); 00079 00080 virtual int openDialog(GWEN_DIALOG *dlg, uint32_t guiid); 00081 virtual int closeDialog(GWEN_DIALOG *dlg); 00082 virtual int runDialog(GWEN_DIALOG *dlg, int untilEnd); 00083 00084 HTML_FONT *getFont(const char *fontName, 00085 int fontSize, 00086 uint32_t fontFlags); 00087 00088 protected: 00089 uint32_t getNextId(); 00090 uint32_t getIdOfLastScope(); 00091 00092 void addWinScope(WinScope *ws); 00093 void delWinScope(WinScope *ws); 00094 00095 void dumpScopeList(); 00096 00097 HTML_FONT *findFont(const char *fontName, 00098 int fontSize, 00099 uint32_t fontFlags); 00100 00101 00102 int print(const char *docTitle, 00103 const char *docType, 00104 const char *descr, 00105 const char *text, 00106 uint32_t guiid); 00107 00108 int execDialog(GWEN_DIALOG *dlg, uint32_t guiid); 00109 00110 int getFileName(const char *caption, 00111 GWEN_GUI_FILENAME_TYPE fnt, 00112 uint32_t flags, 00113 const char *patterns, 00114 GWEN_BUFFER *pathBuffer, 00115 uint32_t guiid); 00116 00117 00118 WinScope *findWinScope(uint32_t id); 00119 00120 WinScope *findWinScopeExt(uint32_t id); 00121 00122 FXApp *m_app; 00123 WinScopePtrList m_scopeList; 00124 uint32_t m_lastId; 00125 00126 FOX16_GuiUpdater *m_updater; 00127 00128 HTML_FONT_LIST *m_fontList; 00129 }; 00130 00131 00132 00133 00134 00135 #endif 00136 00137 00138 00139