ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_Button

Button component
Contained in: global
Derived from: CL_Component
Derived by: CL_CheckBox CL_RadioButton
Group: GUI (Controls)

#include <ClanLib/gui.h>


public function member index:

Construction:

CL_Button(CL_Component* parent, CL_StyleManager* style = NULL);
CL_Button(const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);
CL_Button(const CL_Point& pos, const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);
CL_Button(const CL_Rect& pos, const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);
CL_Button(const CL_Point& pos, const std::string& text, CL_Surface* surface_up, CL_Surface* surface_down, CL_Component* parent, CL_StyleManager* style = NULL);
CL_Button(const CL_Point& pos, const std::string& text, CL_Surface* surface_up, CL_Surface* surface_down, CL_Surface* surface_disabled, CL_Surface* surface_highlighted, CL_Component* parent, CL_StyleManager* style = NULL);
virtual ~CL_Button();

Attributes:

const std::string& get_text() const;
bool is_toggle_button() const;
bool is_down() const;
CL_Surface* get_surface_up() const;
CL_Surface* get_surface_down() const;
CL_Surface* get_surface_highlighted() const;
CL_Surface* get_surface_disabled() const;

Operations:

void set_text(const std::string& text);
void set_toggle_mode(bool toggle = true);
void set_down(bool enable = true);
void toggle();
void set_surface_up(CL_Surface* surface);
void set_surface_down(CL_Surface* surface);
void set_surface_highlighted(CL_Surface* surface);
void set_surface_disabled(CL_Surface* surface);

Signals:

CL_Signal_v1<bool>& sig_toggled();
CL_Signal_v0& sig_clicked();
CL_Signal_v0& sig_pressed();
CL_Signal_v0& sig_released();
 

private function member index:

Implementation:

CL_Button(const CL_Button& copy);
 

Description:


Function Member Descriptions:

CL_Button::CL_Button - Button Constructor
CL_Button(CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::CL_Button - Button Constructor
CL_Button(const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::CL_Button - Button Constructor
CL_Button(const CL_Point& pos, const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::CL_Button - Button Constructor
CL_Button(const CL_Rect& pos, const std::string& text, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::CL_Button - Button Constructor
CL_Button(const CL_Point& pos, const std::string& text, CL_Surface* surface_up, CL_Surface* surface_down, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::CL_Button - Button Constructor
CL_Button(const CL_Point& pos, const std::string& text, CL_Surface* surface_up, CL_Surface* surface_down, CL_Surface* surface_disabled, CL_Surface* surface_highlighted, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Button::get_surface_disabled - Returns the surface used when button is disabled.
CL_Surface* get_surface_disabled() const;


CL_Button::get_surface_down - Returns the surface used when button is in the down-state.
CL_Surface* get_surface_down() const;


CL_Button::get_surface_highlighted - Returns the surface used when button is highlighted.
CL_Surface* get_surface_highlighted() const;


CL_Button::get_surface_up - Returns the surface used when button is in the up-state.
CL_Surface* get_surface_up() const;


CL_Button::get_text - Returns the button text.
const std::string& get_text() const;


CL_Button::is_down - Returns true if the button pressed down, or false if it is standing up.
bool is_down() const;


CL_Button::is_toggle_button - Returns true if the button is a toggle button.
bool is_toggle_button() const;


CL_Button::set_down - Sets the state of the button to pressed down if enable is true or to standing up if enable is false.
The pressed(), released() and toggled() signals are not emitted by this function.
void set_down(bool enable = true);


CL_Button::set_surface_disabled - Sets the surface used when button is disabled.
void set_surface_disabled(CL_Surface* surface);


CL_Button::set_surface_down - Set the surface used when button is in the down-state.
void set_surface_down(CL_Surface* surface);


CL_Button::set_surface_highlighted - Sets the surface used when button is highlighted.
void set_surface_highlighted(CL_Surface* surface);


CL_Button::set_surface_up - Sets the surface used when button is in the up-state.
void set_surface_up(CL_Surface* surface);


CL_Button::set_text - Sets the button text.
void set_text(const std::string& text);


CL_Button::set_toggle_mode - If toggle is true, pressing the button toggles it between an On and and Off state.
If toggle is false, pressing the button causes an action, then the button returns to the unpressed state.
void set_toggle_mode(bool toggle = true);


CL_Button::sig_clicked - This signal is emitted when the button is activated (i.e. first pressed down and then released when the mouse cursor is inside the button).
CL_Signal_v0& sig_clicked();


CL_Button::sig_pressed - This signal is emitted when the button is pressed down.
In most cases, you want to use sig_clicked() instead.
CL_Signal_v0& sig_pressed();


CL_Button::sig_released - This signal is emitted when the button is released.
CL_Signal_v0& sig_released();


CL_Button::sig_toggled - This signal is emitted whenever a toggle button changes status.
CL_Signal_v1<bool>& sig_toggled();
bool on - Is true if the button is on, or false otherwise.



CL_Button::toggle - Toggle the button.
The toggled() signal are emitted by this function.
void toggle();


CL_Button::~CL_Button - Button Destructor
virtual ~CL_Button();



Variable Member Descriptions: