The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
editor::location_palette Class Reference

#include <location_palette.hpp>

Inheritance diagram for editor::location_palette:
Inheritance graph

Public Member Functions

 location_palette (editor_display &gui, const config &, mouse_action **active_mouse_action)
 
virtual sdl_handler_vector handler_members ()
 
void set_start_item (size_t index)
 
size_t start_num (void)
 
void expand_palette_groups_menu (std::vector< std::pair< std::string, std::string > > &) override
 Menu expanding for palette group list. More...
 
void expand_palette_groups_menu (std::vector< std::string > &) override
 Menu expanding for palette group list. More...
 
virtual void set_group (size_t) override
 
virtual void next_group () override
 
virtual void prev_group () override
 
virtual const std::vector
< item_group > & 
get_groups () const override
 
virtual void draw ()
 
virtual void draw_contents ()
 
void adjust_size (const SDL_Rect &target)
 Update the size of this widget. More...
 
virtual bool scroll_up ()
 Scroll the editor-palette up one step if possible. More...
 
virtual bool can_scroll_up ()
 
virtual bool scroll_down ()
 Scroll the editor-palette down one step if possible. More...
 
virtual bool can_scroll_down ()
 
void swap () override
 
bool can_swap ()
 
virtual std::string get_help_string ()
 
const std::stringselected_item () const
 Return the currently selected item. More...
 
virtual void select_item (const std::string &item_id)
 
virtual std::vector< std::stringaction_pressed () const override
 
void add_item (const std::string &id)
 
 ~location_palette ()
 
void hide (bool hidden) override
 
- Public Member Functions inherited from editor::common_palette
 common_palette (display &gui)
 
virtual ~common_palette ()
 
virtual bool supports_swap ()
 
- Public Member Functions inherited from gui::widget
SDL_Rect const & location () const
 
virtual void set_location (SDL_Rect const &rect)
 
void set_location (int x, int y)
 
void set_width (int w)
 
void set_height (int h)
 
void set_measurements (int w, int h)
 
int width () const
 
int height () const
 
bool focus (const SDL_Event *event)
 
void set_focus (bool focus)
 
bool hidden () const
 
virtual void enable (bool new_val=true)
 
bool enabled () const
 
void set_clip_rect (const SDL_Rect &rect)
 
void set_volatile (bool val=true)
 
void set_dirty (bool dirty=true)
 
bool dirty () const
 
const std::stringid () const
 
void set_id (const std::string &id)
 
void set_help_string (const std::string &str)
 
void set_tooltip_string (const std::string &str)
 
virtual void process_help_string (int mousex, int mousey)
 
virtual void process_tooltip_string (int mousex, int mousey)
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 

Protected Attributes

editor_displaygui_
 
int item_size_
 
int item_space_
 
int items_start_
 
- Protected Attributes inherited from gui::widget
bool focus_
 

Private Member Functions

void scroll_top ()
 Scroll the editor-palette to the top. More...
 
void scroll_bottom ()
 Scroll the editor-palette to the bottom. More...
 
virtual bool is_selected_item (const std::string &id)
 
int num_items ()
 Return the number of items in the palette. More...
 
int num_visible_items ()
 Return the maximum number of items shown at the same time. More...
 

Private Attributes

unsigned int palette_y_
 
unsigned int palette_x_
 
std::string selected_item_
 
std::vector< std::stringitems_
 
mouse_action ** active_mouse_action_
 
boost::ptr_vector
< location_palette_item
buttons_
 
std::unique_ptr
< location_palette_button
button_add_
 
std::unique_ptr
< location_palette_button
button_delete_
 
std::unique_ptr
< location_palette_button
button_goto_
 
int help_handle_
 
editor_displaydisp_
 

Additional Inherited Members

- Protected Member Functions inherited from gui::widget
 widget (widget const &o)
 
 widget (CVideo &video, const bool auto_join=true)
 
virtual ~widget ()
 
void bg_register (SDL_Rect const &rect)
 
void bg_restore () const
 
void bg_restore (SDL_Rect const &rect) const
 
void bg_update ()
 
void bg_cancel ()
 
CVideovideo () const
 
virtual void update_location (SDL_Rect const &rect)
 
const SDL_Rect * clip_rect () const
 
virtual sdl_handler_vector member_handlers ()
 
virtual void handle_event (SDL_Event const &)
 
virtual void handle_window_event (SDL_Event const &event)
 
bool mouse_locked () const
 
void aquire_mouse_lock ()
 
void free_mouse_lock ()
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 

Detailed Description

Definition at line 26 of file location_palette.hpp.

Constructor & Destructor Documentation

editor::location_palette::location_palette ( editor_display gui,
const config ,
mouse_action **  active_mouse_action 
)

Definition at line 153 of file location_palette.cpp.

References i, items_, and selected_item_.

editor::location_palette::~location_palette ( )

Definition at line 371 of file location_palette.cpp.

Member Function Documentation

std::vector< std::string > editor::location_palette::action_pressed ( ) const
overridevirtual

Reimplemented from editor::common_palette.

Definition at line 362 of file location_palette.cpp.

References button_delete_.

void editor::location_palette::add_item ( const std::string id)
void editor::location_palette::adjust_size ( const SDL_Rect &  target)
virtual
bool editor::location_palette::can_scroll_down ( )
virtual

Implements editor::common_palette.

Definition at line 218 of file location_palette.cpp.

References items_start_, num_items(), and num_visible_items().

bool editor::location_palette::can_scroll_up ( )
virtual

Implements editor::common_palette.

Definition at line 213 of file location_palette.cpp.

References items_start_.

bool editor::location_palette::can_swap ( )
inline

Definition at line 66 of file location_palette.hpp.

virtual void editor::location_palette::draw ( )
inlinevirtual

Implements editor::common_palette.

Definition at line 48 of file location_palette.hpp.

References cursor::draw().

Referenced by scroll_down(), and scroll_up().

void editor::location_palette::draw_contents ( )
virtual
void editor::location_palette::expand_palette_groups_menu ( std::vector< std::pair< std::string, std::string > > &  )
inlineoverridevirtual

Menu expanding for palette group list.

Implements editor::common_palette.

Definition at line 40 of file location_palette.hpp.

void editor::location_palette::expand_palette_groups_menu ( std::vector< std::string > &  items)
inlineoverridevirtual

Menu expanding for palette group list.

Implements editor::common_palette.

Definition at line 41 of file location_palette.hpp.

virtual const std::vector<item_group>& editor::location_palette::get_groups ( ) const
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 46 of file location_palette.hpp.

virtual std::string editor::location_palette::get_help_string ( )
inlinevirtual

Definition at line 68 of file location_palette.hpp.

Referenced by adjust_size(), hide(), and select_item().

sdl_handler_vector editor::location_palette::handler_members ( )
virtual

Reimplemented from editor::common_palette.

Definition at line 178 of file location_palette.cpp.

References button_add_, button_delete_, button_goto_, buttons_, and h.

Referenced by hide().

void editor::location_palette::hide ( bool  hidden)
overridevirtual
bool editor::location_palette::is_selected_item ( const std::string id)
privatevirtual

Definition at line 298 of file location_palette.cpp.

References gui::widget::id(), and selected_item_.

Referenced by draw_contents().

virtual void editor::location_palette::next_group ( )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 44 of file location_palette.hpp.

int editor::location_palette::num_items ( )
privatevirtual

Return the number of items in the palette.

Implements editor::common_palette.

Definition at line 289 of file location_palette.cpp.

References items_.

Referenced by can_scroll_down(), draw_contents(), and scroll_down().

int editor::location_palette::num_visible_items ( )
private

Return the maximum number of items shown at the same time.

Definition at line 293 of file location_palette.cpp.

References buttons_.

Referenced by add_item(), adjust_size(), can_scroll_down(), draw_contents(), and scroll_down().

virtual void editor::location_palette::prev_group ( )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 45 of file location_palette.hpp.

void editor::location_palette::scroll_bottom ( )
private

Scroll the editor-palette to the bottom.

bool editor::location_palette::scroll_down ( )
virtual

Scroll the editor-palette down one step if possible.

Implements editor::common_palette.

Definition at line 223 of file location_palette.cpp.

References draw(), items_start_, num_items(), num_visible_items(), and gui::widget::set_dirty().

void editor::location_palette::scroll_top ( )
private

Scroll the editor-palette to the top.

bool editor::location_palette::scroll_up ( )
virtual

Scroll the editor-palette up one step if possible.

Implements editor::common_palette.

Definition at line 203 of file location_palette.cpp.

References draw(), and items_start_.

void editor::location_palette::select_item ( const std::string item_id)
virtual
const std::string& editor::location_palette::selected_item ( ) const
inline

Return the currently selected item.

Definition at line 71 of file location_palette.hpp.

References selected_item_.

Referenced by editor::editor_controller::execute_command(), and editor::mouse_action_starting_position::up_left().

virtual void editor::location_palette::set_group ( size_t  )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 43 of file location_palette.hpp.

void editor::location_palette::set_start_item ( size_t  index)
inlinevirtual

Implements editor::common_palette.

Definition at line 35 of file location_palette.hpp.

References items_start_.

size_t editor::location_palette::start_num ( void  )
inlinevirtual

Implements editor::common_palette.

Definition at line 37 of file location_palette.hpp.

References items_start_.

void editor::location_palette::swap ( )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 65 of file location_palette.hpp.

Member Data Documentation

mouse_action** editor::location_palette::active_mouse_action_
private

Definition at line 112 of file location_palette.hpp.

Referenced by draw_contents().

std::unique_ptr<location_palette_button> editor::location_palette::button_add_
private

Definition at line 114 of file location_palette.hpp.

Referenced by adjust_size(), draw_contents(), and handler_members().

std::unique_ptr<location_palette_button> editor::location_palette::button_delete_
private

Definition at line 115 of file location_palette.hpp.

Referenced by action_pressed(), adjust_size(), draw_contents(), and handler_members().

std::unique_ptr<location_palette_button> editor::location_palette::button_goto_
private

Definition at line 116 of file location_palette.hpp.

Referenced by adjust_size(), draw_contents(), and handler_members().

boost::ptr_vector<location_palette_item> editor::location_palette::buttons_
private
editor_display& editor::location_palette::disp_
private

Definition at line 118 of file location_palette.hpp.

Referenced by adjust_size().

editor_display& editor::location_palette::gui_
protected

Definition at line 95 of file location_palette.hpp.

Referenced by adjust_size(), draw_contents(), hide(), and select_item().

int editor::location_palette::help_handle_
private

Definition at line 117 of file location_palette.hpp.

Referenced by adjust_size(), hide(), and select_item().

int editor::location_palette::item_size_
protected

Definition at line 97 of file location_palette.hpp.

Referenced by draw_contents().

int editor::location_palette::item_space_
protected

Definition at line 99 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

std::vector<std::string> editor::location_palette::items_
private

Definition at line 111 of file location_palette.hpp.

Referenced by add_item(), draw_contents(), location_palette(), and num_items().

int editor::location_palette::items_start_
protected
unsigned int editor::location_palette::palette_x_
private

Definition at line 103 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

unsigned int editor::location_palette::palette_y_
private

Definition at line 102 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

std::string editor::location_palette::selected_item_
private

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