Support Forum G3D Web Page |
Push button that can be temporarily pressed.
More...
Inherits G3D::GuiControl.
Public Member Functions | |
GuiButton (GuiContainer *, const Callback &callback, const GuiText &text, GuiTheme::ButtonStyle style) | |
Called by GuiContainers. More... | |
const GuiText & | caption () const |
float | captionHeight () const |
For controls that have a caption outside the bounds of the control on the top or bottom, this is the size reserved for the caption. More... | |
float | captionWidth () const |
For controls that have a caption outside the bounds of the control on the left, this is the size reserved for the caption. More... | |
const Rect2D & | clickRect () const |
Used by GuiContainers. More... | |
virtual float | defaultCaptionHeight () const |
Default caption size for this control. More... | |
virtual float | defaultCaptionWidth () const |
bool | enabled () const |
virtual void | findControlUnderMouse (Vector2 mouse, GuiControl *&control) |
Return the enabled, visible control containing the mouse. More... | |
bool | focused () const |
Vector2 | fromOSWindowCoords (const Vector2 &v) const |
Transforms v from OS window coordinates to this control's coordinates. More... | |
bool | isDown () |
Returns whether or not button is down. More... | |
bool | mouseOver () const |
void | moveBy (const Vector2 &delta) |
void | moveBy (float dx, float dy) |
void | moveRightOf (const GuiControl *control, const Vector2 &offset) |
If these two controls have the same parent, move this one immediately to the right of the argument. More... | |
void | moveRightOf (const GuiControl *control, float offsetX=0.0f) |
virtual bool | onEvent (const GEvent &event) override |
Called by GuiContainers. More... | |
const Rect2D & | rect () const |
virtual void | render (RenderDevice *rd, const shared_ptr< GuiTheme > &theme, bool ancestorsEnabled) const override |
Called by GuiContainers. More... | |
virtual void | setCaption (const GuiText &caption) |
virtual void | setCaptionHeight (float c) |
virtual void | setCaptionWidth (float c) |
void | setDown () |
Sets the button as down. More... | |
virtual void | setEnabled (bool e) |
void | setEventSource (GuiControl *c) |
void | setFocused (bool b) |
Grab or release keyboard focus. More... | |
void | setHeight (float h) |
void | setPosition (const Vector2 &v) |
void | setPosition (float x, float y) |
virtual void | setRect (const Rect2D &rect) |
If you explicitly change the rectangle of a control, the containing pane may clip its borders. More... | |
void | setSize (const Vector2 &v) |
void | setSize (float x, float y) |
void | setUp () |
Sets the button as up. More... | |
void | setVisible (bool b) |
void | setWidth (float w) |
shared_ptr< GuiTheme > | theme () const |
virtual bool | toolStyle () const override |
Return true if this is in tool button style. More... | |
Vector2 | toOSWindowCoords (const Vector2 &v) const |
Returns the coordinates of v, which is in the coordinate system of this object, relative to the OSWindow on which it will be rendered. More... | |
Rect2D | toOSWindowCoords (const Rect2D &r) const |
bool | visible () const |
GuiWindow * | window () const |
Get the window containing this control. More... | |
Protected Types | |
enum | { LEFT_CAPTION_WIDTH = 80, TOP_CAPTION_HEIGHT = 20 } |
Protected Member Functions | |
void | fireEvent (GEventType type) |
Fires an event. More... | |
Protected Attributes | |
Callback | m_callback |
GuiText | m_caption |
float | m_captionHeight |
float | m_captionWidth |
Rect2D | m_clickRect |
Rect bounds used for mouse actions. More... | |
bool | m_down |
Is the mouse currently down over this control? More... | |
bool | m_enabled |
GuiControl * | m_eventSource |
Sent events should appear to be from this object, which is usually "this". More... | |
GuiWindow * | m_gui |
The window that ultimately contains this control. More... | |
GuiContainer * | m_parent |
Parent pane. More... | |
Rect2D | m_rect |
Rect bounds used for rendering and layout. More... | |
GuiTheme::ButtonStyle | m_style |
bool | m_visible |
Friends | |
class | GuiPane |
class | GuiWindow |
Push button that can be temporarily pressed.
When the button has been pressed and released, a G3D::GuiEvent of type G3D::GEventType::GUI_ACTION is fired on the containing window. Alternatively, you can assign a GuiButton::Callback to execute when the button is pressed, before the event is handled.
See also GuiRadioButton and GuiCheckBox for creating buttons that stay down when pressed.
G3D::GuiButton::GuiButton | ( | GuiContainer * | , |
const Callback & | callback, | ||
const GuiText & | text, | ||
GuiTheme::ButtonStyle | style | ||
) |
Called by GuiContainers.
See GuiPane::addButton instead.
|
inherited |
Referenced by G3D::GuiPane::addDropDownList(), G3D::GuiPane::addMultiLineTextBox(), and G3D::GuiPane::addTextBox().
|
inherited |
For controls that have a caption outside the bounds of the control on the top or bottom, this is the size reserved for the caption.
|
inherited |
For controls that have a caption outside the bounds of the control on the left, this is the size reserved for the caption.
|
inlineinherited |
Used by GuiContainers.
|
inlinevirtualinherited |
Default caption size for this control.
Reimplemented in G3D::GuiFunctionBox.
|
inlinevirtualinherited |
|
inherited |
Referenced by G3D::GuiNumberBox< int >::render().
|
inlinevirtualinherited |
Return the enabled, visible control containing the mouse.
The default implementation returns itself if the mouse is within its bounds. GuiContainers should override this to iterate through children. Since only one (non-overlapping) child will write to control, it is sufficient to call this on all children without testing to see if one already wrote to control.
Reimplemented in G3D::GuiNumberBox< Value >, G3D::GuiNumberBox< float >, G3D::GuiNumberBox< int >, G3D::GuiTextureBox, G3D::GuiPane, G3D::GuiScrollPane, G3D::GuiFrameBox, and G3D::GuiTabPane.
Referenced by G3D::GuiNumberBox< int >::findControlUnderMouse().
|
protectedinherited |
Fires an event.
|
inherited |
Transforms v from OS window coordinates to this control's coordinates.
bool G3D::GuiButton::isDown | ( | ) |
Returns whether or not button is down.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
If these two controls have the same parent, move this one immediately to the right of the argument.
offset | May be negative |
Referenced by G3D::GuiControl::moveRightOf().
|
inlineinherited |
|
overridevirtual |
Called by GuiContainers.
Reimplemented from G3D::GuiControl.
|
inherited |
|
overridevirtual |
Called by GuiContainers.
Implements G3D::GuiControl.
|
virtualinherited |
Reimplemented in G3D::GuiNumberBox< Value >, G3D::GuiNumberBox< float >, G3D::GuiNumberBox< int >, G3D::GuiTextureBox, and G3D::GuiPane.
Referenced by G3D::GuiNumberBox< int >::setCaption().
|
virtualinherited |
|
virtualinherited |
void G3D::GuiButton::setDown | ( | ) |
Sets the button as down.
|
virtualinherited |
Reimplemented in G3D::GuiNumberBox< Value >, G3D::GuiNumberBox< float >, G3D::GuiNumberBox< int >, and G3D::GuiFrameBox.
Referenced by G3D::GuiNumberBox< int >::setEnabled().
|
inlineinherited |
|
inherited |
Grab or release keyboard focus.
|
inherited |
|
inherited |
|
inherited |
|
virtualinherited |
If you explicitly change the rectangle of a control, the containing pane may clip its borders.
Call pack() on the containing pane (or window) to resize that container appropriately.
Reimplemented in G3D::GuiNumberBox< Value >, G3D::GuiNumberBox< float >, G3D::GuiNumberBox< int >, G3D::GuiTextureBox, G3D::GuiPane, G3D::GuiTextBox, G3D::GuiDropDownList, G3D::GuiScrollPane, G3D::GuiTabPane, G3D::GuiContainer, G3D::GuiFrameBox, G3D::GuiRadioButton, and G3D::GuiCheckBox.
|
inherited |
Referenced by G3D::GuiPane::addRadioButton().
|
inherited |
void G3D::GuiButton::setUp | ( | ) |
Sets the button as up.
|
inherited |
|
inherited |
|
inherited |
|
inlineoverridevirtual |
Return true if this is in tool button style.
Reimplemented from G3D::GuiControl.
Returns the coordinates of v, which is in the coordinate system of this object, relative to the OSWindow on which it will be rendered.
Referenced by G3D::GuiControl::toOSWindowCoords().
|
inherited |
|
inherited |
Get the window containing this control.
|
friend |
|
friend |
|
protected |
|
protectedinherited |
Referenced by G3D::GuiNumberBox< int >::render().
|
protectedinherited |
|
protectedinherited |
Referenced by G3D::GuiNumberBox< int >::setRect().
|
protectedinherited |
|
protected |
Is the mouse currently down over this control?
|
protectedinherited |
|
protectedinherited |
Sent events should appear to be from this object, which is usually "this".
Other controls can set the event source to create compound controls that seem atomic from the outside.
Referenced by G3D::GuiSlider< int >::GuiSlider(), G3D::GuiNumberBox< Value >::MyTextBox::MyTextBox(), and G3D::GuiControl::setEventSource().
|
protectedinherited |
The window that ultimately contains this control.
|
protectedinherited |
Parent pane.
|
protectedinherited |
Rect bounds used for rendering and layout.
Relative to the enclosing pane's clientRect.
Referenced by G3D::GuiControl::findControlUnderMouse(), G3D::GuiNumberBox< int >::render(), G3D::GuiNumberBox< int >::setCaption(), and G3D::GuiNumberBox< int >::setRect().
|
protected |
Referenced by toolStyle().
|
protectedinherited |