diff options
Diffstat (limited to 'src/ui/ui.h')
-rw-r--r-- | src/ui/ui.h | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h index 2e4bc50..c340eb8 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -21,71 +21,73 @@ class UI : public Window public: /// constructor UI(); - + /// destructor ~UI(); - + /// list widgets void list() const; /// list visible widgets void list_visible() const; - + /// list meus void list_menus() const; - + /// load menus from menu.ini void load_menus(); - /// load settings from ui.ini + /// load settings from ui.ini void load_settings(); /// apply UI options to the render engine void apply_render_options(); - + /// make a window the active window void show_menu(const char *label); /// hide the active window void hide_menu(); - + /// show previous window void previous_menu(); /// the console - inline Console *console() { return ui_console; } - + inline Console *console() { + return ui_console; + } + /// return the active menu Window *active() { return ui_active_menu; } - + /// return the widget with global mouse focus inline Widget *mouse_focus() const { return ui_mouse_focus; } - + /// return the widget with global input focus inline Widget *input_focus() const { return ui_input_focus; } - + /// receive global mouse movement void input_mouse(const float x, const float y); - + /// receive global key input bool input_key(const bool pressed, const int key, const unsigned int modifier); /// run a user interface frame void frame(); - + /* -- fonts ------------------------------------------------ */ - + /// default small font inline const Font *font_small() const { return ui_font_small; } - + /// default medium font inline const Font *font_large() const { return ui_font_large; @@ -94,28 +96,28 @@ public: /* -- mouse pointer ---------------------------------------- */ /// set mouse pointer bitmap - void set_pointer(const char *pointerbitmap=0, const Palette::Color color = Palette::Highlight,const bool animated = false); + void set_pointer(const char *pointerbitmap = 0, const Palette::Color color = Palette::Highlight, const bool animated = false); static bool ui_debug; - + static float elementmargin; static math::Vector2f elementsize; protected: typedef std::list<Window *> Menus; - + Menus::iterator find_menu(Window *menu); Window *find_menu(const char *label); void add_menu(Window *window); /* -- event handlers --------------------------------------- */ - + /// handle keypress events virtual bool on_keypress(const int key, const unsigned int modifier); - + /// handle key release events virtual bool on_keyrelease(const int key, const unsigned int modifier); @@ -125,15 +127,15 @@ private: Palette *ui_palette; Font *ui_font_small; Font *ui_font_large; - + Window *ui_active_menu; Widget *ui_mouse_focus; Widget *ui_input_focus; - + Console *ui_console; Menus ui_menus; - + /// TODO move to separate object to handle mouse cursor drawing math::Vector2f mouse_cursor; std::string mouse_pointer_bitmap; @@ -151,10 +153,16 @@ void shutdown(); UI *root(); /// the console -inline Console *console() { return root()->console(); } +inline Console *console() +{ + return root()->console(); +} /// debug mode -inline bool debug() { return UI::ui_debug; } +inline bool debug() +{ + return UI::ui_debug; +} } |