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 (int x, int y, int w, int h, const std::string &msg, const boost::shared_ptr< Font > &font, Clr color, Clr border_color, Clr button_color, Clr text_color, int buttons, const std::string &zero="", const std::string &one="", const std::string &two="")
 ThreeButtonDlg (int w, int h, const std::string &msg, const boost::shared_ptr< Font > &font, Clr color, Clr border_color, Clr button_color, Clr text_color, int buttons, const std::string &zero="", const std::string &one="", const std::string &two="")

Accessors

Clr ButtonColor () const
int Result () const
int DefaultButton () const
int EscapeButton () const

Mutators

virtual void Render ()
virtual void KeyPress (Key key, Flags< ModKey > mod_keys)
void SetButtonColor (Clr color)
void SetDefaultButton (int i)
void SetEscapeButton (int 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 50 of file ThreeButtonDlg.h.


Constructor & Destructor Documentation

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

basic ctor

GG::ThreeButtonDlg::ThreeButtonDlg ( int  w,
int  h,
const std::string &  msg,
const boost::shared_ptr< Font > &  font,
Clr  color,
Clr  border_color,
Clr  button_color,
Clr  text_color,
int  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

int GG::ThreeButtonDlg::Result (  )  const

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

int GG::ThreeButtonDlg::DefaultButton (  )  const

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

int GG::ThreeButtonDlg::EscapeButton (  )  const

returns the number of the button that will be chosen by default if the user hits ESC (-1 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,
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.

Reimplemented from GG::Wnd.

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

sets the color used to render the dialog's buttons

void GG::ThreeButtonDlg::SetDefaultButton ( int  i  ) 

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

void GG::ThreeButtonDlg::SetEscapeButton ( int  i  ) 

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


The documentation for this class was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2