GG::ThreeButtonDlg Class Reference

A general pop-up message or user input box with one, two, or three buttons. More...

#include <ThreeButtonDlg.h>

Inheritance diagram for GG::ThreeButtonDlg:

GG::Wnd

List of all members.

Structors



 ThreeButtonDlg (X x, Y y, X w, Y h, const std::string &msg, const boost::shared_ptr< Font > &font, Clr color, Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string &zero="", const std::string &one="", const std::string &two="")
 ThreeButtonDlg (X w, Y h, const std::string &msg, const boost::shared_ptr< Font > &font, Clr color, Clr border_color, Clr button_color, Clr text_color, std::size_t buttons, const std::string &zero="", const std::string &one="", const std::string &two="")

Accessors



Clr ButtonColor () const
std::size_t Result () const
std::size_t DefaultButton () const
std::size_t EscapeButton () const

Mutators



virtual void Render ()
virtual void KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys)
void SetButtonColor (Clr color)
void SetDefaultButton (std::size_t i)
void SetEscapeButton (std::size_t i)

Structors



 ThreeButtonDlg ()


Detailed Description

A general pop-up message or user input box with one, two, or three buttons.

This is designed to be used as a generic message window, with just an "ok" button, or for any input consisting of only two or three choices, such as "yes" and "no", "abort", "retry", and "fail", etc. The enter key can be pressed to select the default button; the first button is always the default, unless the user sets a different one via SetDefaultButton(). Similarly, the escape key can be pressed to select the button that will get the user out of the dialog without taking any action, if one exists; the last button is always the escape button, unless a different one is set via SetEscapeButton(). Note that this means that in a one-button dialog both enter and escape do the same thing. The default labels for the buttons depends on the number of buttons. For a one-button dialog, the default label is "ok"; for a two-button dialog, the default labels are "ok" and "cancel"; and for a three-button dialog, the default labels are "yes", "no", and "cancel".

Definition at line 57 of file ThreeButtonDlg.h.


Constructor & Destructor Documentation

GG::ThreeButtonDlg::ThreeButtonDlg ( X  x,
Y  y,
X  w,
Y  h,
const std::string &  msg,
const boost::shared_ptr< Font > &  font,
Clr  color,
Clr  border_color,
Clr  button_color,
Clr  text_color,
std::size_t  buttons,
const std::string &  zero = "",
const std::string &  one = "",
const std::string &  two = "" 
)

Basic ctor

GG::ThreeButtonDlg::ThreeButtonDlg ( X  w,
Y  h,
const std::string &  msg,
const boost::shared_ptr< Font > &  font,
Clr  color,
Clr  border_color,
Clr  button_color,
Clr  text_color,
std::size_t  buttons,
const std::string &  zero = "",
const std::string &  one = "",
const std::string &  two = "" 
)

Ctor that automatically centers the dialog in the app's area

GG::ThreeButtonDlg::ThreeButtonDlg (  )  [protected]

default ctor


Member Function Documentation

Clr GG::ThreeButtonDlg::ButtonColor (  )  const

returns the color of the buttons in the dialog

std::size_t GG::ThreeButtonDlg::Result (  )  const

returns 0, 1, or 2, depending on which buttoon was clicked

std::size_t GG::ThreeButtonDlg::DefaultButton (  )  const

returns the number of the button that will be chosen by default if the user hits enter (NO_BUTTON if none)

std::size_t GG::ThreeButtonDlg::EscapeButton (  )  const

returns the number of the button that will be chosen by default if the user hits ESC (NO_BUTTON if none)

virtual void GG::ThreeButtonDlg::Render (  )  [virtual]

Draws this Wnd. Note that Wnds being dragged for a drag-and-drop operation are rendered twice -- once in-place as normal, once in the location of the drag operation, attached to the cursor. Such Wnds may wish to render themselves differently in those two cases. To determine which render is being performed, they can call GUI::GetGUI()->RenderingDragDropWnds().

Reimplemented from GG::Wnd.

virtual void GG::ThreeButtonDlg::KeyPress ( Key  key,
boost::uint32_t  key_code_point,
Flags< ModKey >  mod_keys 
) [virtual]

Respond to down-keystrokes (focus window only). A window may receive KeyPress() messages passed up to it from its children. For instance, Control-derived classes pass KeyPress() messages to their Parent() windows by default.

Note:
Though mouse clicks consist of a press and a release, all Control classes by default respond immediately to KeyPress(), not KeyRelease(); in fact, by default no Wnd class does anything at all on a KeyRelease event.

key_code_point will be zero if Unicode support is unavailable.

Reimplemented from GG::Wnd.

void GG::ThreeButtonDlg::SetButtonColor ( Clr  color  ) 

sets the color used to render the dialog's buttons

void GG::ThreeButtonDlg::SetDefaultButton ( std::size_t  i  ) 

sets the number of the button that will be chosen by default if the user hits enter (NO_BUTTON to disable)

void GG::ThreeButtonDlg::SetEscapeButton ( std::size_t  i  ) 

sets the number of the button that will be chosen by default if the user hits ESC (NO_BUTTON to disable)


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

Generated on Sat Mar 26 07:08:37 2011 for GG by  doxygen 1.5.9