map_editor::brush_bar Class Reference

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

#include <editor_palettes.hpp>

Inheritance diagram for map_editor::brush_bar:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 brush_bar (display &gui, const size_specs &sizes)
unsigned int selected_brush_size ()
 Return the size of currently selected brush.
void select_brush_size (int new_size)
 Select a brush size.
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_
const int total_brush_
const size_t size_


Detailed Description

A bar where the brush is drawn.

Definition at line 150 of file editor_palettes.hpp.


Constructor & Destructor Documentation

map_editor::brush_bar::brush_bar ( display gui,
const size_specs sizes 
)

Definition at line 487 of file editor_palettes.cpp.

References adjust_size().


Member Function Documentation

unsigned int map_editor::brush_bar::selected_brush_size (  ) 

Return the size of currently selected brush.

Definition at line 499 of file editor_palettes.cpp.

References selected_.

Referenced by draw().

void map_editor::brush_bar::select_brush_size ( int  new_size  ) 

Select a brush size.

Definition at line 503 of file editor_palettes.cpp.

References selected_, and total_brush_.

void map_editor::brush_bar::draw ( bool  force = false  ) 

void map_editor::brush_bar::draw (  )  [virtual]

Reimplemented from gui::widget.

Definition at line 546 of file editor_palettes.cpp.

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

Reimplemented from gui::widget.

Definition at line 518 of file editor_palettes.cpp.

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

void map_editor::brush_bar::adjust_size (  ) 

void map_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 508 of file editor_palettes.cpp.

References selected_, selected_index(), and gui::widget::set_dirty().

Referenced by handle_event().

int map_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 588 of file editor_palettes.cpp.

References map_editor::size_specs::brush_padding, map_editor::size_specs::brush_x, map_editor::size_specs::brush_y, size_, size_specs_, and total_brush_.

Referenced by left_mouse_click().


Member Data Documentation

Definition at line 179 of file editor_palettes.hpp.

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

Definition at line 180 of file editor_palettes.hpp.

Referenced by draw().

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

Definition at line 181 of file editor_palettes.hpp.

Referenced by left_mouse_click(), select_brush_size(), and selected_brush_size().

Definition at line 182 of file editor_palettes.hpp.

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

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

Definition at line 183 of file editor_palettes.hpp.

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


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