#include <Button.h>
Inheritance diagram for GG::Button:
Signal Types | |
typedef boost::signal< void()> | ClickedSignalType |
Slot Types | |
typedef ClickedSignalType::slot_type | ClickedSlotType |
Accessors | |
ClickedSignalType | ClickedSignal |
ButtonState | State () const |
const SubTexture & | UnpressedGraphic () const |
const SubTexture & | PressedGraphic () const |
const SubTexture & | RolloverGraphic () const |
Structors | |
Button (int x, int y, int w, int h, const std::string &str, const boost::shared_ptr< Font > &font, Clr color, Clr text_color=CLR_BLACK, Flags< WndFlag > flags=CLICKABLE) | |
Mutators | |
virtual void | Render () |
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 | 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) |
Structors | |
Button () | |
Mutators | |
virtual void | RenderUnpressed () |
virtual void | RenderPressed () |
virtual void | RenderRollover () |
Public Types | |
enum | ButtonState { BN_PRESSED, BN_UNPRESSED, BN_ROLLOVER } |
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.
Definition at line 44 of file Button.h.
typedef boost::signal<void ()> GG::Button::ClickedSignalType |
typedef ClickedSignalType::slot_type GG::Button::ClickedSlotType |
the states of being for a GG::Button
GG::Button::Button | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
const std::string & | str, | |||
const boost::shared_ptr< Font > & | font, | |||
Clr | color, | |||
Clr | text_color = CLR_BLACK , |
|||
Flags< WndFlag > | flags = CLICKABLE | |||
) |
ctor
GG::Button::Button | ( | ) | [protected] |
default ctor
ButtonState GG::Button::State | ( | ) | const |
const SubTexture& GG::Button::UnpressedGraphic | ( | ) | const |
Returns the SubTexture to be used as the image of the button when unpressed.
const SubTexture& GG::Button::PressedGraphic | ( | ) | const |
Returns the SubTexture to be used as the image of the button when pressed.
const SubTexture& GG::Button::RolloverGraphic | ( | ) | const |
Returns the SubTexture to be used as the image of the button when it contains the cursor, but is not pressed.
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.
respond to left button down msg.
A window receives this whenever any input device button changes from up to down while over the window.
Reimplemented from GG::Wnd.
virtual void GG::Button::LDrag | ( | const Pt & | pt, | |
const Pt & | move, | |||
Flags< ModKey > | mod_keys | |||
) | [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.
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.
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.
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 | ( | ) | [virtual] |
virtual void GG::Button::SetColor | ( | Clr | c | ) | [virtual] |
Sets the control's color; does not affect the text color.
Reimplemented from GG::TextControl.
Referenced by GG::Spin< T >::SetColor().
void GG::Button::SetState | ( | ButtonState | state | ) |
void GG::Button::SetUnpressedGraphic | ( | const SubTexture & | st | ) |
Sets the SubTexture to be used as the image of the button when unpressed.
void GG::Button::SetPressedGraphic | ( | const SubTexture & | st | ) |
Sets the SubTexture to be used as the image of the button when pressed.
void GG::Button::SetRolloverGraphic | ( | const SubTexture & | st | ) |
Sets the SubTexture to be used as the image of the button when it contains the cursor, but is not pressed.
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::RenderUnpressed | ( | ) | [protected, virtual] |
Draws the button unpressed. If an unpressed graphic has been supplied, it is used.
Reimplemented in GG::ColorDlg::ColorButton.
virtual void GG::Button::RenderPressed | ( | ) | [protected, virtual] |
Draws the button pressed. If an pressed graphic has been supplied, it is used.
Reimplemented in GG::ColorDlg::ColorButton.
virtual void GG::Button::RenderRollover | ( | ) | [protected, virtual] |
Draws the button rolled-over. If an rollover graphic has been supplied, it is used.
Reimplemented in GG::ColorDlg::ColorButton.
ClickedSignalType GG::Button::ClickedSignal [mutable] |