GG::Control Class Reference

This is 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.

Accessors

Clr Color () const
bool Disabled () const

Mutators

virtual void AcceptDrops (std::list< Wnd * > &wnds, const Pt &pt)
virtual void Render ()=0
virtual void MouseWheel (const Pt &pt, int move, Flags< ModKey > mod_keys)
virtual void KeyPress (Key key, Flags< ModKey > mod_keys)
virtual void KeyRelease (Key key, Flags< ModKey > mod_keys)
virtual void SetColor (Clr c)
virtual void Disable (bool b=true)
virtual void DefineAttributes (WndEditor *editor)

Structors

 Control ()
 Control (int x, int y, int w, int h, Flags< WndFlag > flags=CLICKABLE)

Protected Attributes

Clr m_color
bool m_disabled

Detailed Description

This is 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 passes keyboard input to its parent Wnd. 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 44 of file Control.h.


Constructor & Destructor Documentation

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

default ctor

GG::Control::Control ( int  x,
int  y,
int  w,
int  h,
Flags< WndFlag >  flags = CLICKABLE 
) [protected]

basic ctor


Member Function Documentation

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 ( std::list< Wnd * > &  wnds,
const Pt pt 
) [virtual]

handles a drop of one or more drag-and-drop wnds into this Wnd; the accepted wnds remain in the list wnds; the rejected ones do not.

This function must not not alter the order of the elements in wnds. It may only remove elements.

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::MouseWheel ( const Pt pt,
int  move,
Flags< ModKey >  mod_keys 
) [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,
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.

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

virtual void GG::Control::KeyRelease ( Key  key,
Flags< ModKey >  mod_keys 
) [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.

Reimplemented from GG::Wnd.

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

sets the color of the control

Reimplemented in GG::Button, GG::StateButton, GG::DropDownList, GG::Edit, GG::ListBox, GG::Scroll, GG::Slider, GG::Spin< T >, and GG::TextControl.

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

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.

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


Member Data Documentation

Clr GG::Control::m_color [protected]

the color of the control

Definition at line 71 of file Control.h.

bool GG::Control::m_disabled [protected]

whether or not this control is disabled

Definition at line 72 of file Control.h.


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