GG
Public Types
GG::Button Class Reference

#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 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 ()

Additional Inherited Members

- Public Member Functions inherited from GG::TextControl
 TextControl (X x, Y y, X w, Y h, const std::string &str, const boost::shared_ptr< Font > &font, Clr color=CLR_BLACK, Flags< TextFormat > format=FORMAT_NONE, Flags< WndFlag > flags=Flags< WndFlag >())
 TextControl (X x, Y y, const std::string &str, const boost::shared_ptr< Font > &font, Clr color=CLR_BLACK, Flags< TextFormat > format=FORMAT_NONE, Flags< WndFlag > flags=Flags< WndFlag >())
virtual Pt MinUsableSize () const
const std::string & Text () const
Flags< TextFormat > GetTextFormat () const
Clr TextColor () const
bool ClipText () const
bool SetMinSize () const
template<class T >
void operator>> (T &t) const
template<class T >
GetValue () const
 operator const std::string & () const
bool Empty () const
CPSize Length () const
Pt TextUpperLeft () const
Pt TextLowerRight () const
virtual void SetText (const std::string &str)
virtual void SizeMove (const Pt &ul, const Pt &lr)
void SetTextFormat (Flags< TextFormat > format)
void SetTextColor (Clr color)
void ClipText (bool b)
void SetMinSize (bool b)
template<class T >
void operator<< (T t)
void operator+= (const std::string &s)
void operator+= (char c)
void Clear ()
void Insert (CPSize pos, char c)
void Insert (CPSize pos, const std::string &s)
void Erase (CPSize pos, CPSize num=CP1)
void Insert (std::size_t line, CPSize pos, char c)
void Insert (std::size_t line, CPSize pos, const std::string &s)
void Erase (std::size_t line, CPSize pos, CPSize num=CP1)
- Protected Member Functions inherited from GG::TextControl
 TextControl ()
const std::vector
< Font::LineData > & 
GetLineData () const
const boost::shared_ptr< Font > & GetFont () const
bool FitToText () const

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 47 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 51 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::LButtonDown ( const Pt pt,
Flags< ModKey >  mod_keys 
)
protectedvirtual

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 
)
protectedvirtual

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 
)
protectedvirtual

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 
)
protectedvirtual

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 
)
protectedvirtual

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 ( )
protectedvirtual

Respond to cursor leaving window's coords.

Reimplemented from GG::Wnd.


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