A bar where the brush is drawn. More...
#include <brush_bar.hpp>


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_specs & | size_specs_ |
| display & | gui_ |
| unsigned int | selected_ |
| std::vector< brush > & | brushes_ |
| brush ** | the_brush_ |
| const size_t | size_ |
A bar where the brush is drawn.
Definition at line 31 of file brush_bar.hpp.
| 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().

| 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().


| void editor::brush_bar::draw | ( | bool | force = false |
) |
Draw the palette.
If force is true, everything will be redrawn, even though it is not dirty.
Definition at line 92 of file brush_bar.cpp.
References surface::assign(), editor::size_specs::brush_padding, editor::size_specs::brush_y, brushes_, gui2::create_rect(), gui::widget::dirty(), draw_rectangle(), ERR_ED, image::get_image(), CVideo::getSurface(), gui_, gui::widget::location(), scale_surface(), resources::screen, sdl_blit(), selected_brush_size(), gui::widget::set_dirty(), size_, size_specs_, update_rect(), and display::video().

| 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().

| 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().


| 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().

| 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().

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().
display& editor::brush_bar::gui_ [private] |
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().
const size_specs& editor::brush_bar::size_specs_ [private] |
Definition at line 65 of file brush_bar.hpp.
Referenced by adjust_size(), draw(), and selected_index().
brush** editor::brush_bar::the_brush_ [private] |
Definition at line 69 of file brush_bar.hpp.
Referenced by left_mouse_click().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:20:04 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |