supertux
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Menu Class Referenceabstract

Inherited by AddonBrowseMenu, AddonFileInstallMenu, AddonMenu, AddonPreviewMenu, CheatApplyMenu, CheatMenu, ColorMenu, ContribLevelsetMenu, ContribMenu, CustomMenuMenu, DebugMenu, EditorConvertersMenu, EditorDeleteLevelMenu, EditorDeleteLevelsetMenu, EditorLevelMenu, EditorLevelSelectMenu, EditorLevelsetMenu, EditorLevelsetSelectMenu, EditorMenu, EditorNewLevelsetMenu, EditorObjectgroupMenu, EditorSaveAs, EditorSectorMenu, EditorSectorsMenu, EditorTilegroupMenu, FileSystemMenu, GameMenu, IntegrationsMenu, JoystickMenu, KeyboardMenu, LanguageMenu, ListMenu, MainMenu, MultiplayerMenu, MultiplayerPlayerMenu, MultiplayerPlayersMenu, ObjectMenu, ObjectSelectMenu, OptionsMenu, OptionsSelectMenu, ParticleEditorMenu, ParticleEditorOpen, ParticleEditorSaveAs, PathsMenu, ProfileMenu, ProfileNameMenu, ScriptMenu, SortedContribMenu, StringArrayMenu, VideoSystemMenu, WebAssetMenu, WorldmapCheatApplyMenu, WorldmapCheatMenu, WorldmapLevelSelectMenu, WorldmapMenu, and WorldSetMenu.

Public Member Functions

virtual void menu_action (MenuItem &item)=0
 
virtual bool on_back_action ()
 Executed before the menu is exited. More...
 
virtual void refresh ()
 Perform actions to bring the menu up to date with configuration changes.
 
virtual void on_window_resize ()
 
void draw (DrawingContext &context)
 
virtual void event (const SDL_Event &event)
 
virtual void process_action (const MenuAction &action)
 
ItemHorizontalLineadd_hl ()
 
ItemLabeladd_label (const std::string &text)
 
ItemActionadd_entry (int id, const std::string &text)
 
ItemActionadd_entry (const std::string &text, const std::function< void()> &callback)
 
ItemToggleadd_toggle (int id, const std::string &text, bool *toggled, bool center_text=false)
 
ItemToggleadd_toggle (int id, const std::string &text, const std::function< bool()> &get_func, const std::function< void(bool)> &set_func, bool center_text=false)
 
ItemInactiveadd_inactive (const std::string &text, bool default_color=false)
 
ItemBackadd_back (const std::string &text, int id=-1)
 
ItemGoToadd_submenu (const std::string &text, int submenu, int id=-1)
 
ItemControlFieldadd_controlfield (int id, const std::string &text, const std::string &mapping="")
 
ItemStringSelectadd_string_select (int id, const std::string &text, int *selected, const std::vector< std::string > &strings)
 
ItemStringSelectadd_string_select (int id, const std::string &text, int default_item, const std::vector< std::string > &strings)
 
ItemTextFieldadd_textfield (const std::string &text, std::string *input, int id=-1)
 
ItemScriptadd_script (const std::string &text, std::string *script, int id=-1)
 
ItemScriptLineadd_script_line (std::string *input, int id=-1)
 
ItemIntFieldadd_intfield (const std::string &text, int *input, int id=-1, bool positive=false)
 
ItemFloatFieldadd_floatfield (const std::string &text, float *input, int id=-1, bool positive=false)
 
ItemActionadd_file (const std::string &text, std::string *input, const std::vector< std::string > &extensions, const std::string &basedir, bool path_relative_to_basedir, const std::function< void(MenuItem &)> &item_processor={}, int id=-1)
 
ItemColoradd_color (const std::string &text, Color *color, int id=-1)
 
ItemColorDisplayadd_color_display (Color *color, int id=-1)
 
ItemColorChannelRGBAadd_color_channel_rgba (float *input, Color channel, int id=-1, bool is_linear=false)
 
ItemColorChannelOKLabadd_color_channel_oklab (Color *color, int channel)
 
ItemPathsadd_path_settings (const std::string &text, PathObject &target, const std::string &path_ref)
 
ItemStringArrayadd_string_array (const std::string &text, std::vector< std::string > &items, int id=-1)
 
ItemImagesadd_images (const std::string &image_path, int max_image_width=0, int max_image_height=0, int id=-1)
 
ItemImagesadd_images (const std::vector< std::string > &image_paths, int max_image_width=0, int max_image_height=0, int id=-1)
 
ItemListadd_list (const std::string &text, const std::vector< std::string > &items, std::string *value_ptr, int id=-1)
 
ItemHorizontalMenuadd_horizontalmenu (int id, float height, float min_item_width=-1.f)
 
void clear ()
 Remove all entries from the menu.
 
MenuItemget_item (int index)
 
MenuItemget_item_by_id (int id)
 
const MenuItemget_item_by_id (int id) const
 
int get_active_item_id () const
 
void set_active_item (int id)
 
Vector get_center_pos () const
 
void set_center_pos (float x, float y)
 
float get_width () const
 
float get_height () const
 
virtual bool is_sensitive () const
 returns true when the text is more important than action
 

Public Attributes

std::vector< std::unique_ptr< MenuItem > > m_items
 

Protected Member Functions

MenuItemadd_item (std::unique_ptr< MenuItem > menu_item)
 
MenuItemadd_item (std::unique_ptr< MenuItem > menu_item, int pos_)
 
template<typename T , typename... Args>
T & add_item (Args &&... args)
 
void delete_item (int pos_)
 
void calculate_width ()
 Recalculates the width for this menu.
 
void calculate_height ()
 Recalculates the height for this menu.
 

Protected Attributes

int m_active_item
 

Member Function Documentation

◆ on_back_action()

virtual bool Menu::on_back_action ( )
inlinevirtual

Executed before the menu is exited.

Returns
true if it should perform the back action, false if it shouldn't

Reimplemented in EditorMenu, ObjectMenu, EditorLevelMenu, and MainMenu.


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