Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members

Button widget. More...

#include <button.h>

Inheritance diagram for Button:

Public Member Functions

 Button ()
 Default constructor.
 
 Button (const std::string &caption, const std::string &actionEventId, gcn::ActionListener *listener)
 Constructor, sets the caption of the button to the given string and adds the given action listener.
 
 ~Button () override
 
void draw (gcn::Graphics *graphics) override
 Draws the button.
 
void adjustSize ()
 
void setCaption (const std::string &caption)
 
bool setButtonIcon (const std::string &iconFile)
 Set the icons available next to the text.
 
void setButtonPopupText (const std::string &text)
 Set the button popup text when hovering it for a few seconds.
 
void mouseMoved (gcn::MouseEvent &event) override
 
void mouseExited (gcn::MouseEvent &event) override
 

Private Member Functions

void init ()
 
void removeButtonIcon ()
 

Private Attributes

std::vector< std::unique_ptr< Image > > mButtonIcon
 Button Icons graphics.
 
std::string mPopupText
 the current button text
 

Static Private Attributes

static TextPopupmTextPopup = nullptr
 The buttons popup.
 

Detailed Description

Button widget.

Same as the Guichan button but with custom look.

Definition at line 37 of file button.h.

Constructor & Destructor Documentation

◆ Button() [1/2]

Button::Button ( )

Default constructor.

Definition at line 45 of file button.cpp.

◆ Button() [2/2]

Button::Button ( const std::string &  caption,
const std::string &  actionEventId,
gcn::ActionListener *  listener 
)

Constructor, sets the caption of the button to the given string and adds the given action listener.

Definition at line 51 of file button.cpp.

◆ ~Button()

Button::~Button ( )
overridedefault

Member Function Documentation

◆ adjustSize()

void Button::adjustSize ( )

Definition at line 207 of file button.cpp.

◆ draw()

void Button::draw ( gcn::Graphics *  graphics)
override

Draws the button.

Definition at line 121 of file button.cpp.

◆ init()

void Button::init ( )
private

Definition at line 109 of file button.cpp.

◆ mouseExited()

void Button::mouseExited ( gcn::MouseEvent &  event)
override

Definition at line 255 of file button.cpp.

◆ mouseMoved()

void Button::mouseMoved ( gcn::MouseEvent &  event)
override

Definition at line 232 of file button.cpp.

◆ removeButtonIcon()

void Button::removeButtonIcon ( )
private

Definition at line 100 of file button.cpp.

◆ setButtonIcon()

bool Button::setButtonIcon ( const std::string &  iconFile)

Set the icons available next to the text.

Note
: The image given must be formatted to give horizontally frames of the given width and height for the following states: Standard, Highlighted, Pressed, and Disabled. If the image is too short, the missing states won't be loaded.

Definition at line 66 of file button.cpp.

◆ setButtonPopupText()

void Button::setButtonPopupText ( const std::string &  text)
inline

Set the button popup text when hovering it for a few seconds.

Note
: An empty text will disable the popup.

Definition at line 78 of file button.h.

◆ setCaption()

void Button::setCaption ( const std::string &  caption)

Definition at line 226 of file button.cpp.

Member Data Documentation

◆ mButtonIcon

std::vector<std::unique_ptr<Image> > Button::mButtonIcon
private

Button Icons graphics.

Definition at line 89 of file button.h.

◆ mPopupText

std::string Button::mPopupText
private

the current button text

Definition at line 96 of file button.h.

◆ mTextPopup

TextPopup * Button::mTextPopup = nullptr
staticprivate

The buttons popup.

Note
: This is a global object. One for all the buttons.

Definition at line 95 of file button.h.


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