The Battle for Wesnoth  1.15.2+dev
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 &, editor_toolkit &toolkit)
 
virtual sdl_handler_vector handler_members () override
 
void set_start_item (std::size_t index) override
 
std::size_t start_num (void) override
 
void expand_palette_groups_menu (std::vector< config > &items, int i) override
 Menu expanding for palette group list. More...
 
virtual void set_group (std::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 () override
 
virtual void draw_contents () override
 
void adjust_size (const SDL_Rect &target) override
 Update the size of this widget. More...
 
virtual bool scroll_up () override
 Scroll the editor-palette up one step if possible. More...
 
virtual bool can_scroll_up () override
 
virtual bool scroll_down () override
 Scroll the editor-palette down one step if possible. More...
 
virtual bool can_scroll_down () override
 
void swap () override
 
bool can_swap ()
 
virtual std::string get_help_string ()
 
const std::string & selected_item () const
 Return the currently selected item. More...
 
virtual void select_item (const std::string &item_id)
 
virtual std::vector< std::string > action_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 (CVideo &video)
 
virtual ~common_palette ()
 
virtual bool supports_swap ()
 
- Public Member Functions inherited from gui::widget
const SDL_Rect & location () const
 
virtual void set_location (const SDL_Rect &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::string & id () 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 ()
 
virtual bool has_joined ()
 
virtual bool has_joined_global ()
 
sdl_handleroperator= (sdl_handler &&)=delete
 Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More...
 
 sdl_handler (sdl_handler &&)=delete
 

Protected Attributes

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 () override
 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::string > items_
 
editor_toolkittoolkit_
 
boost::ptr_vector< location_palette_itembuttons_
 
std::unique_ptr< location_palette_buttonbutton_add_
 
std::unique_ptr< location_palette_buttonbutton_delete_
 
std::unique_ptr< location_palette_buttonbutton_goto_
 
int help_handle_
 
editor_displaydisp_
 

Additional Inherited Members

- Protected Member Functions inherited from gui::widget
 widget (CVideo &video, const bool auto_join=true)
 
virtual ~widget ()
 
void bg_register (const SDL_Rect &rect)
 
void bg_restore () const
 
void bg_restore (const SDL_Rect &rect) const
 
void bg_update ()
 
void bg_cancel ()
 
CVideovideo () const
 
virtual void update_location (const SDL_Rect &rect)
 
const SDL_Rect * clip_rect () const
 
virtual sdl_handler_vector member_handlers ()
 
virtual void handle_event (const SDL_Event &)
 
virtual void handle_window_event (const SDL_Event &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)
 
 sdl_handler (const sdl_handler &)
 
sdl_handleroperator= (const sdl_handler &)
 
virtual ~sdl_handler ()
 

Detailed Description

Definition at line 30 of file location_palette.hpp.

Constructor & Destructor Documentation

◆ location_palette()

editor::location_palette::location_palette ( editor_display gui,
const config ,
editor_toolkit toolkit 
)

Definition at line 161 of file location_palette.cpp.

References i, items_, and selected_item_.

◆ ~location_palette()

editor::location_palette::~location_palette ( )

Definition at line 396 of file location_palette.cpp.

Referenced by selected_item().

Member Function Documentation

◆ action_pressed()

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

Reimplemented from editor::common_palette.

Definition at line 387 of file location_palette.cpp.

References button_delete_.

Referenced by selected_item().

◆ add_item()

void editor::location_palette::add_item ( const std::string &  id)

◆ adjust_size()

void editor::location_palette::adjust_size ( const SDL_Rect &  target)
overridevirtual

◆ can_scroll_down()

bool editor::location_palette::can_scroll_down ( )
overridevirtual

Implements editor::common_palette.

Definition at line 228 of file location_palette.cpp.

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

Referenced by draw().

◆ can_scroll_up()

bool editor::location_palette::can_scroll_up ( )
overridevirtual

Implements editor::common_palette.

Definition at line 223 of file location_palette.cpp.

References items_start_.

Referenced by draw().

◆ can_swap()

bool editor::location_palette::can_swap ( )
inline

Definition at line 73 of file location_palette.hpp.

◆ draw()

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

◆ draw_contents()

void editor::location_palette::draw_contents ( )
overridevirtual

◆ expand_palette_groups_menu()

void editor::location_palette::expand_palette_groups_menu ( std::vector< config > &  items,
int  i 
)
inlineoverridevirtual

Menu expanding for palette group list.

Implements editor::common_palette.

Definition at line 45 of file location_palette.hpp.

References i.

◆ get_groups()

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

Implements editor::common_palette.

Definition at line 53 of file location_palette.hpp.

◆ get_help_string()

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

Definition at line 75 of file location_palette.hpp.

Referenced by adjust_size(), and select_item().

◆ handler_members()

sdl_handler_vector editor::location_palette::handler_members ( )
overridevirtual

Reimplemented from editor::common_palette.

Definition at line 186 of file location_palette.cpp.

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

Referenced by hide().

◆ hide()

void editor::location_palette::hide ( bool  hidden)
overridevirtual

◆ is_selected_item()

bool editor::location_palette::is_selected_item ( const std::string &  id)
privatevirtual

Definition at line 325 of file location_palette.cpp.

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

Referenced by draw_contents(), and selected_item().

◆ next_group()

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

Implements editor::common_palette.

Definition at line 51 of file location_palette.hpp.

◆ num_items()

int editor::location_palette::num_items ( )
overrideprivatevirtual

Return the number of items in the palette.

Implements editor::common_palette.

Definition at line 316 of file location_palette.cpp.

References items_.

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

◆ num_visible_items()

int editor::location_palette::num_visible_items ( )
private

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

Definition at line 320 of file location_palette.cpp.

References buttons_.

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

◆ prev_group()

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

Implements editor::common_palette.

Definition at line 52 of file location_palette.hpp.

◆ scroll_bottom()

void editor::location_palette::scroll_bottom ( )
private

Scroll the editor-palette to the bottom.

Referenced by selected_item().

◆ scroll_down()

bool editor::location_palette::scroll_down ( )
overridevirtual

Scroll the editor-palette down one step if possible.

Implements editor::common_palette.

Definition at line 233 of file location_palette.cpp.

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

Referenced by draw().

◆ scroll_top()

void editor::location_palette::scroll_top ( )
private

Scroll the editor-palette to the top.

Referenced by selected_item().

◆ scroll_up()

bool editor::location_palette::scroll_up ( )
overridevirtual

Scroll the editor-palette up one step if possible.

Implements editor::common_palette.

Definition at line 213 of file location_palette.cpp.

References draw(), and items_start_.

Referenced by draw().

◆ select_item()

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

◆ selected_item()

const std::string& editor::location_palette::selected_item ( ) const
inline

◆ set_group()

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

Implements editor::common_palette.

Definition at line 50 of file location_palette.hpp.

◆ set_start_item()

void editor::location_palette::set_start_item ( std::size_t  index)
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 40 of file location_palette.hpp.

References utf8::index(), and items_start_.

◆ start_num()

std::size_t editor::location_palette::start_num ( void  )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 42 of file location_palette.hpp.

References items_start_.

◆ swap()

void editor::location_palette::swap ( )
inlineoverridevirtual

Implements editor::common_palette.

Definition at line 72 of file location_palette.hpp.

Member Data Documentation

◆ button_add_

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

Definition at line 119 of file location_palette.hpp.

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

◆ button_delete_

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

Definition at line 120 of file location_palette.hpp.

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

◆ button_goto_

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

Definition at line 121 of file location_palette.hpp.

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

◆ buttons_

boost::ptr_vector<location_palette_item> editor::location_palette::buttons_
private

◆ disp_

editor_display& editor::location_palette::disp_
private

Definition at line 123 of file location_palette.hpp.

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

◆ help_handle_

int editor::location_palette::help_handle_
private

Definition at line 122 of file location_palette.hpp.

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

◆ item_size_

int editor::location_palette::item_size_
protected

Definition at line 102 of file location_palette.hpp.

Referenced by draw_contents().

◆ item_space_

int editor::location_palette::item_space_
protected

Definition at line 104 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

◆ items_

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

Definition at line 116 of file location_palette.hpp.

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

◆ items_start_

int editor::location_palette::items_start_
protected

◆ palette_x_

unsigned int editor::location_palette::palette_x_
private

Definition at line 108 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

◆ palette_y_

unsigned int editor::location_palette::palette_y_
private

Definition at line 107 of file location_palette.hpp.

Referenced by adjust_size(), and draw_contents().

◆ selected_item_

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

◆ toolkit_

editor_toolkit& editor::location_palette::toolkit_
private

Definition at line 117 of file location_palette.hpp.

Referenced by draw_contents().


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