GG
Public Types

GG::Button Class Reference

This is a basic button control. More...

#include <Button.h>

Inheritance diagram for GG::Button:
GG::TextControl GG::Control GG::Wnd GG::ColorDlg::ColorButton

List of all members.

Public Types

enum  ButtonState {
  BN_PRESSED,
  BN_UNPRESSED,
  BN_ROLLOVER
}

Signal Types

typedef boost::signal< void()> ClickedSignalType

Structors

 Button (X x, Y y, X w, Y h, const std::string &str, const boost::shared_ptr< Font > &font, Clr color, Clr text_color=CLR_BLACK, Flags< WndFlag > flags=INTERACTIVE)
 Button ()

Accessors

ClickedSignalType ClickedSignal
ButtonState State () const
const SubTextureUnpressedGraphic () const
const SubTexturePressedGraphic () const
const SubTextureRolloverGraphic () const

Mutators

virtual void Render ()
virtual void SetColor (Clr c)
void SetState (ButtonState state)
void SetUnpressedGraphic (const SubTexture &st)
void SetPressedGraphic (const SubTexture &st)
void SetRolloverGraphic (const SubTexture &st)
virtual void DefineAttributes (WndEditor *editor)
virtual void LButtonDown (const Pt &pt, Flags< ModKey > mod_keys)
virtual void LDrag (const Pt &pt, const Pt &move, Flags< ModKey > mod_keys)
virtual void LButtonUp (const Pt &pt, Flags< ModKey > mod_keys)
virtual void LClick (const Pt &pt, Flags< ModKey > mod_keys)
virtual void MouseHere (const Pt &pt, Flags< ModKey > mod_keys)
virtual void MouseLeave ()
virtual void RenderUnpressed ()
virtual void RenderPressed ()
virtual void RenderRollover ()

Detailed Description

This is a basic button control.

Has three states: BN_UNPRESSED, BN_PRESSED, and BN_ROLLOVER. BN_ROLLOVER is when the cursor "rolls over" the button, without depressing it, allowing rollover effects on the button. To create a bitmap button, simply set the unpressed, pressed, and/or rollover graphics to the desired SubTextures.

See also:
GG::SubTexture

Definition at line 49 of file Button.h.


Member Enumeration Documentation

the states of being for a GG::Button

Enumerator:
BN_PRESSED 

The button is being pressed by the user, and the cursor is over the button.

BN_UNPRESSED 

The button is unpressed.

BN_ROLLOVER 

The button has the cursor over it, but is unpressed.

Definition at line 53 of file Button.h.


Member Function Documentation

ButtonState GG::Button::State ( ) const

Returns button state

See also:
ButtonState
virtual void GG::Button::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::TextControl.

void GG::Button::SetState ( ButtonState  state)

Sets button state programmatically

See also:
ButtonState
virtual void GG::Button::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::TextControl.

virtual void GG::Button::LButtonDown ( const Pt pt,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to left button down msg. A window receives this whenever any input device button changes from up to down while over the window.

Note:
If this Wnd was created with the REPEAT_BUTTON_DOWN flag, this method may be called multiple times during a single button press-release cycle.
See also:
GG::GUI

Reimplemented from GG::Wnd.

virtual void GG::Button::LDrag ( const Pt pt,
const Pt move,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to left button drag msg (even if this Wnd is not dragable). Drag messages are only sent to the window over which the button was pressed at the beginning of the drag. A window receives this whenever any input device button is down and the cursor is moving while over the window. The window will also receive drag messages when the mouse is being dragged outside the window's area.

Reimplemented from GG::Wnd.

virtual void GG::Button::LButtonUp ( const Pt pt,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to release of left mouse button outside this Wnd, if it was originally depressed over this Wnd. A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends, even if the cursor is not currently over the window when this happens.

Reimplemented from GG::Wnd.

virtual void GG::Button::LClick ( const Pt pt,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to release of left mouse button over this Wnd, if it was also originally depressed over this Wnd. A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends over its area as well.

Reimplemented from GG::Wnd.

virtual void GG::Button::MouseHere ( const Pt pt,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to cursor moving about within the Wnd, or to cursor lingering within the Wnd for a long period of time. A MouseHere() message will not be generated the first time the cursor enters the window's area. In that case, a MouseEnter() message is generated.

Reimplemented from GG::Wnd.

virtual void GG::Button::MouseLeave ( ) [protected, virtual]

Respond to cursor leaving window's coords.

Reimplemented from GG::Wnd.


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