gui::dialog Class Reference

#include <construct_dialog.hpp>

Inheritance diagram for gui::dialog:

Inheritance graph
[legend]
Collaboration diagram for gui::dialog:

Collaboration graph
[legend]

List of all members.

Public Types

enum  BUTTON_LOCATION {
  BUTTON_STANDARD, BUTTON_EXTRA, BUTTON_EXTRA_LEFT, BUTTON_CHECKBOX,
  BUTTON_CHECKBOX_LEFT, BUTTON_HELP
}
typedef dialog_frame::style style

Public Member Functions

 dialog (display &disp, const std::string &title="", const std::string &message="", const DIALOG_TYPE type=MESSAGE, const style &dialog_style=default_style)
virtual ~dialog ()
void set_image (dialog_image *const img)
void set_image (surface surf, const std::string &caption="")
void set_menu (menu *const m)
void set_menu (const std::vector< std::string > &menu_items, menu::sorter *sorter=NULL)
void set_menu_items (const std::vector< std::string > &menu_items)
void add_pane (preview_pane *const pp)
void set_panes (std::vector< preview_pane * > panes)
void set_textbox (dialog_textbox *const box)
void set_textbox (const std::string &text_widget_label="", const std::string &text_widget_text="", const int text_widget_max_chars=256, const unsigned int text_box_width=font::relative_size(350))
void add_button (dialog_button *const btn, BUTTON_LOCATION loc)
void add_button (dialog_button_info btn_info, BUTTON_LOCATION loc=BUTTON_EXTRA)
void add_option (const std::string &label, bool checked=false, BUTTON_LOCATION loc=BUTTON_CHECKBOX)
virtual dimension_measurements layout (int xloc=-1, int yloc=-1)
void set_layout (dimension_measurements &new_dim)
dimension_measurements get_layout () const
dialog_frameget_frame ()
void set_basic_behavior (DIALOG_TYPE type)
int show (int xloc, int yloc)
int show ()
int result () const
menuget_menu ()
bool done () const
const std::string textbox_text () const
dialog_textboxget_textbox () const
bool option_checked (unsigned int option_index=0)
displayget_display ()

Static Public Attributes

static const styledefault_style = dialog_frame::default_style
static const stylemessage_style = dialog_frame::message_style
static const style hotkeys_style
static const int message_font_size = font::SIZE_PLUS
static const int caption_font_size = font::SIZE_LARGE
static const int max_menu_width = -1
static const size_t left_padding = font::relative_size(10)
static const size_t right_padding = font::relative_size(10)
static const size_t image_h_pad = font::relative_size(/*image_ == NULL ? 0 :*/ 10)
static const size_t top_padding = font::relative_size(10)
static const size_t bottom_padding = font::relative_size(10)

Protected Member Functions

void set_result (const int result)
virtual void action (dialog_process_info &dp_info)
void refresh ()
labelget_message () const

Private Types

typedef std::vector
< preview_pane * >::iterator 
pp_iterator
typedef std::vector
< preview_pane * >
::const_iterator 
pp_const_iterator
typedef std::vector
< dialog_button * >::iterator 
button_iterator
typedef std::vector
< dialog_button * >
::const_iterator 
button_const_iterator
typedef std::vector< std::pair
< dialog_button
*, BUTTON_LOCATION >
>::iterator 
button_pool_iterator
typedef std::vector< std::pair
< dialog_button
*, BUTTON_LOCATION >
>::const_iterator 
button_pool_const_iterator

Private Member Functions

void clear_background ()
void draw_frame ()
void update_widget_positions ()
void draw_contents ()
int process (dialog_process_info &info)

Private Attributes

