GG::Control Class Reference

An abstract base class for all control classes. More...

#include <Control.h>

Inheritance diagram for GG::Control:

GG::Wnd GG::ColorDlg::ColorDisplay GG::DropDownList GG::DynamicGraphic GG::HueSaturationPicker GG::ListBox GG::ListBox::Row GG::MenuBar GG::RadioButtonGroup GG::Scroll GG::Slider GG::Spin< T > GG::StaticGraphic GG::TabBar GG::TextControl GG::ValuePicker

List of all members.

Protected Member Functions

virtual void MouseWheel (const Pt &pt, int move, Flags< ModKey > mod_keys)
virtual void KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys)
virtual void KeyRelease (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys)

Protected Attributes

Clr m_color
bool m_disabled

Accessors



virtual void DropsAcceptable (DropsAcceptableIter first, DropsAcceptableIter last, const Pt &pt) const
Clr Color () const
bool Disabled () const

Mutators



virtual void AcceptDrops (const std::vector< Wnd * > &wnds, const Pt &pt)
virtual void Render ()=0
virtual void SetColor (Clr c)
virtual void Disable (bool b=true)
virtual void DefineAttributes (WndEditor *editor)

Structors



 Control ()
 Control (X x, Y y, X w, Y h, Flags< WndFlag > flags=INTERACTIVE)


Detailed Description

An abstract base class for all control classes.

Each control has (like all windows) coordinates offset from the upper-left corner of it's parent's client area. All controls may be disabled. By default, a Control forwards several types of events and requests for action to its parent Wnd (e.g. AcceptDrops()). In particular, keyboard input not handled by the Control is forwarded to the Control's parent. Any class derived from Control should do the same with any keyboard input it does not need for its own use. For instance, an Edit control needs to know about arrow key keyboard input, but it should pass other key presses like 'ESC' to its parent.

Definition at line 48 of file Control.h.


Constructor & Destructor Documentation

GG::Control::Control (  )  [protected]

default ctor

GG::Control::Control ( X  x,
Y  y,
X  w,
Y  h,
Flags< WndFlag >  flags = INTERACTIVE 
) [protected]

basic ctor


Member Function Documentation

virtual void GG::Control::DropsAcceptable ( DropsAcceptableIter  first,
DropsAcceptableIter  last,
const Pt pt 
) const [virtual]

Sets the second member of each iterator to true or false, indicating whether the Wnd in the first member would be accepted if dropped on this Wnd at pt.

Reimplemented from GG::Wnd.

Reimplemented in GG::ListBox.

Clr GG::Control::Color (  )  const

returns the color of the control

Referenced by GG::Spin< T >::Render().

bool GG::Control::Disabled (  )  const

returns true if the control is disabled, false otherwise

Referenced by GG::Spin< T >::Render().

virtual void GG::Control::AcceptDrops ( const std::vector< Wnd * > &  wnds,
const Pt pt 
) [virtual]

When the user drops Wnds onto this Wnd, DropsAcceptable() is passed the list of dropped Wnds. The Wnds marked acceptable by DropsAcceptable() are then passed to AcceptDrops(), which handles the receipt of one or more drag-and-drop wnds into this Wnd.

Reimplemented from GG::Wnd.

Reimplemented in GG::ListBox.

virtual void GG::Control::Render (  )  [pure 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.

Implemented in GG::Button, GG::StateButton, GG::RadioButtonGroup, GG::HueSaturationPicker, GG::ValuePicker, GG::ColorDlg::ColorDisplay, GG::DropDownList, GG::DynamicGraphic, GG::Edit, GG::ListBox::Row, GG::ListBox, GG::MenuBar, GG::MultiEdit, GG::Scroll, GG::Slider, GG::Spin< T >, GG::StaticGraphic, GG::TabBar, and GG::TextControl.

virtual void GG::Control::SetColor ( Clr  c  )  [virtual]

virtual void GG::Control::Disable ( bool  b = true  )  [virtual]

disables/enables the control; disabled controls appear greyed

Reimplemented in GG::ListBox, GG::Scroll, GG::Slider, and GG::Spin< T >.

Referenced by GG::Spin< T >::Disable().

virtual void GG::Control::DefineAttributes ( WndEditor *  editor  )  [virtual]

Provides the attributes of this object that are appropriate for a user to edit in a WndEditor; see WndEditor for details.

Reimplemented from GG::Wnd.

Reimplemented in GG::Button, GG::StateButton, GG::RadioButtonGroup, GG::DropDownList, GG::DynamicGraphic, GG::Edit, GG::ListBox, GG::MenuBar, GG::MultiEdit, GG::Scroll, GG::Slider, GG::Spin< T >, GG::StaticGraphic, and GG::TextControl.

virtual void GG::Control::MouseWheel ( const Pt pt,
int  move,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to movement of the mouse wheel (move > 0 indicates the wheel is rolled up, < 0 indicates down)

Reimplemented from GG::Wnd.

Reimplemented in GG::ListBox, GG::MultiEdit, and GG::Spin< T >.

virtual void GG::Control::KeyPress ( Key  key,
boost::uint32_t  key_code_point,
Flags< ModKey >  mod_keys 
) [protected, 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.

Reimplemented in GG::DropDownList, GG::Edit, GG::ListBox, GG::MultiEdit, GG::Slider, and GG::Spin< T >.

virtual void GG::Control::KeyRelease ( Key  key,
boost::uint32_t  key_code_point,
Flags< ModKey >  mod_keys 
) [protected, virtual]

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

Note:
key_code_point will be zero if Unicode support is unavailable.

Reimplemented from GG::Wnd.


Member Data Documentation

the color of the control

Definition at line 80 of file Control.h.

bool GG::Control::m_disabled [protected]

whether or not this control is disabled

Definition at line 81 of file Control.h.


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