00001 #ifndef AEDAPP_H
00002 #define AEDAPP_H
00003
00004 #include <iostream>
00005 #include <vector>
00006 #include <string>
00007
00008 #include "dllmacros.h"
00009 #include "aedFont.h"
00010 #include "aedWidget.h"
00011 #include "aedLog.h"
00012 #include "aedTheme.h"
00013
00014 struct DLLEXPORT aedFontEntry
00015 {
00016 std::string full_path;
00017 std::string name;
00018 Uint8 ptsize;
00019 class aedFont *font_ptr;
00020 };
00021
00022 struct DLLEXPORT aedMemFontEntry
00023 {
00024 std::string name;
00025 unsigned char *data;
00026 Uint32 data_size;
00027 Uint8 ptsize;
00028 class aedFont *font_ptr;
00029 };
00030
00031 struct DLLEXPORT aedThemeEntry
00032 {
00033 void *handle;
00034 aedTheme *theme;
00035 };
00036
00045 class DLLEXPORT aedApp
00046 {
00047 public:
00048
00050 aedApp();
00051 ~aedApp();
00052
00064 aedFont *requestFont(std::string name, Uint8 size, int style =
00065 AED_FONT_STYLE_NORMAL);
00066
00073 void addFontPath(std::string path);
00074
00081 void addMemoryFont(std::string name, unsigned char *data,
00082 unsigned long int size);
00083
00085 void dumpFontPaths();
00086
00091 void setDefaultFontName(std::string name)
00092 {
00093 m_DefaultFontName = name;
00094 }
00095
00097 std::string getDefaultFontName() const
00098 {
00099 return m_DefaultFontName;
00100 }
00101
00103 void setRoot(aedWidget * w)
00104 {
00105 m_Root = w;
00106 }
00107
00109 aedWidget *getRoot() const
00110 {
00111 return m_Root;
00112 }
00113
00114 aedLog *getLog() const;
00115
00122 aedTheme *loadTheme(std::string file);
00123
00128 void unloadTheme(aedTheme * theme);
00129
00131 aedTheme *getDefaultTheme() const;
00132
00134 aedWidget *getFocusWidget() const
00135 {
00136 return m_FocusWidget;
00137 }
00138
00140 void setFocusWidget(aedWidget * win);
00141
00143 void setOkayButton(aedButton * button)
00144 {
00145 m_okayButton = button;
00146 }
00147 void setCancelButton(aedButton * button)
00148 {
00149 m_cancelButton = button;
00150 }
00151 aedButton *getOkayButton()
00152 {
00153 return m_okayButton;
00154 }
00155 aedButton *getCancelButton()
00156 {
00157 return m_cancelButton;
00158 }
00159 void clickOkayButton();
00160 void clickCancelButton();
00161
00164 void setUTF8(bool enable)
00165 {
00166 m_UTF8 = enable;
00167 }
00168 bool getUTF8() const
00169 {
00170 return m_UTF8;
00171 }
00172
00173 private:
00174 std::string tryFontPath(std::string path, std::string name);
00175
00176 private:
00177 std::vector < aedFontEntry > m_Fonts;
00178 std::vector < aedMemFontEntry > m_MemFonts;
00179 std::vector < std::string > m_FontPaths;
00180 std::vector < aedThemeEntry > m_Themes;
00181 std::string m_DefaultFontName;
00182 aedWidget *m_Root;
00183 aedWidget *m_FocusWidget;
00184 aedButton *m_okayButton;
00185 aedButton *m_cancelButton;
00186
00187 bool m_UTF8;
00188 };
00189
00190 #ifdef AEDGUI
00191
00192 extern DLLEXPORT aedApp *pApp;
00193 #endif
00194
00195 #endif