displaydisp_
dialog_imageimage_
std::string title_
const stylestyle_
labeltitle_widget_
labelmessage_
DIALOG_TYPE type_
gui::menumenu_
std::vector< preview_pane * > preview_panes_
std::vector< std::pair
< dialog_button
*, BUTTON_LOCATION > > 
button_pool_
std::vector< dialog_button * > standard_buttons_
std::vector< dialog_button * > extra_buttons_
std::vector< button * > frame_buttons_
std::string topic_
dialog_buttonhelp_button_
dialog_textboxtext_widget_
dialog_frameframe_
dimension_measurements dim_
int result_

Classes

struct  dimension_measurements


Detailed Description

Definition at line 153 of file construct_dialog.hpp.


Member Typedef Documentation

Definition at line 168 of file construct_dialog.hpp.

typedef std::vector<preview_pane *>::iterator gui::dialog::pp_iterator [private]

Definition at line 171 of file construct_dialog.hpp.

typedef std::vector<preview_pane *>::const_iterator gui::dialog::pp_const_iterator [private]

Definition at line 172 of file construct_dialog.hpp.

typedef std::vector<dialog_button *>::iterator gui::dialog::button_iterator [private]

Definition at line 173 of file construct_dialog.hpp.

typedef std::vector<dialog_button *>::const_iterator gui::dialog::button_const_iterator [private]

Definition at line 174 of file construct_dialog.hpp.

typedef std::vector< std::pair<dialog_button *, BUTTON_LOCATION> >::iterator gui::dialog::button_pool_iterator [private]

Definition at line 175 of file construct_dialog.hpp.

typedef std::vector< std::pair<dialog_button *, BUTTON_LOCATION> >::const_iterator gui::dialog::button_pool_const_iterator [private]

Definition at line 176 of file construct_dialog.hpp.


Member Enumeration Documentation

Enumerator:
BUTTON_STANDARD 
BUTTON_EXTRA 
BUTTON_EXTRA_LEFT 
BUTTON_CHECKBOX 
BUTTON_CHECKBOX_LEFT 
BUTTON_HELP 

Definition at line 155 of file construct_dialog.hpp.


Constructor & Destructor Documentation

gui::dialog::dialog ( display disp,
const std::string &  title = "",
const std::string &  message = "",
const DIALOG_TYPE  type = MESSAGE,
const style dialog_style = default_style 
)

gui::dialog::~dialog (  )  [virtual]


Member Function Documentation

void gui::dialog::set_image ( dialog_image *const   img  )  [inline]

Definition at line 206 of file construct_dialog.hpp.

References image_.

Referenced by set_image(), and gui::show_dialog().

void gui::dialog::set_image ( surface  surf,
const std::string &  caption = "" 
)

void gui::dialog::set_menu ( menu *const   m  )  [inline]

void gui::dialog::set_menu ( const std::vector< std::string > &  menu_items,
menu::sorter sorter = NULL 
)

void gui::dialog::set_menu_items ( const std::vector< std::string > &  menu_items  ) 

void gui::dialog::add_pane ( preview_pane *const   pp  )  [inline]

void gui::dialog::set_panes ( std::vector< preview_pane * >  panes  )  [inline]

Definition at line 215 of file construct_dialog.hpp.

References preview_panes_.

Referenced by dialogs::advance_unit(), and events::menu_handler::recruit().

void gui::dialog::set_textbox ( dialog_textbox *const   box  )  [inline]

void gui::dialog::set_textbox ( const std::string &  text_widget_label = "",
const std::string &  text_widget_text = "",
const int  text_widget_max_chars = 256,
const unsigned int  text_box_width = font::relative_size(350) 
)

void gui::dialog::add_button ( dialog_button *const   btn,
BUTTON_LOCATION  loc 
)

void gui::dialog::add_button ( dialog_button_info  btn_info,
BUTTON_LOCATION  loc = BUTTON_EXTRA 
)

void gui::dialog::add_option ( const std::string &  label,
bool  checked = false,
BUTTON_LOCATION  loc = BUTTON_CHECKBOX 
)

dialog::dimension_measurements gui::dialog::layout ( int  xloc = -1,
int  yloc = -1 
) [virtual]

Reimplemented in dialogs::file_dialog.

