Public Member Functions | Private Member Functions | Private Attributes

editor::brush_bar Class Reference

A bar where the brush is drawn. More...

#include <brush_bar.hpp>

Inheritance diagram for editor::brush_bar:
Inheritance graph
[legend]
Collaboration diagram for editor::brush_bar:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 brush_bar (display &gui, const size_specs &sizes, std::vector< brush > &brushes, brush **the_brush)
unsigned int selected_brush_size ()
 Return the size of currently selected brush.
void draw (bool force=false)
 Draw the palette.
virtual void draw ()
virtual void handle_event (const SDL_Event &event)
void adjust_size ()
 Update the size of this widget.

Private Member Functions

void left_mouse_click (const int mousex, const int mousey)
 To be called when a mouse click occurs.
int selected_index (const int x, const int y) const
 Return the index of the brush that is at coordinates (x, y) in the panel.

Private Attributes

const size_specssize_specs_
displaygui_
unsigned int selected_
std::vector< brush > & brushes_
brush ** the_brush_
const size_t size_

Detailed Description

A bar where the brush is drawn.

Definition at line 31 of file brush_bar.hpp.


Constructor & Destructor Documentation

editor::brush_bar::brush_bar ( display gui,
const size_specs sizes,
std::vector< brush > &  brushes,
brush **  the_brush 
)

Definition at line 30 of file brush_bar.cpp.

References adjust_size().

Here is the call graph for this function:


Member Function Documentation

void editor::brush_bar::adjust_size (  ) 

Update the size of this widget.

Use if the size_specs have changed.

Definition at line 38 of file brush_bar.cpp.

References editor::size_specs::brush_padding, editor::size_specs::brush_x, editor::size_specs::brush_y, brushes_, gui::widget::set_dirty(), gui::widget::set_location(), gui::widget::set_measurements(), size_, and size_specs_.

Referenced by brush_bar().

Here is the call graph for this function:

Here is the caller graph for this function:

void editor::brush_bar::draw ( bool  force = false  ) 
void editor::brush_bar::draw (  )  [virtual]

Reimplemented from gui::widget.

Definition at line 88 of file brush_bar.cpp.

void editor::brush_bar::handle_event ( const SDL_Event &  event  )  [virtual]

Reimplemented from gui::widget.

Definition at line 60 of file brush_bar.cpp.

References gui::widget::focus(), left_mouse_click(), point_in_rect(), and gui::widget::set_focus().

Here is the call graph for this function:

void editor::brush_bar::left_mouse_click ( const int  mousex,
const int  mousey 
) [private]

To be called when a mouse click occurs.

Check if the coordinates is a terrain that may be chosen, and select the terrain if that is the case.

Definition at line 48 of file brush_bar.cpp.

References brushes_, game_config::sounds::button_press, sound::play_UI_sound(), selected_, selected_index(), gui::widget::set_dirty(), and the_brush_.

Referenced by handle_event().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int editor::brush_bar::selected_brush_size (  ) 

Return the size of currently selected brush.

Definition at line 44 of file brush_bar.cpp.

References selected_.

Referenced by draw().

Here is the caller graph for this function:

int editor::brush_bar::selected_index ( const int  x,
const int  y 
) const [private]

Return the index of the brush that is at coordinates (x, y) in the panel.

Definition at line 126 of file brush_bar.cpp.

References editor::size_specs::brush_padding, editor::size_specs::brush_x, editor::size_specs::brush_y, brushes_, size_, and size_specs_.

Referenced by left_mouse_click().

Here is the caller graph for this function:


Member Data Documentation

std::vector<brush>& editor::brush_bar::brushes_ [private]

Definition at line 68 of file brush_bar.hpp.

Referenced by adjust_size(), draw(), left_mouse_click(), and selected_index().

Definition at line 66 of file brush_bar.hpp.

Referenced by draw().

unsigned int editor::brush_bar::selected_ [private]

Definition at line 67 of file brush_bar.hpp.

Referenced by left_mouse_click(), and selected_brush_size().

const size_t editor::brush_bar::size_ [private]

Definition at line 70 of file brush_bar.hpp.

Referenced by adjust_size(), draw(), and selected_index().

Definition at line 65 of file brush_bar.hpp.

Referenced by adjust_size(), draw(), and selected_index().

Definition at line 69 of file brush_bar.hpp.

Referenced by left_mouse_click().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:20:04 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs