Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

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.

Classes

struct  dimension_measurements

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, const std::string &help_string="")
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
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( 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_

Detailed Description

Definition at line 185 of file construct_dialog.hpp.


Member Typedef Documentation

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

Definition at line 206 of file construct_dialog.hpp.

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

Definition at line 205 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 208 of file construct_dialog.hpp.

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

Definition at line 207 of file construct_dialog.hpp.

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

Definition at line 204 of file construct_dialog.hpp.

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

Definition at line 203 of file construct_dialog.hpp.

Definition at line 200 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 187 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::action ( dialog_process_info dp_info  )  [protected, virtual]

Reimplemented in dialogs::file_dialog, and statistics_dialog.

Definition at line 787 of file construct_dialog.cpp.

References gui::CONTINUE_DIALOG, gui::DELETE_ITEM, gui::menu::erase_item(), gui::dialog_process_info::first_time, get_menu(), result(), gui::menu::selection(), and set_result().

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 210 of file construct_dialog.cpp.

References add_button(), disp_, gui::dialog_button_info::handler, gui::dialog_button_info::label, and display::video().

Here is the call graph for this function:

void gui::dialog::add_button ( dialog_button *const   btn,
BUTTON_LOCATION  loc 
)
void gui::dialog::add_option ( const std::string &  label,
bool  checked = false,
BUTTON_LOCATION  loc = BUTTON_CHECKBOX,
const std::string &  help_string = "" 
)

Definition at line 216 of file construct_dialog.cpp.

References add_button(), disp_, gui::button::set_check(), gui::widget::set_help_string(), and display::video().

Referenced by events::menu_handler::create_unit().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 246 of file construct_dialog.hpp.

References preview_panes_.

Referenced by events::menu_handler::unit_list().

Here is the caller graph for this function:

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

Definition at line 344 of file construct_dialog.cpp.

References frame_.

Referenced by show().

Here is the caller graph for this function:

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

Definition at line 276 of file construct_dialog.hpp.

References gui::CONTINUE_DIALOG, and result_.

Referenced by show().

Here is the caller graph for this function:

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

Definition at line 312 of file construct_dialog.cpp.

References disp_, gui::widget::draw(), display::flip(), gui::preview_pane::handler_members(), display::invalidate_all(), preview_panes_, and events::raise_draw_event().

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 349 of file construct_dialog.cpp.

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

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 280 of file construct_dialog.hpp.

References disp_.

Referenced by statistics_dialog::action().

Here is the caller graph for this function:

dialog_frame & gui::dialog::get_frame (  ) 

Definition at line 330 of file construct_dialog.cpp.

References disp_, frame_, frame_buttons_, help_button_, resources::screen, standard_buttons_, style_, title_, and display::video().

Referenced by draw_frame(), layout(), process(), and set_layout().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 264 of file construct_dialog.hpp.

References dim_.

Referenced by process().

Here is the caller graph for this function:

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

Definition at line 290 of file construct_dialog.hpp.

References message_.

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

Definition at line 278 of file construct_dialog.hpp.

References text_widget_.

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

Reimplemented in dialogs::file_dialog.

Definition at line 411 of file construct_dialog.cpp.

References 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(), 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_, font::relative_size(), right_padding, resources::screen, set_layout(), gui::preview_pane::show_above(), gui::textbox::text(), font::text_area(), text_widget_, 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 171 of file construct_dialog.cpp.

References button_pool_.

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

Definition at line 405 of file construct_dialog.cpp.

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

Referenced by show().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 274 of file construct_dialog.hpp.

References result_.

Referenced by statistics_dialog::action(), action(), mp::connect::process_event(), and show().

Here is the caller graph for this function:

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

Definition at line 266 of file construct_dialog.hpp.

References type_.

Referenced by events::menu_handler::unit_list().

Here is the caller graph for this function:

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

Definition at line 820 of file construct_dialog.cpp.

References caption_font_size, disp_, font::NORMAL_COLOR, set_image(), and display::video().

Here is the call graph for this function:

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

Definition at line 238 of file construct_dialog.hpp.

References image_.

Referenced by set_image().

Here is the caller graph for this function:

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

Definition at line 666 of file construct_dialog.cpp.

References dim_, get_frame(), gui::dialog::dimension_measurements::interior, and gui::dialog_frame::layout().

Referenced by layout().

Here is the call graph for this function:

Here is the caller graph for this function:

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 
)

Definition at line 234 of file construct_dialog.cpp.

References gui::menu::default_style, disp_, max_menu_width, set_menu(), type_, and display::video().

Here is the call graph for this function:

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

Definition at line 240 of file construct_dialog.cpp.

References gui::empty_menu, menu_, preview_panes_, gui::menu::reset_selection(), gui::menu::selection(), gui::menu::set_items(), and set_menu().

Referenced by gui::filter_textbox::handle_text_changed().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 247 of file construct_dialog.hpp.

References preview_panes_.

Referenced by events::menu_handler::recruit().

Here is the caller graph for this function:

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

Definition at line 283 of file construct_dialog.hpp.

References result_.

Referenced by statistics_dialog::action(), action(), and show().

Here is the caller graph for this function:

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

Definition at line 224 of file construct_dialog.cpp.

References disp_, gui2::event::find(), message_font_size, font::NORMAL_COLOR, gui::textbox::set_wrap(), text_widget_, and display::video().

Here is the call graph for this function:

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

Definition at line 248 of file construct_dialog.hpp.

References text_widget_.

Referenced by mp::connect::process_event().

Here is the caller graph for this function:

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

Definition at line 267 of file construct_dialog.cpp.

References layout(), and show().

Referenced by statistics_dialog::action(), mp::connect::process_event(), events::menu_handler::recruit(), show(), hotkey::command_executor::show_menu(), and events::menu_handler::unit_list().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 277 of file construct_dialog.hpp.

References gui::textbox::text(), and text_widget_.

Referenced by mp::connect::process_event().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Member Data Documentation

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

Definition at line 223 of file construct_dialog.hpp.

Referenced by layout().

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

Definition at line 310 of file construct_dialog.hpp.

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

Definition at line 217 of file construct_dialog.hpp.

Referenced by set_image().

Definition at line 318 of file construct_dialog.hpp.

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

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

Definition at line 312 of file construct_dialog.hpp.

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

Definition at line 317 of file construct_dialog.hpp.

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

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

Definition at line 313 of file construct_dialog.hpp.

Referenced by get_frame().

Definition at line 315 of file construct_dialog.hpp.

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

Definition at line 215 of file construct_dialog.hpp.

Referenced by hotkey::command_executor::show_menu().

Definition at line 303 of file construct_dialog.hpp.

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

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

Definition at line 221 of file construct_dialog.hpp.

Referenced by layout().

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

Definition at line 219 of file construct_dialog.hpp.

Referenced by layout().

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

Definition at line 218 of file construct_dialog.hpp.

Referenced by set_menu().

Definition at line 216 of file construct_dialog.hpp.

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

Definition at line 214 of file construct_dialog.hpp.

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

Definition at line 319 of file construct_dialog.hpp.

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

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

Definition at line 220 of file construct_dialog.hpp.

Referenced by layout().

Definition at line 311 of file construct_dialog.hpp.

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

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

Definition at line 305 of file construct_dialog.hpp.

Referenced by get_frame().

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

Definition at line 304 of file construct_dialog.hpp.

Referenced by get_frame(), and show().

Definition at line 306 of file construct_dialog.hpp.

Referenced by ~dialog().

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

Definition at line 222 of file construct_dialog.hpp.

Referenced by layout().

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

Definition at line 314 of file construct_dialog.hpp.

Definition at line 307 of file construct_dialog.hpp.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:09 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs