GG

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="")
 ThreeButtonDlg ()

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)

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


Member Function Documentation

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.


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