GG
Classes

GG::ColorDlg Class Reference

A dialog box used to get a color selection from the user. More...

#include <ColorDlg.h>

Inheritance diagram for GG::ColorDlg:
GG::Wnd

List of all members.

Classes

class  ColorButton
 The button used to select the custom colors in ColorDlg. More...
class  ColorDisplay
 A simple control that only displays a rectangle filled with the given color. More...

Structors

 ColorDlg (X x, Y y, const boost::shared_ptr< Font > &font, Clr dialog_color, Clr border_color, Clr text_color=CLR_BLACK)
 ColorDlg (X x, Y y, Clr original_color, const boost::shared_ptr< Font > &font, Clr dialog_color, Clr border_color, Clr text_color=CLR_BLACK)
 ColorDlg ()

Accessors

bool ColorWasSelected () const
Clr Result () const
const std::string & NewString (const std::string &str) const
const std::string & OldString (const std::string &str) const
const std::string & RedString (const std::string &str) const
const std::string & GreenString (const std::string &str) const
const std::string & BlueString (const std::string &str) const
const std::string & HueString (const std::string &str) const
const std::string & SaturationString (const std::string &str) const
const std::string & ValueString (const std::string &str) const
const std::string & AlphaString (const std::string &str) const
const std::string & OkString (const std::string &str) const
const std::string & CancelString (const std::string &str) const

Mutators

void SetNewString (const std::string &str)
void SetOldString (const std::string &str)
void SetRedString (const std::string &str)
void SetGreenString (const std::string &str)
void SetBlueString (const std::string &str)
void SetHueString (const std::string &str)
void SetSaturationString (const std::string &str)
void SetValueString (const std::string &str)
void SetAlphaString (const std::string &str)
void SetOkString (const std::string &str)
void SetCancelString (const std::string &str)
virtual void Render ()
virtual void KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys)

Detailed Description

A dialog box used to get a color selection from the user.

The user may select a certain number of custom colors, which will remain available for the duration of that run of the application in the ColorDlg's static space. If desired, an optional previous color can be provided to the ColorDlg ctor, which will cause this previous color to be shown next to the new color for comparison purposes.

Definition at line 153 of file ColorDlg.h.


Constructor & Destructor Documentation

GG::ColorDlg::ColorDlg ( X  x,
Y  y,
const boost::shared_ptr< Font > &  font,
Clr  dialog_color,
Clr  border_color,
Clr  text_color = CLR_BLACK 
)

ctor

GG::ColorDlg::ColorDlg ( X  x,
Y  y,
Clr  original_color,
const boost::shared_ptr< Font > &  font,
Clr  dialog_color,
Clr  border_color,
Clr  text_color = CLR_BLACK 
)

ctor


Member Function Documentation

bool GG::ColorDlg::ColorWasSelected ( ) const

Returns true iff the user selected a color and then clicked the "Ok" button. Otherwise, the color returned by Result() will be the original color if one was selected, or undefined if one was not.

Clr GG::ColorDlg::Result ( ) const

returns the color selected by the user, if the "Ok" button was used to close the dialog.

virtual void GG::ColorDlg::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::ColorDlg::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: