zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Zeni::Widget_Button Class Reference

A Button Widget. More...

#include <Widget.h>

Inherits Zeni::Widget, and Zeni::Widget_Rectangle.

Inherited by Zeni::Check_Box, Zeni::Text_Box, and Zeni::Text_Button.

Public Types

enum  State {
  NORMAL, CLICKED, HOVERED, STRAYED,
  UNACTIONABLE
}
 

Public Member Functions

 Widget_Button (const Point2f &upper_left_, const Point2f &lower_right_)
 
const Stateget_State () const
 Get the State of the button. More...
 
virtual void on_accept ()
 Called when the cursor is released inside the button. More...
 
virtual void on_click ()
 Called when the cursor downclicks the button. More...
 
virtual void on_hover ()
 Called when the cursor passes over the button. More...
 
virtual void on_mouse_button (const Point2i &pos, const bool &down, const int &button)
 
virtual void on_mouse_motion (const Point2i &pos)
 
virtual void on_reject ()
 Called when the cursor is released outside the button. More...
 
virtual void on_stray ()
 Called when the cursor is dragged off the button after being clicked. More...
 
virtual void on_unhover ()
 Called when the cursor leaves the button without clicking. More...
 
virtual void on_unstray ()
 Called when the cursor is dragged back onto the button without releasing the clicker. More...
 
- Public Member Functions inherited from Zeni::Widget
 Widget ()
 
virtual ~Widget ()
 
void fax_Renderer (const Widget_Render_Function *const &renderer)
 Set the current Widget_Render_Function, giving the Widget a copy. More...
 
const float & get_layer () const
 
const Widget_Render_Functionget_Renderer () const
 Get the current Widget_Render_Function. More...
 
void give_Renderer (Widget_Render_Function *const &renderer)
 Set the current Widget_Render_Function, giving the Widget ownership. More...
 
const bool & is_busy () const
 
const bool & is_editable () const
 
void lend_Renderer (const Widget_Render_Function *const &renderer)
 Set the current Widget_Render_Function, giving the Widget no ownership. More...
 
void on_event (const SDL_KeyboardEvent &event)
 
void on_event (const SDL_MouseButtonEvent &event)
 
void on_event (const SDL_MouseButtonEvent &event, const Projector2D &projector)
 
void on_event (const SDL_MouseMotionEvent &event)
 
void on_event (const SDL_MouseMotionEvent &event, const Projector2D &projector)
 
virtual void on_key (const SDL_Keysym &, const bool &)
 
virtual void perform_logic ()
 
void render () const
 
virtual void render_impl () const
 
void set_busy (const bool &busy_)
 
virtual void set_editable (const bool &editable_)
 
void set_layer (const float &layer_=0.0f)
 
- Public Member Functions inherited from Zeni::Widget_Rectangle
 Widget_Rectangle (const Point2f &upper_left_, const Point2f &lower_right_)
 
virtual ~Widget_Rectangle ()
 
Point2f get_center () const
 
float get_height () const
 
Point2f get_lower_left () const
 
const Point2fget_lower_right () const
 
const Point2fget_upper_left () const
 
Point2f get_upper_right () const
 
float get_width () const
 
bool is_inside (const Point2i &pos) const
 
virtual void set_lower_right (const Point2f &lower_right_)
 
virtual void set_upper_left (const Point2f &upper_left_)
 

Detailed Description

A Button Widget.

Any simple click-button should inherit from this class.

Author
bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 454 of file Widget.h.

Member Enumeration Documentation

Enumerator
NORMAL 
CLICKED 
HOVERED 
STRAYED 
UNACTIONABLE 

Definition at line 459 of file Widget.h.

Constructor & Destructor Documentation

Zeni::Widget_Button::Widget_Button ( const Point2f upper_left_,
const Point2f lower_right_ 
)
inline

Definition at line 321 of file Widget.hxx.

Member Function Documentation

const Widget_Button::State & Zeni::Widget_Button::get_State ( ) const
inline

Get the State of the button.

Definition at line 327 of file Widget.hxx.

Referenced by Zeni::Widget_Renderer_Tricolor::render_to().

virtual void Zeni::Widget_Button::on_click ( )
inlinevirtual

Called when the cursor downclicks the button.

Reimplemented in Zeni::Check_Box.

Definition at line 477 of file Widget.h.

Referenced by on_mouse_button().

virtual void Zeni::Widget_Button::on_hover ( )
inlinevirtual

Called when the cursor passes over the button.

Definition at line 472 of file Widget.h.

Referenced by on_mouse_motion().

void Zeni::Widget_Button::on_mouse_button ( const Point2i pos,
const bool &  down,
const int button 
)
virtual
void Zeni::Widget_Button::on_mouse_motion ( const Point2i pos)
virtual
virtual void Zeni::Widget_Button::on_reject ( )
inlinevirtual

Called when the cursor is released outside the button.

Reimplemented in Zeni::Check_Box.

Definition at line 486 of file Widget.h.

Referenced by on_mouse_button().

virtual void Zeni::Widget_Button::on_stray ( )
inlinevirtual

Called when the cursor is dragged off the button after being clicked.

Reimplemented in Zeni::Check_Box.

Definition at line 479 of file Widget.h.

Referenced by on_mouse_motion().

virtual void Zeni::Widget_Button::on_unhover ( )
inlinevirtual

Called when the cursor leaves the button without clicking.

Definition at line 474 of file Widget.h.

Referenced by on_mouse_motion().

virtual void Zeni::Widget_Button::on_unstray ( )
inlinevirtual

Called when the cursor is dragged back onto the button without releasing the clicker.

Reimplemented in Zeni::Check_Box.

Definition at line 481 of file Widget.h.

Referenced by on_mouse_motion().


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