Definition at line 432 of file construct_dialog.cpp.

References b, gui::dialog_frame::bottom_padding(), bottom_padding, BUTTON_CHECKBOX, BUTTON_CHECKBOX_LEFT, BUTTON_EXTRA, BUTTON_EXTRA_LEFT, button_pool_, BUTTON_STANDARD, gui::ButtonHPadding, gui::dialog::dimension_measurements::buttons, gui::dialog_image::caption(), gui::dialog::dimension_measurements::caption_x, gui::dialog::dimension_measurements::caption_y, DBG_DP, disp_, extra_buttons_, get_frame(), gui::dialog_textbox::get_label(), get_menu(), gui::label::get_text(), CVideo::getSurface(), CVideo::getx(), CVideo::gety(), gui::widget::height(), image_, image_h_pad, image_width(), gui::dialog::dimension_measurements::image_x, gui::dialog::dimension_measurements::image_y, gui::dialog::dimension_measurements::interior, gui::dialog::dimension_measurements::label_x, gui::dialog::dimension_measurements::label_y, left_padding, gui::preview_pane::left_side(), gui::widget::location(), max_height, menu_, gui::dialog::dimension_measurements::menu_height, gui::dialog::dimension_measurements::menu_width, gui::dialog::dimension_measurements::menu_x, gui::dialog::dimension_measurements::menu_y, gui::dialog::dimension_measurements::message, message_, message_font_size, gui::dialog::dimension_measurements::panes, preview_panes_, rect, font::relative_size(), right_padding, screen, set_layout(), gui::preview_pane::show_above(), gui::textbox::text(), font::text_area(), text_widget_, text_width, gui::dialog::dimension_measurements::textbox, gui::dialog_frame::top_padding(), top_padding, display::video(), gui::widget::width(), gui::dialog::dimension_measurements::x, and gui::dialog::dimension_measurements::y.

Referenced by show().

void gui::dialog::set_layout ( dimension_measurements new_dim  ) 

dimension_measurements gui::dialog::get_layout (  )  const [inline]

Definition at line 232 of file construct_dialog.hpp.

References dim_.

Referenced by process().

dialog_frame & gui::dialog::get_frame (  ) 

void gui::dialog::set_basic_behavior ( DIALOG_TYPE  type  )  [inline]

Definition at line 234 of file construct_dialog.hpp.

References type_.

Referenced by dialogs::load_game_dialog(), and events::menu_handler::unit_list().

int gui::dialog::show ( int  xloc,
int  yloc 
)

int gui::dialog::show (  ) 

int gui::dialog::result (  )  const [inline]

menu & gui::dialog::get_menu (  ) 

bool gui::dialog::done (  )  const [inline]

Definition at line 244 of file construct_dialog.hpp.

References gui::CONTINUE_DIALOG, and result_.

Referenced by gui::message_dialog::action(), and show().

const std::string gui::dialog::textbox_text (  )  const [inline]

dialog_textbox& gui::dialog::get_textbox (  )  const [inline]

Definition at line 246 of file construct_dialog.hpp.

References text_widget_.

Referenced by dialogs::file_dialog::action(), and dialogs::file_dialog::layout().

bool gui::dialog::option_checked ( unsigned int  option_index = 0  ) 

display& gui::dialog::get_display (  )  [inline]

Definition at line 248 of file construct_dialog.hpp.

References disp_.

Referenced by dialogs::file_dialog::action().

void gui::dialog::set_result ( const int  result  )  [inline, protected]

Definition at line 251 of file construct_dialog.hpp.

References result_.

Referenced by dialogs::file_dialog::action(), gui::message_dialog::action(), action(), and show().

void gui::dialog::action ( dialog_process_info dp_info  )  [protected, virtual]

void gui::dialog::refresh (  )  [protected]

Definition at line 426 of file construct_dialog.cpp.

References display::delay(), disp_, and display::flip().

Referenced by show().

label& gui::dialog::get_message (  )  const [inline, protected]

Definition at line 258 of file construct_dialog.hpp.

References message_.

Referenced by dialogs::file_dialog::action(), and dialogs::file_dialog::file_dialog().

void gui::dialog::clear_background (  )  [private]

Definition at line 365 of file construct_dialog.cpp.

References frame_.

Referenced by show().

void gui::dialog::draw_frame (  )  [private]

Definition at line 370 of file construct_dialog.cpp.

References gui::dialog_frame::draw(), and get_frame().

Referenced by show().

void gui::dialog::update_widget_positions (  )  [private]

void gui::dialog::draw_contents (  )  [private]

int gui::dialog::process ( dialog_process_info info  )  [private]


Member Data Documentation

Definition at line 182 of file construct_dialog.hpp.

Definition at line 184 of file construct_dialog.hpp.

Referenced by dialog(), layout(), and set_textbox().

Definition at line 185 of file construct_dialog.hpp.

Referenced by set_image().

const int gui::dialog::max_menu_width = -1 [static]

Definition at line 186 of file construct_dialog.hpp.

Referenced by set_menu(), and gui::show_dialog().

const size_t gui::dialog::left_padding = font::relative_size(10) [static]

Definition at line 187 of file construct_dialog.hpp.

Referenced by layout().

const size_t gui::dialog::right_padding = font::relative_size(10) [static]

Definition at line 188 of file construct_dialog.hpp.

Referenced by layout().

const size_t gui::dialog::image_h_pad = font::relative_size(/*image_ == NULL ? 0 :*/ 10) [static]

Definition at line 189 of file construct_dialog.hpp.

Referenced by layout().

const size_t gui::dialog::top_padding = font::relative_size(10) [static]

Definition at line 190 of file construct_dialog.hpp.

Referenced by layout().

const size_t gui::dialog::bottom_padding = font::relative_size(10) [static]

Definition at line 191 of file construct_dialog.hpp.

Referenced by layout().

Definition at line 271 of file construct_dialog.hpp.

Referenced by layout(), set_image(), update_widget_positions(), and ~dialog().

std::string gui::dialog::title_ [private]

Definition at line 272 of file construct_dialog.hpp.

Referenced by get_frame(), and show().

const style& gui::dialog::style_ [private]

Definition at line 273 of file construct_dialog.hpp.

Referenced by get_frame().

Definition at line 274 of file construct_dialog.hpp.

Referenced by ~dialog().

Definition at line 275 of file construct_dialog.hpp.

Referenced by process(), set_basic_behavior(), and set_menu().

std::vector<preview_pane*> gui::dialog::preview_panes_ [private]

std::vector< std::pair<dialog_button*,BUTTON_LOCATION> > gui::dialog::button_pool_ [private]

Definition at line 278 of file construct_dialog.hpp.

Referenced by add_button(), layout(), option_checked(), process(), and ~dialog().

Definition at line 279 of file construct_dialog.hpp.

Referenced by add_button(), get_frame(), process(), and update_widget_positions().

std::vector<dialog_button*> gui::dialog::extra_buttons_ [private]

Definition at line 280 of file construct_dialog.hpp.

Referenced by add_button(), layout(), and update_widget_positions().

std::vector<button*> gui::dialog::frame_buttons_ [private]

Definition at line 281 of file construct_dialog.hpp.

Referenced by get_frame().

std::string gui::dialog::topic_ [private]

Definition at line 282 of file construct_dialog.hpp.

Definition at line 283 of file construct_dialog.hpp.

Referenced by add_button(), get_frame(), and update_widget_positions().

Definition at line 285 of file construct_dialog.hpp.

Referenced by clear_background(), get_frame(), and ~dialog().

Definition at line 286 of file construct_dialog.hpp.

Referenced by get_layout(), set_layout(), show(), and update_widget_positions().

int gui::dialog::result_ [private]

Definition at line 287 of file construct_dialog.hpp.

Referenced by done(), result(), and set_result().


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