gui::button Class Reference

#include <button.hpp>

Inheritance diagram for gui::button:

Inheritance graph
[legend]
Collaboration diagram for gui::button:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TYPE { TYPE_PRESS, TYPE_CHECK, TYPE_TURBO, TYPE_IMAGE }
enum  SPACE_CONSUMPTION { DEFAULT_SPACE, MINIMUM_SPACE }

Public Member Functions

 button (CVideo &video, const std::string &label, TYPE type=TYPE_PRESS, std::string button_image="", SPACE_CONSUMPTION spacing=DEFAULT_SPACE, const bool auto_join=true)
virtual ~button ()
void set_check (bool check)
bool checked () const
void set_label (const std::string &val)
bool pressed ()
bool hit (int x, int y) const
virtual void enable (bool new_val=true)
void release ()

Protected Member Functions

virtual void handle_event (const SDL_Event &event)
virtual void mouse_motion (const SDL_MouseMotionEvent &event)
virtual void mouse_down (const SDL_MouseButtonEvent &event)
virtual void mouse_up (const SDL_MouseButtonEvent &event)
virtual void draw_contents ()

Protected Attributes

TYPE type_

Private Types

enum  STATE {
  UNINIT, NORMAL, ACTIVE, PRESSED,
  PRESSED_ACTIVE
}

Private Member Functions

void calculate_size ()

Private Attributes

std::string label_
surface image_
surface pressedImage_
surface activeImage_
surface pressedActiveImage_
SDL_Rect textRect_
bool button_
STATE state_
bool pressed_
SPACE_CONSUMPTION spacing_
int base_height_
int base_width_

Classes

struct  error


Detailed Description

Definition at line 29 of file widgets/button.hpp.


Member Enumeration Documentation

Enumerator:
TYPE_PRESS 
TYPE_CHECK 
TYPE_TURBO 
TYPE_IMAGE 

Definition at line 34 of file widgets/button.hpp.

Enumerator:
DEFAULT_SPACE 
MINIMUM_SPACE 

Definition at line 36 of file widgets/button.hpp.

enum gui::button::STATE [private]

Enumerator:
UNINIT 
NORMAL 
ACTIVE 
PRESSED 
PRESSED_ACTIVE 

Definition at line 72 of file widgets/button.hpp.


Constructor & Destructor Documentation

gui::button::button ( CVideo video,
const std::string &  label,
button::TYPE  type = TYPE_PRESS,
std::string  button_image = "",
SPACE_CONSUMPTION  spacing = DEFAULT_SPACE,
const bool  auto_join = true 
)

virtual gui::button::~button (  )  [inline, virtual]

Definition at line 42 of file widgets/button.hpp.


Member Function Documentation

void gui::button::set_check ( bool  check  ) 

bool gui::button::checked (  )  const

void gui::button::set_label ( const std::string &  val  ) 

bool gui::button::pressed (  ) 

bool gui::button::hit ( int  x,
int  y 
) const

Definition at line 233 of file widgets/button.cpp.

References gui::widget::location(), and point_in_rect().

Referenced by mouse_down(), mouse_motion(), and mouse_up().

void gui::button::enable ( bool  new_val = true  )  [virtual]

void gui::button::release (  ) 

void gui::button::handle_event ( const SDL_Event &  event  )  [protected, virtual]

void gui::button::mouse_motion ( const SDL_MouseMotionEvent &  event  )  [protected, virtual]

Definition at line 258 of file widgets/button.cpp.

References ACTIVE, hit(), NORMAL, PRESSED, PRESSED_ACTIVE, state_, type_, TYPE_CHECK, and TYPE_IMAGE.

Referenced by handle_event().

void gui::button::mouse_down ( const SDL_MouseButtonEvent &  event  )  [protected, virtual]

void gui::button::mouse_up ( const SDL_MouseButtonEvent &  event  )  [protected, virtual]

void gui::button::draw_contents (  )  [protected, virtual]

void gui::button::calculate_size (  )  [private]


Member Data Documentation

TYPE gui::button::type_ [protected]

std::string gui::button::label_ [private]

Definition at line 66 of file widgets/button.hpp.

Referenced by calculate_size(), draw_contents(), and set_label().

Definition at line 67 of file widgets/button.hpp.

Referenced by button(), calculate_size(), and draw_contents().

Definition at line 67 of file widgets/button.hpp.

Referenced by button(), and draw_contents().

Definition at line 67 of file widgets/button.hpp.

Referenced by button(), and draw_contents().

Definition at line 67 of file widgets/button.hpp.

Referenced by button(), and draw_contents().

SDL_Rect gui::button::textRect_ [private]

Definition at line 68 of file widgets/button.hpp.

Referenced by calculate_size(), and draw_contents().

bool gui::button::button_ [private]

Definition at line 70 of file widgets/button.hpp.

bool gui::button::pressed_ [private]

Definition at line 75 of file widgets/button.hpp.

Referenced by enable(), mouse_up(), and pressed().

Definition at line 77 of file widgets/button.hpp.

Referenced by calculate_size().

Definition at line 79 of file widgets/button.hpp.

Referenced by button(), and calculate_size().

int gui::button::base_width_ [private]

Definition at line 79 of file widgets/button.hpp.

Referenced by button(), and calculate_size().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs