#include <main_window.hpp>
Definition at line 63 of file main_window.hpp.
Event callbacks | |
event_handler & | get_event_handler () |
The event handler pointer is provided to override the default event handler of a particular widget object without needing to go to the trouble of creating a whole new derived class. | |
typedef bool(* | event_handler )(widget *this_widget, const SDL_Event &) |
Public Types | |
enum | widget_flags { NO_FLAGS = 0, WIDGET_INVISIBLE = (1 << 0), WIDGET_INACTIVE = (1 << 1), WIDGET_CAN_FOCUS = (1 << 2) } |
Public Member Functions | |
void | add_child (widget *) |
virtual void | draw () |
virtual bool | handle_event (const SDL_Event &) |
main_window (const gsgl::string &title, const int x, const int y) | |
void | remove_child (widget *) |
void | set_status (const gsgl::string &message) |
virtual | ~main_window () |
Utilities | |
bool | button_down_here (int button) |
Determines whether or not the latest mouse-down was in this widget. | |
void | draw_box (int x, int y, int w, int h) |
Draws a box (in local coordinates). | |
void | draw_line (int x0, int y0, int x1, int y1) |
Draws a line (in local coordinates). | |
void | get_abs (int &x, int &y) |
Transforms the given local coordinates to absolute window coordinates. | |
void | get_local (int &x, int &y) |
Transforms the given absolute window coordinates into local widget coordinates. | |
Accessors | |
platform::color & | get_background () |
data::simple_stack< widget * > & | get_children () |
gsgl::flags_t & | get_flags () |
platform::color & | get_foreground () |
int & | get_h () |
widget *& | get_next_tab () |
widget * | get_parent () |
widget *& | get_prev_tab () |
platform::texture *& | get_texture () |
int & | get_w () |
int & | get_x () |
int & | get_y () |
void | set_flags (const gsgl::flags_t f, bool flag_on) |
Static Public Member Functions | |
static T * | global_instance () |
Static Public Attributes | |
static gsgl::data::config_variable < gsgl::platform::color > | BACKGROUND |
static gsgl::data::config_variable < gsgl::string > | FONT_FACE |
static gsgl::data::config_variable < int > | FONT_SIZE |
static gsgl::data::config_variable < gsgl::platform::color > | FOREGROUND |
static gsgl::data::config_variable < int > | HEIGHT |
static gsgl::data::config_variable < int > | QUIT_BUTTON_WIDTH |
static gsgl::data::config_variable < int > | STATUS_BAR_HEIGHT |
static gsgl::data::config_variable < int > | TAB_BOX_SPACE |
static gsgl::data::config_variable < int > | TITLE_BOX_HEIGHT |
static gsgl::data::config_variable < int > | WIDTH |
Private Attributes | |
load_scenery_thread * | loading_thread |
bool | need_to_load_scenery |
gsgl::framework::button * | quit_button |
settings_tab * | set_tab |
simulation_tab * | sim_tab |
gsgl::framework::textbox * | status_bar |
gsgl::framework::tabbox * | tab_box |
gsgl::framework::textbox * | title_box |
typedef bool(* event_handler)(widget *this_widget, const SDL_Event &) [inherited] |
enum widget_flags [inherited] |
NO_FLAGS | |
WIDGET_INVISIBLE | The widget is invisible but still active. |
WIDGET_INACTIVE | The widget is neither visible nor active. |
WIDGET_CAN_FOCUS | The widget is capable of handling keyboard events. |
Definition at line 66 of file widget.hpp.
main_window | ( | const gsgl::string & | title, | |
const int | x, | |||
const int | y | |||
) |
Definition at line 121 of file main_window.cpp.
References tabbox::add_tab(), main_window::BACKGROUND, main_window::FONT_FACE, main_window::FONT_SIZE, main_window::FOREGROUND, textbox::get_text(), main_window::HEIGHT, main_window::quit_button, main_window::QUIT_BUTTON_WIDTH, button::set_on_click_handler(), main_window::set_tab, main_window::sim_tab, main_window::status_bar, main_window::STATUS_BAR_HEIGHT, main_window::tab_box, main_window::TAB_BOX_SPACE, main_window::title_box, main_window::TITLE_BOX_HEIGHT, and main_window::WIDTH.
~main_window | ( | ) | [virtual] |
void add_child | ( | widget * | child | ) | [inherited] |
Definition at line 73 of file widget.cpp.
References widget::children, and widget::parent.
Referenced by tabbox::add_tab(), and widget::widget().
bool button_down_here | ( | int | button | ) | [inherited] |
Determines whether or not the latest mouse-down was in this widget.
Definition at line 156 of file widget.cpp.
References widget::get_h(), widget::get_local(), widget::get_w(), and singleton::global_instance().
Referenced by treebox_node::handle_event(), and button::handle_event().
void draw | ( | ) | [virtual] |
Reimplemented from widget.
Definition at line 171 of file main_window.cpp.
References thread::is_running(), load_scenery_thread::loading_failed, load_scenery_thread::loading_message, main_window::loading_thread, main_window::need_to_load_scenery, main_window::set_status(), thread::start(), and string::w_string().
void draw_box | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h | |||
) | [inherited] |
Draws a box (in local coordinates).
Definition at line 179 of file widget.cpp.
References display::draw_rectangle(), and widget::get_abs().
void draw_line | ( | int | x0, | |
int | y0, | |||
int | x1, | |||
int | y1 | |||
) | [inherited] |
Draws a line (in local coordinates).
Definition at line 167 of file widget.cpp.
References widget::get_abs().
void get_abs | ( | int & | x, | |
int & | y | |||
) | [inherited] |
Transforms the given local coordinates to absolute window coordinates.
Definition at line 124 of file widget.cpp.
References widget::parent, and widget::w.
Referenced by widget::draw_box(), and widget::draw_line().
platform::color& get_background | ( | ) | [inline, inherited] |
data::simple_stack<widget *>& get_children | ( | ) | [inline, inherited] |
Definition at line 88 of file widget.hpp.
Referenced by application::draw_ui(), treebox_plus::handle_event(), and application::handle_ui_event().
event_handler& get_event_handler | ( | ) | [inline, inherited] |
The event handler pointer is provided to override the default event handler of a particular widget object without needing to go to the trouble of creating a whole new derived class.
If the event handler is non-null, it will be called instead of handle_event(); if it returns false, then handle_event() will be called as well.
Definition at line 114 of file widget.hpp.
Referenced by application::handle_ui_event().
gsgl::flags_t& get_flags | ( | ) | [inline, inherited] |
Definition at line 81 of file widget.hpp.
Referenced by textbox::draw(), application::draw_ui(), and application::handle_ui_event().
platform::color& get_foreground | ( | ) | [inline, inherited] |
Definition at line 95 of file widget.hpp.
Referenced by tabbox::add_tab(), treebox_node::draw(), treebox_plus::draw(), tabbox::draw(), scrollbar::draw(), and button::draw().
int& get_h | ( | ) | [inline, inherited] |
Definition at line 93 of file widget.hpp.
Referenced by tabbox::add_tab(), widget::button_down_here(), treebox::draw(), treebox_node::draw(), treebox_plus::draw(), tabbox::draw(), simulation_tab::draw(), button::draw(), and application::handle_ui_event().
void get_local | ( | int & | x, | |
int & | y | |||
) | [inherited] |
Transforms the given absolute window coordinates into local widget coordinates.
Definition at line 140 of file widget.cpp.
References widget::w.
Referenced by widget::button_down_here(), and tabbox::handle_event().
widget* & get_next_tab | ( | ) | [inline, inherited] |
Definition at line 84 of file widget.hpp.
widget* get_parent | ( | ) | [inline, inherited] |
Definition at line 87 of file widget.hpp.
widget* & get_prev_tab | ( | ) | [inline, inherited] |
Definition at line 85 of file widget.hpp.
platform::texture* & get_texture | ( | ) | [inline, inherited] |
Definition at line 97 of file widget.hpp.
int& get_w | ( | ) | [inline, inherited] |
Definition at line 92 of file widget.hpp.
Referenced by tabbox::add_tab(), widget::button_down_here(), treebox::draw(), treebox_node::draw(), treebox_plus::draw(), textbox::draw(), tabbox::draw(), simulation_tab::draw(), button::draw(), and application::handle_ui_event().
int& get_x | ( | ) | [inline, inherited] |
Definition at line 90 of file widget.hpp.
Referenced by tabbox::add_tab(), treebox::draw(), treebox_node::draw(), treebox_plus::draw(), tabbox::draw(), application::draw_ui(), and application::handle_ui_event().
int& get_y | ( | ) | [inline, inherited] |
Definition at line 91 of file widget.hpp.
Referenced by tabbox::add_tab(), treebox::draw(), treebox_node::draw(), treebox_plus::draw(), tabbox::draw(), application::draw_ui(), and application::handle_ui_event().
static T* global_instance | ( | ) | [inline, static, inherited] |
Reimplemented in broker, global_register, logger, global_register< gsgl::data::broker_creator, gsgl::data::dictionary< gsgl::data::broker_creator *, gsgl::string > >, global_register< gsgl::data::log_target, gsgl::data::list< gsgl::data::log_target * > >, and global_register< gsgl::data::log_target >.
Definition at line 70 of file singleton.hpp.
Referenced by widget::button_down_here(), font::font(), tabbox::handle_event(), material::material(), model_part::model_part(), and texture::texture().
bool handle_event | ( | const SDL_Event & | e | ) | [virtual, inherited] |
Reimplemented in button, tabbox, treebox_plus, and treebox_node.
Definition at line 117 of file widget.cpp.
Referenced by application::handle_ui_event().
void remove_child | ( | widget * | child | ) | [inherited] |
Definition at line 80 of file widget.cpp.
References widget::children, and widget::parent.
Referenced by treebox::clear_tree_nodes(), and treebox_node::clear_tree_nodes().
void set_flags | ( | const gsgl::flags_t | f, | |
bool | flag_on | |||
) | [inherited] |
Definition at line 64 of file widget.cpp.
References widget::flags.
Referenced by treebox::draw(), tabbox::draw(), simulation_tab::draw(), treebox::mark_expanded_nodes(), and treebox::treebox().
void set_status | ( | const gsgl::string & | message | ) |
Definition at line 163 of file main_window.cpp.
References textbox::get_text(), and main_window::status_bar.
Referenced by main_window::draw().
config_variable< color > BACKGROUND [static] |
Definition at line 90 of file main_window.hpp.
Referenced by simulation_tab::draw(), sim_view_box::load_scenery_info(), and main_window::main_window().
config_variable< string > FONT_FACE [static] |
Definition at line 91 of file main_window.hpp.
Referenced by simulation_tab::draw(), main_window::main_window(), and sim_view_box::sim_view_box().
config_variable< int > FONT_SIZE [static] |
Definition at line 92 of file main_window.hpp.
Referenced by simulation_tab::draw(), main_window::main_window(), and sim_view_box::sim_view_box().
config_variable< color > FOREGROUND [static] |
Definition at line 89 of file main_window.hpp.
Referenced by simulation_tab::draw(), sim_view_box::load_scenery_info(), and main_window::main_window().
config_variable< int > HEIGHT [static] |
Definition at line 88 of file main_window.hpp.
Referenced by periapsis_app::init(), and main_window::main_window().
load_scenery_thread* loading_thread [private] |
Definition at line 73 of file main_window.hpp.
Referenced by main_window::draw(), and main_window::~main_window().
bool need_to_load_scenery [private] |
gsgl::framework::button* quit_button [private] |
config_variable< int > QUIT_BUTTON_WIDTH [static] |
settings_tab* set_tab [private] |
simulation_tab* sim_tab [private] |
gsgl::framework::textbox * status_bar [private] |
Definition at line 66 of file main_window.hpp.
Referenced by main_window::main_window(), and main_window::set_status().
config_variable< int > STATUS_BAR_HEIGHT [static] |
gsgl::framework::tabbox* tab_box [private] |
config_variable< int > TAB_BOX_SPACE [static] |
gsgl::framework::textbox* title_box [private] |
config_variable< int > TITLE_BOX_HEIGHT [static] |
config_variable< int > WIDTH [static] |
Definition at line 87 of file main_window.hpp.
Referenced by periapsis_app::init(), and main_window::main_window().