32 , std::size_t item_size, std::size_t columns,
editor_toolkit &toolkit)
69 virtual void layout()
override;
112 virtual const std::string&
get_id(
const Item& item) = 0;
134 virtual void set_group(
const std::string&
id);
std::string selected_fg_item_
std::vector< events::sdl_handler * > sdl_handler_vector
virtual sdl_handler_vector handler_members() override
virtual void select_fg_item(const std::string &item_id) override
Select a foreground item.
virtual void select_bg_item(const std::string &item_id) override
std::size_t active_group_index()
std::size_t items_start_
Index of the item at the top-left of the visible area, used for scrolling up and down.
virtual void setup_item(const Item &item, texture &item_base_image, texture &item_overlay_image, std::stringstream &tooltip)=0
Setup item image and tooltip.
editor_palette(editor_display &gui, const game_config_view &, std::size_t item_size, std::size_t columns, editor_toolkit &toolkit)
void set_start_item(std::size_t index) override
virtual bool scroll_down() override
Scroll the editor-palette down one step if possible.
void set_group(std::size_t index) override
virtual bool scroll_up() override
Scroll the editor-palette up one step if possible.
const std::vector< std::string > items
virtual bool is_selected_bg_item(const std::string &id)
const std::vector< std::string > & active_group()
int item_size_
Both the width and the height of the square buttons.
virtual bool can_scroll_up() override
void expand_palette_groups_menu(std::vector< config > &items, int i) override
Menu expanding for palette group list.
Wrapper class to encapsulate creation and management of an SDL_Texture.
std::map< std::string, Item > item_map
std::size_t columns_
Number of items per row.
virtual bool is_selected_fg_item(const std::string &id)
std::size_t start_num(void) override
virtual void setup(const game_config_view &cfg)=0
Setup the internal data structure.
std::map< std::string, std::vector< std::string > > group_map_
virtual bool can_scroll_down() override
const std::vector< item_group > & get_groups() const override
virtual void layout() override
Called by draw_manager to validate layout before drawing.
Manage the empty-palette in the editor.
editor_toolkit & toolkit_
std::vector< gui::tristate_button > buttons_
std::size_t num_items() override
Return the number of items in the currently-active group.
const Item & selected_bg_item() const
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
void next_group() override
std::set< std::string > non_core_items_
int item_space_
item_space_ plus some padding.
virtual void draw_contents() override
Called by widget::draw()
virtual std::string get_help_string()=0
void adjust_size(const SDL_Rect &target) override
Update the size of this widget.
const Item & selected_fg_item() const
Return the currently selected foreground/background item.
virtual const std::string & get_id(const Item &item)=0
std::string active_group_
void hide(bool hidden) override
void prev_group() override
std::vector< item_group > groups_
The editor_groups as defined in editor-groups.cfg.
virtual const std::string & active_group_id()
std::string selected_bg_item_
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
std::pair< std::string, unsigned > item