List of starting locations and location ids. More...
#include <location_palette.hpp>
Public Member Functions | |
location_palette (editor_display &gui, const game_config_view &, 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 |
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 |
![]() | |
common_palette () | |
virtual | ~common_palette () |
virtual bool | supports_swap () |
![]() | |
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... | |
![]() | |
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 | |
![]() | |
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_ |
![]() | |
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) |
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 | |
![]() | |
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 () |
![]() | |
sdl_handler (const bool auto_join=true) | |
sdl_handler (const sdl_handler &) | |
sdl_handler & | operator= (const sdl_handler &) |
virtual | ~sdl_handler () |
![]() | |
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 33 of file location_palette.hpp.
editor::location_palette::location_palette | ( | editor_display & | gui, |
const game_config_view & | , | ||
editor_toolkit & | toolkit | ||
) |
Definition at line 162 of file location_palette.cpp.
References i, items_, and selected_item_.
editor::location_palette::~location_palette | ( | ) |
Definition at line 411 of file location_palette.cpp.
Referenced by selected_item().
|
overridevirtual |
Reimplemented from editor::common_palette.
Definition at line 402 of file location_palette.cpp.
References button_delete_.
Referenced by selected_item().
void editor::location_palette::add_item | ( | const std::string & | id | ) |
Definition at line 430 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 selected_item().
|
overridevirtual |
Update the size of this widget.
Use if the size_specs have changed.
Implements editor::common_palette.
Definition at line 244 of file location_palette.cpp.
References _(), add_item(), button_add_, button_delete_, button_goto_, buttons_, font::clear_help_string(), disp_, ERR_ED, get_help_string(), display::get_map(), i, item_size_, item_space_, display::scroll_to_tile(), selected_item_, gui::widget::set_dirty(), font::set_help_string(), gui::widget::set_location(), gui2::show_transient_message(), gamemap_base::special_location(), map_location::valid(), and display::WARP.
Referenced by get_groups().
|
overridevirtual |
Implements editor::common_palette.
Definition at line 227 of file location_palette.cpp.
References items_start_, num_items(), and num_visible_items().
Referenced by get_groups(), layout(), and scroll_down().
|
overridevirtual |
Implements editor::common_palette.
Definition at line 222 of file location_palette.cpp.
References items_start_.
Referenced by get_groups(), layout(), and scroll_up().
|
inline |
Definition at line 76 of file location_palette.hpp.
|
overridevirtual |
Called by widget::draw()
Reimplemented from gui::widget.
Definition at line 393 of file location_palette.cpp.
Referenced by get_groups().
|
inlineoverridevirtual |
Menu expanding for palette group list.
Implements editor::common_palette.
Definition at line 48 of file location_palette.hpp.
References i.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 56 of file location_palette.hpp.
References adjust_size(), can_scroll_down(), can_scroll_up(), draw_contents(), layout(), scroll_down(), and scroll_up().
|
inlinevirtual |
Definition at line 78 of file location_palette.hpp.
Referenced by adjust_size(), and select_item().
|
overridevirtual |
Reimplemented from editor::common_palette.
Definition at line 184 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 196 of file location_palette.cpp.
References font::clear_help_string(), disp_, display::find_menu_button(), handler_members(), gui::widget::hide(), and w.
Referenced by selected_item().
|
privatevirtual |
Definition at line 334 of file location_palette.cpp.
References gui::widget::id(), and selected_item_.
Referenced by layout(), and selected_item().
|
overridevirtual |
Called by draw_manager to validate layout before drawing.
Reimplemented from gui::widget.
Definition at line 339 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_.
Referenced by get_groups().
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 54 of file location_palette.hpp.
|
overrideprivatevirtual |
Return the number of items in the palette.
Implements editor::common_palette.
Definition at line 325 of file location_palette.cpp.
References items_.
Referenced by add_item(), can_scroll_down(), layout(), and selected_item().
|
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 329 of file location_palette.cpp.
References buttons_.
Referenced by add_item(), can_scroll_down(), layout(), and selected_item().
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 55 of file location_palette.hpp.
|
private |
Scroll the editor-palette to the bottom.
Referenced by selected_item().
|
overridevirtual |
Scroll the editor-palette down one step if possible.
Implements editor::common_palette.
Definition at line 232 of file location_palette.cpp.
References can_scroll_down(), items_start_, and gui::widget::set_dirty().
Referenced by get_groups().
|
private |
Scroll the editor-palette to the top.
Referenced by selected_item().
|
overridevirtual |
Scroll the editor-palette up one step if possible.
Implements editor::common_palette.
Definition at line 211 of file location_palette.cpp.
References can_scroll_up(), items_start_, and gui::widget::set_dirty().
Referenced by get_groups().
|
virtual |
Definition at line 315 of file location_palette.cpp.
References font::clear_help_string(), get_help_string(), selected_item_, gui::widget::set_dirty(), and font::set_help_string().
Referenced by location_palette_item::mouse_up(), and selected_item().
|
inline |
Return the currently selected item.
Definition at line 81 of file location_palette.hpp.
References action_pressed(), add_item(), gui::widget::hidden(), hide(), is_selected_item(), num_items(), num_visible_items(), scroll_bottom(), scroll_top(), select_item(), selected_item_, and ~location_palette().
Referenced by editor::editor_controller::do_execute_command().
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 53 of file location_palette.hpp.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 43 of file location_palette.hpp.
References utf8::index(), and items_start_.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 45 of file location_palette.hpp.
References items_start_.
|
inlineoverridevirtual |
Implements editor::common_palette.
Definition at line 75 of file location_palette.hpp.
|
private |
Definition at line 120 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), and layout().
|
private |
Definition at line 121 of file location_palette.hpp.
Referenced by action_pressed(), adjust_size(), handler_members(), and layout().
|
private |
Definition at line 122 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), and layout().
|
private |
Definition at line 119 of file location_palette.hpp.
Referenced by adjust_size(), handler_members(), layout(), and num_visible_items().
|
private |
Definition at line 123 of file location_palette.hpp.
Referenced by adjust_size(), hide(), and layout().
|
protected |
Definition at line 107 of file location_palette.hpp.
Referenced by adjust_size().
|
protected |
Definition at line 109 of file location_palette.hpp.
Referenced by adjust_size().
|
private |
Definition at line 117 of file location_palette.hpp.
Referenced by add_item(), layout(), location_palette(), and num_items().
|
protected |
Definition at line 113 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 116 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 118 of file location_palette.hpp.
Referenced by layout().