Public Member Functions | Private Member Functions | Private Attributes

gui2::twml_message_ Class Reference

Base class for the wml generated messages. More...

#include <wml_message.hpp>

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

List of all members.

Public Member Functions

 twml_message_ (const std::string &title, const std::string &message, const std::string &portrait, const bool mirror)
void set_input (const std::string &caption, std::string *text, const unsigned maximum_length)
 Sets the input text variables.
void set_option_list (const std::vector< std::string > &option_list, int *chosen_option)

Private Member Functions

void pre_show (CVideo &video, twindow &window)
 Inherited from tdialog.
void post_show (twindow &window)
 Inherited from tdialog.

Private Attributes

std::string title_
 The title for the dialog.
std::string image_
 The image which is shown in the dialog.
std::string message_
 The message to show to the user.
std::string portrait_
 Filename of the portrait.
bool mirror_
 Mirror the portrait?
bool has_input_
 Do we need to show an input box?
std::string input_caption_
 The caption to show for the input text.
std::string * input_text_
 The text input.
unsigned input_maximum_length_
 The maximum length of the input text.
std::vector< std::string > option_list_
 The list of options the user can choose.
int * chosen_option_
 The chosen option.

Detailed Description

Base class for the wml generated messages.

We have a separate sub class for left and right images.

Definition at line 28 of file wml_message.hpp.


Constructor & Destructor Documentation

gui2::twml_message_::twml_message_ ( const std::string &  title,
const std::string &  message,
const std::string &  portrait,
const bool  mirror 
) [inline]

Definition at line 32 of file wml_message.hpp.


Member Function Documentation

void gui2::twml_message_::post_show ( twindow window  )  [private, virtual]

Inherited from tdialog.

Reimplemented from gui2::tdialog.

Definition at line 146 of file wml_message.cpp.

References chosen_option_, has_input_, input_text_, and option_list_.

void gui2::twml_message_::pre_show ( CVideo video,
twindow window 
) [private, virtual]

Inherited from tdialog.

Todo:
This function enables the wml markup for all items, but the interface is a bit hacky.

Especially the fiddling in the internals of the listbox is ugly. There needs to be a clean interface to set whether a widget has a markup and what kind of markup. These fixes will be post 1.6.

Todo:
This syntax looks like a bad hack, it would be nice to write a new syntax which doesn't use those hacks (also avoids the problem with special meanings for certain characters.

Reimplemented from gui2::tdialog.

Definition at line 62 of file wml_message.cpp.

References gui2::tlistbox::add_row(), gui2::tcontrol::canvas(), chosen_option_, gui2::tlegacy_menu_item::description(), has_input_, gui2::tlegacy_menu_item::icon(), input_caption_, input_maximum_length_, input_text_, gui2::twidget::INVISIBLE, gui2::tlegacy_menu_item::is_default(), gui2::tlegacy_menu_item::label(), message_, mirror_, option_list_, portrait_, gui2::tlistbox::select_row(), gui2::tlabel::set_can_wrap(), gui2::tcontrol::set_label(), gui2::tcontrol::set_use_markup(), gui2::twidget::set_visible(), and title_.

Here is the call graph for this function:

void gui2::twml_message_::set_input ( const std::string &  caption,
std::string *  text,
const unsigned  maximum_length 
)

Sets the input text variables.

Parameters:
caption The caption for the label.
text The initial text, after showing the final text.
maximum_length The maximum length of the text.

Definition at line 35 of file wml_message.cpp.

References has_input_, input_caption_, input_maximum_length_, and input_text_.

void gui2::twml_message_::set_option_list ( const std::vector< std::string > &  option_list,
int *  chosen_option 
)

Definition at line 46 of file wml_message.cpp.

References chosen_option_, and option_list_.


Member Data Documentation

The chosen option.

Definition at line 98 of file wml_message.hpp.

Referenced by post_show(), pre_show(), and set_option_list().

Do we need to show an input box?

Definition at line 83 of file wml_message.hpp.

Referenced by post_show(), pre_show(), and set_input().

std::string gui2::twml_message_::image_ [private]

The image which is shown in the dialog.

This image can be an icon or portrait or any other image.

Definition at line 72 of file wml_message.hpp.

std::string gui2::twml_message_::input_caption_ [private]

The caption to show for the input text.

Definition at line 86 of file wml_message.hpp.

Referenced by pre_show(), and set_input().

The maximum length of the input text.

Definition at line 92 of file wml_message.hpp.

Referenced by pre_show(), and set_input().

std::string* gui2::twml_message_::input_text_ [private]

The text input.

Definition at line 89 of file wml_message.hpp.

Referenced by post_show(), pre_show(), and set_input().

std::string gui2::twml_message_::message_ [private]

The message to show to the user.

Definition at line 75 of file wml_message.hpp.

Referenced by pre_show().

Mirror the portrait?

Definition at line 80 of file wml_message.hpp.

Referenced by pre_show().

std::vector<std::string> gui2::twml_message_::option_list_ [private]

The list of options the user can choose.

Definition at line 95 of file wml_message.hpp.

Referenced by post_show(), pre_show(), and set_option_list().

std::string gui2::twml_message_::portrait_ [private]

Filename of the portrait.

Definition at line 77 of file wml_message.hpp.

Referenced by pre_show().

std::string gui2::twml_message_::title_ [private]

The title for the dialog.

Definition at line 65 of file wml_message.hpp.

Referenced by pre_show().


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:22:39 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs