Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
Antares::Component::Button Class Referencefinal
Inheritance diagram for Antares::Component::Button:
Antares::Component::Panel

Public Types

enum  ClickBehavior { clkDefault , clkDropdown , clkMenu }
 
using OnClick = Yuni::Bind<void(void*)>
 Event: User click.
 
using OnPopupMenu = Yuni::Bind<void(Button&, wxMenu&, void*)>
 Event: Popup menu.
 
using Vector = std::vector<Button*>
 Vector.
 

Public Member Functions

Constructor & Destructor
 Button (wxWindow *parent, const wxString &caption)
 Constructor.
 
 Button (wxWindow *parent, const wxString &caption, const char *bitmap)
 Constructor.
 
 Button (wxWindow *parent, const wxString &caption, const char *bitmap, const OnClick &onclick)
 Constructor, with a callback.
 
template<class T >
 Button (wxWindow *parent, const wxString &caption, const char *bitmap, T *object, void(T::*method)(void *))
 Constructor, with a callback.
 
virtual ~Button ()
 Destructor.
 
Caption
const wxString & caption () const
 Get the caption of the button.
 
void caption (const wxString &rhs)
 Set the caption of the button.
 
void caption (const wxChar *rhs)
 
Image
void image (const char *filename)
 Set the image filename.
 
Enabled
bool enabled () const
 Get if the button is enabled.
 
void enabled (bool value)
 Set if the button is enabled.
 
User-data
void * userdata () const
 Get the user-data.
 
void userdata (void *v)
 Set the user-data.
 
Drop down
bool dropDown () const
 Get if the button has a drop down menu.
 
void dropDown (bool rhs)
 Set if the button has a drop down menu.
 
Menu
bool menu () const
 Get if a click on the button will produce a menu.
 
void menu (bool rhs)
 Set if a click on the button should produce a menu.
 
Toggle
bool pushed () const
 Get if the button is pushed.
 
void pushed (bool v)
 Set if the button is pushed.
 
bool autoToggle () const
 Get if the button is in auto-toggle mode.
 
void autoToggle (bool v)
 Set if the button is in auto-toggle mode.
 
void pushedColor (uint r, uint g, uint b)
 Set the pushed color.
 
void pushedColor (const wxColour &color)
 
void pushedColor (const wxWindow *wnd)
 
Bold
bool bold () const
 Get if the font should be bold.
 
void bold (bool value)
 Set the font weight.
 
- Public Member Functions inherited from Antares::Component::Panel
 Panel (wxWindow *parent)
 Constructor.
 
virtual ~Panel ()
 Destructor.
 
virtual void onMouseDown (wxMouseEvent &)
 Click down.
 
virtual void onMouseMoved (int, int)
 The mouse has moved.
 

Hover

void hover (bool value)
 Determine whether a selection should appear when the mouse is over the component.
 
bool hover () const
 
template<class T >
void onPopupMenu (const T *object, void(T::*method)(Button &, wxMenu &, void *))
 Set the handler for creating the popup menu.
 
void onPopupMenu (const OnPopupMenu &popup)
 Set the handler for creating the popup menu.
 
template<class T >
void onClick (const T *object, void(T::*method)(void *))
 Set the onClick event.
 
void disconnectClickEvent ()
 Disconnect the onClick event.
 
virtual void onMouseClick () override
 The panel has been clicked (delayed)
 
virtual void onMouseEnter () override
 The mouse has entered.
 
virtual void onMouseLeave () override
 The mouse has leaved.
 
virtual void onMouseUp (wxMouseEvent &evt) override
 Click up.
 
void loadIconFromResource (const char *filename)
 Preload the Icon.
 
void precalculateCoordinates ()
 Pre-calculate all coordinates.
 
void internalClick ()
 internal click
 
void onDraw (wxPaintEvent &evt)
 Event: draw the panel.
 
void onEraseBackground (wxEraseEvent &)
 UI: Erase background, empty to avoid flickering.
 
virtual bool triggerMouseClickEvent () const override
 Tells to Component::Panel to not trigger its own mouse click event.
 

Additional Inherited Members

- Static Public Member Functions inherited from Antares::Component::Panel
static void OnMouseMoveFromExternalComponent ()
 Event triggered by any other component (not derived from Panel)
 
- Protected Member Functions inherited from Antares::Component::Panel

Member Function Documentation

◆ onMouseClick()

void Antares::Component::Button::onMouseClick ( )
overridevirtual

The panel has been clicked (delayed)

Reimplemented from Antares::Component::Panel.

◆ onMouseEnter()

void Antares::Component::Button::onMouseEnter ( )
overridevirtual

The mouse has entered.

Reimplemented from Antares::Component::Panel.

◆ onMouseLeave()

void Antares::Component::Button::onMouseLeave ( )
overridevirtual

The mouse has leaved.

Reimplemented from Antares::Component::Panel.

◆ onMouseUp()

void Antares::Component::Button::onMouseUp ( wxMouseEvent & evt)
overridevirtual

Click up.

Reimplemented from Antares::Component::Panel.

◆ triggerMouseClickEvent()

virtual bool Antares::Component::Button::triggerMouseClickEvent ( ) const
inlineoverrideprotectedvirtual

Tells to Component::Panel to not trigger its own mouse click event.

Reimplemented from Antares::Component::Panel.


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