List of starting locations and location ids. More...
#include <location_palette.hpp>
Public Member Functions | |
location_palette (editor_display &gui, 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 | layout () override |
Called by draw_manager to validate layout before drawing. More... | |
virtual void | draw_contents () override |
Called by widget::draw() More... | |
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 |
virtual void | swap () override |
For tools which support fg and bg items, exchange the two items. More... | |
virtual bool | supports_swap () override |
Whether the hotkey system should the enable GUI button connected to swap(). More... | |
std::string | get_help_string () const |
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 () | |
virtual | ~common_palette () |
Public Member Functions inherited from gui::widget | |
const 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 | queue_redraw () |
Indicate that the widget should be redrawn. More... | |
void | queue_redraw (const rect &) |
Indicate that a specific region of the screen should be redrawn. More... | |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_tooltip_string (int mousex, int mousey) override |
virtual bool | expose (const rect ®ion) override |
Called by draw_manager when it believes a redraw is necessary. More... | |
virtual rect | screen_location () override |
The current draw location of the display, on the screen. More... | |
Public Member Functions inherited from events::sdl_handler | |
virtual void | handle_window_event (const SDL_Event &) |
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_handler & | operator= (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 | |
Public Member Functions inherited from gui2::top_level_drawable | |
virtual void | update () |
Update state and any parameters that may effect layout, or any of the later stages. More... | |
virtual void | render () |
Perform any internal rendering necessary to prepare the drawable. More... | |
Protected Attributes | |
int | item_size_ |
int | item_space_ |
std::size_t | items_start_ |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Private Member Functions | |
void | scroll_top () |
Scroll the editor-palette to the top. More... | |
virtual bool | is_selected_item (const std::string &id) |
std::size_t | num_items () override |
Return the number of items in the palette. More... | |
std::size_t | num_visible_items () |
Return the number of GUI elements that can show items. More... | |
Private Attributes | |
std::string | selected_item_ |
std::vector< std::string > | items_ |
editor_toolkit & | toolkit_ |
std::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_ |
editor_display & | disp_ |
Additional Inherited Members | |
Protected Member Functions inherited from gui::widget | |
widget (const bool auto_join=true) | |
virtual | ~widget () |
virtual void | update_location (const SDL_Rect &) |
virtual void | handle_event (const SDL_Event &) override |
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_handler & | operator= (const sdl_handler &) |
virtual | ~sdl_handler () |
Protected Member Functions inherited from gui2::top_level_drawable | |
top_level_drawable () | |
virtual | ~top_level_drawable () |
top_level_drawable (const top_level_drawable &) | |
top_level_drawable & | operator= (const top_level_drawable &) |
top_level_drawable (top_level_drawable &&) | |
top_level_drawable & | operator= (top_level_drawable &&) |
List of starting locations and location ids.
Shows a single-column list, with buttons to add new items to the list and to jump to that location on the map.
Definition at line 32 of file location_palette.hpp.
editor::location_palette::location_palette | ( | editor_display & | gui, |
editor_toolkit & | toolkit | ||
) |
Definition at line 160 of file location_palette.cpp.
References i, items_, and selected_item_.
editor::location_palette::~location_palette | ( | ) |
Definition at line 406 of file location_palette.cpp.
|
overridevirtual |
Reimplemented from editor::common_palette.
Definition at line 397 of file location_palette.cpp.
References button_delete_.
void editor::location_palette::add_item | ( | const std::string & | id | ) |
Definition at line 425 of file location_palette.cpp.
References gui::widget::id(), items_, items_start_, editor::loc_id_comp(), num_items(), num_visible_items(), and selected_item_.
Referenced by adjust_size(), editor::context_manager::refresh_all(), and editor::mouse_action_starting_position::up_left().
|
overridevirtual |
Update the size of this widget.
Use if the size_specs have changed.
Implements editor::common_palette.
Definition at line 241 of file location_palette.cpp.
References _(), add_item(), button_add_, button_delete_, button_goto_, buttons_, disp_, ERR_ED, get_help_string(), editor::editor_display::get_map(), i, item_size_, item_space_, display::scroll_to_tile(), selected_item_, gui::widget::set_dirty(), editor::editor_display::set_help_string(), gui::widget::set_location(), gui2::show_transient_message(), gamemap_base::special_location(), map_location::valid(), and display::WARP.
|
overridevirtual |
Implements editor::common_palette.
Definition at line 224 of file location_palette.cpp.
References items_start_, num_items(), and num_visible_items().
Referenced by layout(), and scroll_down().
|
overridevirtual |
Implements editor::common_palette.
Definition at line 219 of file location_palette.cpp.
References items_start_.
Referenced by layout(), and scroll_up().
|
overridevirtual |
Called by widget::draw()
Reimplemented from gui::widget.
Definition at line 388 of file location_palette.cpp.
|
inlineoverridevirtual |
Menu expanding for palette group list.
Implements editor::common_palette.
Definition at line 46 of file location_palette.hpp.
References i.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 54 of file location_palette.hpp.
|
inline |
Definition at line 76 of file location_palette.hpp.
Referenced by adjust_size(), and select_item().
|
overridevirtual |
Reimplemented from editor::common_palette.
Definition at line 181 of file location_palette.cpp.
References b, button_add_, button_delete_, button_goto_, buttons_, and h.
Referenced by hide().
|
overridevirtual |
Reimplemented from gui::widget.
Definition at line 193 of file location_palette.cpp.
References editor::editor_display::clear_help_string(), disp_, display::find_menu_button(), handler_members(), gui::widget::hidden(), gui::widget::hide(), and w.
|
privatevirtual |
Definition at line 329 of file location_palette.cpp.
References gui::widget::id(), and selected_item_.
Referenced by layout().
|
overridevirtual |
Called by draw_manager to validate layout before drawing.
Reimplemented from gui::widget.
Definition at line 334 of file location_palette.cpp.
References button_add_, button_delete_, button_goto_, buttons_, can_scroll_down(), can_scroll_up(), gui::widget::dirty(), disp_, display::find_action_button(), gui::widget::hide(), i, is_selected_item(), items_, items_start_, num_items(), num_visible_items(), gui::widget::set_dirty(), location_palette_item::set_item_id(), editor::editor_toolkit::set_mouseover_overlay(), location_palette_item::set_selected(), gui::widget::set_tooltip_string(), and toolkit_.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 52 of file location_palette.hpp.
|
overrideprivatevirtual |
Return the number of items in the palette.
Implements editor::common_palette.
Definition at line 320 of file location_palette.cpp.
References items_.
Referenced by add_item(), can_scroll_down(), and layout().
|
private |
Return the number of GUI elements that can show items.
Some of these may be hidden, if there are more of them than items to show, or if the palette has been scrolled to the bottom.
Definition at line 324 of file location_palette.cpp.
References buttons_.
Referenced by add_item(), can_scroll_down(), and layout().
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 53 of file location_palette.hpp.
|
overridevirtual |
Scroll the editor-palette down one step if possible.
Implements editor::common_palette.
Definition at line 229 of file location_palette.cpp.
References can_scroll_down(), items_start_, and gui::widget::set_dirty().
|
private |
Scroll the editor-palette to the top.
|
overridevirtual |
Scroll the editor-palette up one step if possible.
Implements editor::common_palette.
Definition at line 208 of file location_palette.cpp.
References can_scroll_up(), items_start_, and gui::widget::set_dirty().
|
virtual |
Definition at line 311 of file location_palette.cpp.
References disp_, get_help_string(), selected_item_, gui::widget::set_dirty(), and editor::editor_display::set_help_string().
Referenced by location_palette_item::mouse_up().
|
inline |
Return the currently selected item.
Definition at line 79 of file location_palette.hpp.
References selected_item_.
Referenced by editor::editor_controller::do_execute_command(), and editor::mouse_action_starting_position::up_left().
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 51 of file location_palette.hpp.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 41 of file location_palette.hpp.
References utf8::index(), and items_start_.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 43 of file location_palette.hpp.
References items_start_.
|
inlineoverridevirtual |
Whether the hotkey system should the enable GUI button connected to swap().
Reimplemented from editor::common_palette.
Definition at line 74 of file location_palette.hpp.
|
inlineoverridevirtual |
For tools which support fg and bg items, exchange the two items.
Typically, fg and bg mean that they're placed by left or right mouse clicks, respectively.
There's a mismatch between class structure and responsibilities here, as part of the UX isn't part of the palette. The tool decides what right-click does. Even for the scenery item tool, where right-click deletes an item, fg and bg provide a way to switch between two items.
Implements editor::common_palette.
Definition at line 73 of file location_palette.hpp.
|
private |
Definition at line 115 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), and layout().
|
private |
Definition at line 116 of file location_palette.hpp.
Referenced by action_pressed(), adjust_size(), handler_members(), and layout().
|
private |
Definition at line 117 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), and layout().
|
private |
Definition at line 114 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), layout(), and num_visible_items().
|
private |
Definition at line 118 of file location_palette.hpp.
Referenced by adjust_size(), hide(), layout(), and select_item().
|
protected |
Definition at line 102 of file location_palette.hpp.
Referenced by adjust_size().
|
protected |
Definition at line 104 of file location_palette.hpp.
Referenced by adjust_size().
|
private |
Definition at line 112 of file location_palette.hpp.
Referenced by add_item(), layout(), location_palette(), and num_items().
|
protected |
Definition at line 108 of file location_palette.hpp.
Referenced by add_item(), can_scroll_down(), can_scroll_up(), layout(), scroll_down(), scroll_up(), set_start_item(), and start_num().
|
private |
Definition at line 111 of file location_palette.hpp.
Referenced by add_item(), adjust_size(), is_selected_item(), location_palette(), select_item(), and selected_item().
|
private |
Definition at line 113 of file location_palette.hpp.
Referenced by layout().