gui2::twindow Class Reference

base class of top level items, the only item which needs to store the final canvase to draw on More...

#include <window.hpp>

Inheritance diagram for gui2::twindow:

Inheritance graph
[legend]
Collaboration diagram for gui2::twindow:

Collaboration graph
[legend]

List of all members.

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)
twindowget_window ()
 Inherited from tevent_handler.
const twindowget_window () const
twidgetfind_widget (const tpoint &coordinate, const bool must_be_active)
 Inherited from tevent_handler.
const twidgetfind_widget (const tpoint &coordinate, const bool must_be_active) const
 Inherited from tevent_handler.
twidgetfind_widget (const std::string &id, const bool must_be_active)
 Inherited from tpanel.
const twidgetfind_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

CVideovideo_
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.


Detailed Description

base class of top level items, the only item which needs to store the final canvase to draw on

Definition at line 52 of file window.hpp.


Member Enumeration Documentation

Enumerator:
NEW 
SHOWING 
REQUEST_CLOSE 
CLOSED 

Definition at line 68 of file window.hpp.


Constructor & Destructor Documentation

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 
)


Member Function Documentation

int gui2::twindow::show ( const bool  restore = true,
void *  flip_function = 0 
)

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]

Implements gui2::tevent_handler.

Definition at line 77 of file window.hpp.

twidget* gui2::twindow::find_widget ( const tpoint coordinate,
const bool  must_be_active 
) [inline, virtual]

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().

tpoint gui2::twindow::client_position ( const tpoint screen_position  )  const [inline]

tpoint gui2::twindow::screen_position ( const tpoint client_position  )  const [inline]

void gui2::twindow::window_resize ( tevent_handler ,
const unsigned  new_width,
const unsigned  new_height 
) [virtual]

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]

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 (  ) 

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]

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]

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.


Member Data Documentation

Definition at line 136 of file window.hpp.

Referenced by draw(), flip(), and show().

Definition at line 138 of file window.hpp.

Referenced by close(), and show().

int gui2::twindow::retval_ [private]

Definition at line 141 of file window.hpp.

Referenced by set_retval(), and show().

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().

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().

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().

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().


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs