supertux
Public Member Functions | List of all members
MenuItem Class Reference
Inheritance diagram for MenuItem:
Inheritance graph
[legend]

Public Member Functions

 MenuItem (const std::string &text, int id=-1)
 
int get_id () const
 
void set_help (const std::string &help_text)
 
const std::string & get_help () const
 
void set_text (const std::string &text)
 
const std::string & get_text () const
 
void set_font (const FontPtr font)
 
const FontPtr & get_font () const
 
virtual void draw (DrawingContext &, const Vector &pos, int menu_width, bool active)
 Draws the menu item. More...
 
virtual void on_window_resize ()
 
virtual bool skippable () const
 Returns true when the menu item has no action and therefore can be skipped. More...
 
virtual float get_distance () const
 Returns the distance between the items above and below the current menu item. More...
 
virtual int get_width () const
 Returns the minimum width of the menu item. More...
 
virtual int get_height () const
 Returns height of menu item. More...
 
virtual void process_action (const MenuAction &action)
 Processes the menu action. More...
 
virtual void event (const SDL_Event &ev)
 Processes the given event. More...
 
virtual Color get_color () const
 
virtual bool no_other_action () const
 Returns true when the MenuManager shouldn't do anything else. More...
 
virtual bool changes_width () const
 Returns true when the width must be recalculated when an action is processed.
 
virtual bool select_blink () const
 Returns true when the item should have a blink effect, provided by the menu, when active. More...
 

Member Function Documentation

◆ draw()

void MenuItem::draw ( DrawingContext context,
const Vector &  pos,
int  menu_width,
bool  active 
)
virtual

◆ event()

virtual void MenuItem::event ( const SDL_Event &  ev)
inlinevirtual

Processes the given event.

Reimplemented in ItemColorChannelOKLab, ItemHorizontalMenu, ItemTextField, ItemColorChannelRGBA, and ItemScriptLine.

◆ get_distance()

virtual float MenuItem::get_distance ( ) const
inlinevirtual

Returns the distance between the items above and below the current menu item.

Reimplemented in ItemHorizontalMenu.

◆ get_height()

virtual int MenuItem::get_height ( ) const
inlinevirtual

Returns height of menu item.

Reimplemented in ItemHorizontalMenu, and ItemImages.

◆ get_width()

int MenuItem::get_width ( ) const
virtual

◆ no_other_action()

virtual bool MenuItem::no_other_action ( ) const
inlinevirtual

Returns true when the MenuManager shouldn't do anything else.

Reimplemented in ItemBack.

◆ process_action()

virtual void MenuItem::process_action ( const MenuAction &  action)
inlinevirtual

◆ select_blink()

virtual bool MenuItem::select_blink ( ) const
inlinevirtual

Returns true when the item should have a blink effect, provided by the menu, when active.

Reimplemented in ItemHorizontalMenu.

◆ skippable()

virtual bool MenuItem::skippable ( ) const
inlinevirtual

Returns true when the menu item has no action and therefore can be skipped.

Useful for labels and horizontal lines.

Reimplemented in ItemColorDisplay, ItemInactive, ItemHorizontalLine, and ItemLabel.


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