#include <window.hpp>
Public Types | |
enum | tstatus { NEW, SHOWING, REQUEST_CLOSE, CLOSED } |
Public Member Functions | |
twindow (CVideo &video, const int x, const int y, const int w, const int h, const bool automatic_placement, const unsigned horizontal_placement, const unsigned vertical_placement) | |
int | show (const bool restore=true, void *flip_function=0) |
void | layout (const SDL_Rect position) |
void | close () |
void | set_retval (const int retval, const bool close_window=true) |
twindow & | get_window () |
Inherited from tevent_handler. | |
const twindow & | get_window () const |
twidget * | find_widget (const tpoint &coordinate, const bool must_be_active) |
Inherited from tevent_handler. | |
const twidget * | find_widget (const tpoint &coordinate, const bool must_be_active) const |
Inherited from tevent_handler. | |
twidget * | find_widget (const std::string &id, const bool must_be_active) |
Inherited from tpanel. | |
const twidget * | find_widget (const std::string &id, const bool must_be_active) const |
Inherited from tpanel. | |
tpoint | client_position (const tpoint &screen_position) const |
tpoint | screen_position (const tpoint &client_position) const |
void | window_resize (tevent_handler &, const unsigned new_width, const unsigned new_height) |
void | set_active (const bool) |
A window is always active atm so ignore the request. | |
bool | get_active () const |
Gets the active state of the control. | |
unsigned | get_state () const |
Returns the id of the state, which is also the index for the canvas. | |
bool | full_redraw () const |
Does the widget need to restore the surface before (re)painting? | |
void | draw (surface &surface) |
Inherited from tpanel. | |
SDL_Rect | get_client_rect () const |
Gets the coordinates of the client area, for external use the height and the width are the most interesting things. | |
void | recalculate_size () |
Updates the size of the window. | |
Private Member Functions | |
void | flip () |
void | do_show_tooltip (const tpoint &location, const t_string &tooltip) |
Inherited from tevent_handler. | |
void | do_remove_tooltip () |
void | do_show_help_popup (const tpoint &location, const t_string &help_popup) |
void | do_remove_help_popup () |
const std::string & | get_control_type () const |
Inherited from tcontrol. | |
Private Attributes | |
CVideo & | video_ |
tstatus | status_ |
int | retval_ |
bool | need_layout_ |
When set the form needs a full layout redraw cycle. | |
ttooltip | tooltip_ |
Widget for the tooltip. | |
ttooltip | help_popup_ |
Widget for the help popup FIXME should be thelp_popup. | |
const bool | automatic_placement_ |
Do we wish to place the widget automatically? | |
const unsigned | horizontal_placement_ |
Sets the horizontal placement. | |
const unsigned | vertical_placement_ |
Sets the vertical placement. |
Definition at line 52 of file window.hpp.
gui2::twindow::twindow | ( | CVideo & | video, | |
const int | x, | |||
const int | y, | |||
const int | w, | |||
const int | h, | |||
const bool | automatic_placement, | |||
const unsigned | horizontal_placement, | |||
const unsigned | vertical_placement | |||
) |
Definition at line 53 of file window.cpp.
References gui2::create_rect(), help_popup_, gui2::tcontrol::load_config(), gui2::tcontrol::set_definition(), gui2::tcontainer_::set_size(), gui2::tcontrol::set_visible(), and tooltip_.
int gui2::twindow::show | ( | const bool | restore = true , |
|
void * | flip_function = 0 | |||
) |
Definition at line 82 of file window.cpp.
References gui2::tcontainer_::dirty(), events::handler::draw(), flip(), gui2::twidget::get_rect(), get_surface_portion(), CVideo::getSurface(), lg::gui_draw, log_scope2, make_neutral_surface(), need_layout_, NEW, gui2::tevent_handler::process_events(), rect, REQUEST_CLOSE, retval_, screen, SHOWING, status_, update_rect(), and video_.
Referenced by gui2::tmp_method_selection::show(), gui2::tlanguage_selection::show(), and gui2::taddon_connect::show().
void gui2::twindow::layout | ( | const SDL_Rect | position | ) |
Definition at line 125 of file window.cpp.
References DBG_G, need_layout_, and gui2::tcontainer_::set_client_size().
Referenced by draw().
void gui2::twindow::close | ( | ) | [inline] |
Definition at line 70 of file window.hpp.
References REQUEST_CLOSE, and status_.
Referenced by set_retval().
void gui2::twindow::set_retval | ( | const int | retval, | |
const bool | close_window = true | |||
) | [inline] |
Definition at line 72 of file window.hpp.
References close(), and retval_.
Referenced by gui2::tbutton::mouse_left_button_click().
twindow& gui2::twindow::get_window | ( | ) | [inline, virtual] |
Inherited from tevent_handler.
Implements gui2::tevent_handler.
Definition at line 76 of file window.hpp.
const twindow& gui2::twindow::get_window | ( | ) | const [inline, virtual] |
twidget* gui2::twindow::find_widget | ( | const tpoint & | coordinate, | |
const bool | must_be_active | |||
) | [inline, virtual] |
Inherited from tevent_handler.
Implements gui2::tevent_handler.
Definition at line 80 of file window.hpp.
References gui2::tpanel::find_widget().
Referenced by do_show_help_popup(), do_show_tooltip(), gui2::tmp_method_selection::show(), gui2::tlanguage_selection::show(), and gui2::taddon_connect::show().
const twidget* gui2::twindow::find_widget | ( | const tpoint & | coordinate, | |
const bool | must_be_active | |||
) | const [inline, virtual] |
Inherited from tevent_handler.
Implements gui2::tevent_handler.
Definition at line 84 of file window.hpp.
References gui2::tpanel::find_widget().
twidget* gui2::twindow::find_widget | ( | const std::string & | id, | |
const bool | must_be_active | |||
) | [inline, virtual] |
Inherited from tpanel.
Reimplemented from gui2::tpanel.
Definition at line 89 of file window.hpp.
References gui2::tpanel::find_widget().
const twidget* gui2::twindow::find_widget | ( | const std::string & | id, | |
const bool | must_be_active | |||
) | const [inline, virtual] |
Inherited from tpanel.
Reimplemented from gui2::tpanel.
Definition at line 93 of file window.hpp.
References gui2::tpanel::find_widget().
Definition at line 97 of file window.hpp.
References gui2::twidget::get_x(), gui2::twidget::get_y(), gui2::tpoint::x, and gui2::tpoint::y.
Referenced by gui2::tevent_handler::get_mouse().
Definition at line 100 of file window.hpp.
References gui2::twidget::get_x(), gui2::twidget::get_y(), gui2::tpoint::x, and gui2::tpoint::y.
void gui2::twindow::window_resize | ( | tevent_handler & | , | |
const unsigned | new_width, | |||
const unsigned | new_height | |||
) | [virtual] |
Reimplemented from gui2::tevent_executor.
Definition at line 187 of file window.cpp.
References need_layout_, gui2::settings::screen_height, and gui2::settings::screen_width.
Referenced by gui2::tevent_handler::handle_event().
void gui2::twindow::set_active | ( | const | bool | ) | [inline, virtual] |
A window is always active atm so ignore the request.
Reimplemented from gui2::tpanel.
Definition at line 108 of file window.hpp.
bool gui2::twindow::get_active | ( | ) | const [inline, virtual] |
Gets the active state of the control.
Reimplemented from gui2::tpanel.
Definition at line 109 of file window.hpp.
unsigned gui2::twindow::get_state | ( | ) | const [inline, virtual] |
Returns the id of the state, which is also the index for the canvas.
Reimplemented from gui2::tpanel.
Definition at line 110 of file window.hpp.
bool gui2::twindow::full_redraw | ( | ) | const [inline, virtual] |
Does the widget need to restore the surface before (re)painting?
Reimplemented from gui2::tcontrol.
Definition at line 111 of file window.hpp.
void gui2::twindow::draw | ( | surface & | surface | ) | [virtual] |
Inherited from tpanel.
Reimplemented from gui2::tpanel.
Definition at line 138 of file window.cpp.
References gui2::tcontainer_::begin(), blit_surface(), gui2::tcontrol::canvas(), DBG_G, gui2::twidget::dirty(), gui2::tcontrol::draw(), gui2::tcontainer_::end(), get_client_rect(), gui2::twidget::get_rect(), CVideo::getSurface(), lg::gui_draw, help_popup_, layout(), log_scope2, need_layout_, rect, gui2::twidget::set_dirty(), tooltip_, update_rect(), and video_.
SDL_Rect gui2::twindow::get_client_rect | ( | ) | const [virtual] |
Gets the coordinates of the client area, for external use the height and the width are the most interesting things.
Reimplemented from gui2::tpanel.
Definition at line 195 of file window.cpp.
References gui2::tpanel_definition::tresolution::bottom_border, gui2::tcontrol::config(), gui2::twidget::get_rect(), gui2::tpanel_definition::tresolution::left_border, gui2::tpanel_definition::tresolution::right_border, and gui2::tpanel_definition::tresolution::top_border.
Referenced by do_show_help_popup(), do_show_tooltip(), and draw().
void gui2::twindow::recalculate_size | ( | ) |
Updates the size of the window.
If the window has automatic placement set this function recacluates the window. To be used after creation and after modification or items which can have different sizes eg listboxes.
Definition at line 212 of file window.cpp.
References automatic_placement_, gui2::create_rect(), gui2::tcontainer_::get_best_size(), gui2::tgrid::HORIZONTAL_ALIGN_CENTER, gui2::tgrid::HORIZONTAL_ALIGN_LEFT, gui2::tgrid::HORIZONTAL_ALIGN_RIGHT, horizontal_placement_, gui2::settings::screen_height, gui2::settings::screen_width, gui2::tcontainer_::set_size(), size, gui2::tgrid::VERTICAL_ALIGN_BOTTOM, gui2::tgrid::VERTICAL_ALIGN_CENTER, gui2::tgrid::VERTICAL_ALIGN_TOP, vertical_placement_, gui2::tpoint::x, and gui2::tpoint::y.
Referenced by gui2::build(), gui2::tmp_method_selection::show(), and gui2::tlanguage_selection::show().
void gui2::twindow::flip | ( | ) | [private] |
Definition at line 175 of file window.cpp.
References cursor::draw(), CVideo::flip(), frameBuffer, get_video_surface(), cursor::undraw(), and video_.
Referenced by show().
void gui2::twindow::do_show_tooltip | ( | const tpoint & | location, | |
const t_string & | tooltip | |||
) | [private, virtual] |
Inherited from tevent_handler.
Implements gui2::tevent_handler.
Definition at line 252 of file window.cpp.
References DBG_G, find_widget(), gui2::tcontrol::get_best_size(), get_client_rect(), gui2::tcontrol::set_label(), gui2::tcontrol::set_size(), gui2::tcontrol::set_visible(), size, tooltip_, gui2::tpoint::x, and gui2::tpoint::y.
void gui2::twindow::do_remove_tooltip | ( | ) | [inline, private, virtual] |
Implements gui2::tevent_handler.
Definition at line 149 of file window.hpp.
References gui2::tcontrol::set_visible(), and tooltip_.
void gui2::twindow::do_show_help_popup | ( | const tpoint & | location, | |
const t_string & | help_popup | |||
) | [private, virtual] |
Implements gui2::tevent_handler.
Definition at line 290 of file window.cpp.
References DBG_G, find_widget(), gui2::tcontrol::get_best_size(), get_client_rect(), gui2::twidget::get_rect(), help_popup_, gui2::tcontrol::set_label(), gui2::tcontrol::set_size(), gui2::tcontrol::set_visible(), size, gui2::tpoint::x, and gui2::tpoint::y.
void gui2::twindow::do_remove_help_popup | ( | ) | [inline, private, virtual] |
Implements gui2::tevent_handler.
Definition at line 151 of file window.hpp.
References help_popup_, and gui2::tcontrol::set_visible().
const std::string& gui2::twindow::get_control_type | ( | ) | const [inline, private, virtual] |
Inherited from tcontrol.
Reimplemented from gui2::tpanel.
Definition at line 160 of file window.hpp.
References type.
CVideo& gui2::twindow::video_ [private] |
tstatus gui2::twindow::status_ [private] |
int gui2::twindow::retval_ [private] |
bool gui2::twindow::need_layout_ [private] |
When set the form needs a full layout redraw cycle.
Definition at line 144 of file window.hpp.
Referenced by draw(), layout(), show(), and window_resize().
ttooltip gui2::twindow::tooltip_ [private] |
Widget for the tooltip.
Reimplemented from gui2::tevent_handler.
Definition at line 154 of file window.hpp.
Referenced by do_remove_tooltip(), do_show_tooltip(), draw(), and twindow().
ttooltip gui2::twindow::help_popup_ [private] |
Widget for the help popup FIXME should be thelp_popup.
Reimplemented from gui2::tevent_handler.
Definition at line 157 of file window.hpp.
Referenced by do_remove_help_popup(), do_show_help_popup(), draw(), and twindow().
const bool gui2::twindow::automatic_placement_ [private] |
Do we wish to place the widget automatically?
Definition at line 165 of file window.hpp.
Referenced by recalculate_size().
const unsigned gui2::twindow::horizontal_placement_ [private] |
Sets the horizontal placement.
Only used if automatic_placement_ is true. The value should be a tgrid placement flag.
Definition at line 173 of file window.hpp.
Referenced by recalculate_size().
const unsigned gui2::twindow::vertical_placement_ [private] |
Sets the vertical placement.
Only used if automatic_placement_ is true. The value should be a tgrid placement flag.
Definition at line 181 of file window.hpp.
Referenced by recalculate_size().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |