#include <editor_palettes.hpp>
Public Member Functions | |
editor_palette (editor_display &gui, const config &, size_t item_size, size_t item_width, 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 > > &items) |
Menu expanding for palette group list. More... | |
void | expand_palette_groups_menu (std::vector< std::string > &items) |
Menu expanding for palette group list. More... | |
void | set_group (size_t index) |
const std::vector< item_group > & | get_groups () const |
virtual void | draw () |
virtual void | draw_contents () |
void | next_group () |
void | prev_group () |
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 () |
virtual std::string | get_help_string ()=0 |
const Item & | selected_fg_item () const |
Return the currently selected foreground/background item. More... | |
const Item & | selected_bg_item () const |
Public Member Functions inherited from editor::tristate_palette | |
tristate_palette (display &gui) | |
Public Member Functions inherited from editor::common_palette | |
common_palette (display &gui) | |
virtual | ~common_palette () |
virtual bool | supports_swap () |
virtual std::vector< std::string > | action_pressed () const |
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::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 () |
Protected Types | |
typedef std::map< std::string, Item > | item_map |
Protected Member Functions | |
virtual void | set_group (const std::string &id) |
Sets a group active id. More... | |
const std::vector< std::string > & | active_group () |
virtual void | select_fg_item (const std::string &item_id) |
Select a foreground item. More... | |
virtual void | select_bg_item (const std::string &item_id) |
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 () |
CVideo & | video () 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 () |
Protected Attributes | |
std::vector< item_group > | groups_ |
The editor_groups as defined in editor-groups.cfg. More... | |
editor_display & | gui_ |
int | item_size_ |
int | item_width_ |
int | item_space_ |
std::map< std::string, std::vector< std::string > > | group_map_ |
item_map | item_map_ |
int | nitems_ |
int | nmax_items_ |
int | items_start_ |
std::set< std::string > | non_core_items_ |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Private Member Functions | |
size_t | active_group_index () |
void | scroll_top () |
Scroll the editor-palette to the top. More... | |
void | scroll_bottom () |
Scroll the editor-palette to the bottom. More... | |
virtual void | draw_item (const Item &item, surface &item_image, std::stringstream &tooltip)=0 |
virtual const std::string & | get_id (const Item &item)=0 |
virtual void | setup (const config &cfg)=0 |
Setup the internal data structure. More... | |
virtual const std::string & | active_group_id () |
virtual bool | is_selected_fg_item (const std::string &id) |
virtual bool | is_selected_bg_item (const std::string &id) |
int | num_items () |
Return the number of items in the palette. More... | |
int | num_visible_items () |
Return the number of items in the palette. More... | |
void | hide (bool hidden) |
Private Attributes | |
unsigned int | palette_y_ |
unsigned int | palette_x_ |
std::string | active_group_ |
std::string | selected_fg_item_ |
std::string | selected_bg_item_ |
mouse_action ** | active_mouse_action_ |
std::vector< gui::tristate_button > | buttons_ |
int | help_handle_ |
Definition at line 24 of file editor_palettes.hpp.
|
protected |
Definition at line 176 of file editor_palettes.hpp.
|
inline |
Definition at line 28 of file editor_palettes.hpp.
|
inlineprotected |
Definition at line 149 of file editor_palettes.hpp.
|
inlineprivatevirtual |
Definition at line 120 of file editor_palettes.hpp.
|
private |
Definition at line 204 of file editor_palettes.cpp.
References i.
Referenced by editor::editor_palette< t_translation::t_terrain >::next_group(), and editor::editor_palette< t_translation::t_terrain >::prev_group().
|
virtual |
Update the size of this widget.
Use if the size_specs have changed.
Implements editor::common_palette.
Definition at line 220 of file editor_palettes.cpp.
|
virtual |
Implements editor::common_palette.
Definition at line 133 of file editor_palettes.cpp.
|
virtual |
Implements editor::common_palette.
Definition at line 124 of file editor_palettes.cpp.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 71 of file editor_palettes.hpp.
|
virtual |
Reimplemented from gui::widget.
Definition at line 307 of file editor_palettes.cpp.
References _(), font::BAD_COLOR, gui::tristate_button::BOTH, gui::tristate_button::draw(), hotkey::get_id(), gui::widget::hide(), i, gui::tristate_button::LEFT, gui::tristate_button::NONE, gui::tristate_button::RIGHT, gui::widget::set_dirty(), gui::tristate_button::set_item_id(), gui::tristate_button::set_item_image(), gui::widget::set_location(), gui::tristate_button::set_pressed(), gui::widget::set_tooltip_string(), font::span_color(), and update_rect().
|
privatepure virtual |
Implemented in editor::terrain_palette, editor::unit_palette, and editor::item_palette.
|
virtual |
Menu expanding for palette group list.
Implements editor::common_palette.
Definition at line 106 of file editor_palettes.cpp.
References _(), and mp_ui_alerts::items.
|
virtual |
Menu expanding for palette group list.
Implements editor::common_palette.
Definition at line 46 of file editor_palettes.cpp.
References _(), COLUMN_SEPARATOR, filesystem::file_exists(), i, and IMAGE_PREFIX.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 69 of file editor_palettes.hpp.
|
pure virtual |
Implemented in editor::terrain_palette, editor::unit_palette, and editor::item_palette.
Referenced by editor::editor_palette< t_translation::t_terrain >::hide().
|
privatepure virtual |
Implemented in editor::terrain_palette, editor::unit_palette, and editor::item_palette.
|
virtual |
Reimplemented from editor::common_palette.
Definition at line 33 of file editor_palettes.cpp.
References h.
|
inlineprivatevirtual |
Reimplemented from gui::widget.
Definition at line 131 of file editor_palettes.hpp.
|
privatevirtual |
Reimplemented in editor::unit_palette.
Definition at line 298 of file editor_palettes.cpp.
|
privatevirtual |
Definition at line 289 of file editor_palettes.cpp.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 76 of file editor_palettes.hpp.
|
privatevirtual |
Return the number of items in the palette.
Implements editor::common_palette.
Definition at line 280 of file editor_palettes.cpp.
|
inlineprivate |
Return the number of items in the palette.
Definition at line 129 of file editor_palettes.hpp.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 79 of file editor_palettes.hpp.
|
private |
Scroll the editor-palette to the bottom.
|
virtual |
Scroll the editor-palette down one step if possible.
Implements editor::common_palette.
Definition at line 142 of file editor_palettes.cpp.
References cursor::draw().
|
private |
Scroll the editor-palette to the top.
|
virtual |
Scroll the editor-palette up one step if possible.
Implements editor::common_palette.
Definition at line 88 of file editor_palettes.cpp.
References cursor::draw().
|
protectedvirtual |
Implements editor::tristate_palette.
Reimplemented in editor::unit_palette, and editor::terrain_palette.
Definition at line 254 of file editor_palettes.cpp.
Referenced by editor::terrain_palette::select_bg_item().
|
protectedvirtual |
Select a foreground item.
Implements editor::tristate_palette.
Reimplemented in editor::terrain_palette.
Definition at line 240 of file editor_palettes.cpp.
Referenced by editor::terrain_palette::select_fg_item().
|
inline |
Definition at line 101 of file editor_palettes.hpp.
|
inline |
Return the currently selected foreground/background item.
Definition at line 100 of file editor_palettes.hpp.
Referenced by editor::mouse_action_item::click_left(), editor::mouse_action_unit::set_mouse_overlay(), editor::mouse_action_item::set_mouse_overlay(), and editor::mouse_action_unit::up_left().
|
virtual |
Implements editor::common_palette.
Definition at line 194 of file editor_palettes.cpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::next_group(), and editor::editor_palette< t_translation::t_terrain >::prev_group().
|
protectedvirtual |
Sets a group active id.
This can result in no visible selected items.
Definition at line 165 of file editor_palettes.cpp.
References ERR_ED.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 58 of file editor_palettes.hpp.
|
privatepure virtual |
Setup the internal data structure.
Implemented in editor::terrain_palette, editor::unit_palette, and editor::item_palette.
|
inlinevirtual |
Implements editor::common_palette.
Definition at line 60 of file editor_palettes.hpp.
|
virtual |
Implements editor::common_palette.
Definition at line 268 of file editor_palettes.cpp.
References swap().
|
private |
Definition at line 182 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::active_group(), and editor::editor_palette< t_translation::t_terrain >::active_group_id().
|
private |
Definition at line 186 of file editor_palettes.hpp.
|
private |
Definition at line 187 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::hide(), and editor::editor_palette< t_translation::t_terrain >::num_visible_items().
|
protected |
Definition at line 174 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::active_group().
|
protected |
The editor_groups as defined in editor-groups.cfg.
Note the user must make sure the id's here are the same as the editor_group in terrain.cfg.
Definition at line 161 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::get_groups(), editor::editor_palette< t_translation::t_terrain >::next_group(), and editor::editor_palette< t_translation::t_terrain >::prev_group().
|
protected |
Definition at line 163 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::hide().
|
private |
Definition at line 189 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::hide().
|
protected |
Definition at line 177 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::selected_bg_item(), and editor::editor_palette< t_translation::t_terrain >::selected_fg_item().
|
protected |
Definition at line 165 of file editor_palettes.hpp.
|
protected |
Definition at line 167 of file editor_palettes.hpp.
|
protected |
Definition at line 166 of file editor_palettes.hpp.
|
protected |
Definition at line 178 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::set_start_item(), and editor::editor_palette< t_translation::t_terrain >::start_num().
|
protected |
Definition at line 178 of file editor_palettes.hpp.
|
protected |
Definition at line 178 of file editor_palettes.hpp.
|
protected |
Definition at line 179 of file editor_palettes.hpp.
|
private |
Definition at line 171 of file editor_palettes.hpp.
|
private |
Definition at line 170 of file editor_palettes.hpp.
|
private |
Definition at line 184 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::selected_bg_item().
|
private |
Definition at line 183 of file editor_palettes.hpp.
Referenced by editor::editor_palette< t_translation::t_terrain >::selected_fg_item().