supertux
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ItemHorizontalMenu Class Referencefinal
Inheritance diagram for ItemHorizontalMenu:
Inheritance graph
[legend]
Collaboration diagram for ItemHorizontalMenu:
Collaboration graph
[legend]

Classes

struct  Item
 

Public Member Functions

 ItemHorizontalMenu (int id, float height, float min_item_width=-1.f)
 
Itemget_selected_item ()
 
void add_item (const std::string &text, const std::string &description, const std::string &icon_file, int id=-1)
 
void draw (DrawingContext &context, const Vector &pos, int menu_width, bool active) override
 Draws the menu item. More...
 
void draw_item (DrawingContext &context, const Item &item, bool active, const Vector &pos, const float &item_width)
 
void process_action (const MenuAction &action) override
 Processes the menu action. More...
 
void event (const SDL_Event &ev) override
 Processes the given event. More...
 
void on_window_resize () override
 
bool changes_width () const override
 Returns true when the width must be recalculated when an action is processed.
 
bool select_blink () const override
 Returns true when the item should have a blink effect, provided by the menu, when active. More...
 
float get_distance () const override
 Returns the distance between the items above and below the current menu item. More...
 
int get_width () const override
 Returns the minimum width of the menu item. More...
 
int get_height () const override
 Returns height of menu item. More...
 
- Public Member Functions inherited from MenuItem
 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 bool skippable () const
 Returns true when the menu item has no action and therefore can be skipped. More...
 
virtual Color get_color () const
 
virtual bool no_other_action () const
 Returns true when the MenuManager shouldn't do anything else. More...
 

Protected Member Functions

void calculate_width (int begin=0)
 
void calculate_rect (const Vector &pos)
 
void go_left ()
 
void go_right ()
 

Protected Attributes

std::vector< Itemm_items
 
int m_selected_item
 
int m_item_range_begin
 
int m_item_range_end
 
float m_width
 
const float m_height
 
const float m_min_item_width
 
Rectf m_rect
 

Static Protected Attributes

static float s_max_width = 0.f
 
static const float s_width_offset = 80.f
 
static const float s_menu_width_offset = 30.f
 
static const float s_item_spacing = 30.f
 
static const float s_icon_y = 3.f
 

Member Function Documentation

◆ draw()

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

Draws the menu item.

Reimplemented from MenuItem.

◆ event()

void ItemHorizontalMenu::event ( const SDL_Event &  ev)
overridevirtual

Processes the given event.

Reimplemented from MenuItem.

◆ get_distance()

float ItemHorizontalMenu::get_distance ( ) const
inlineoverridevirtual

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

Reimplemented from MenuItem.

◆ get_height()

int ItemHorizontalMenu::get_height ( ) const
inlineoverridevirtual

Returns height of menu item.

Reimplemented from MenuItem.

◆ get_width()

int ItemHorizontalMenu::get_width ( ) const
inlineoverridevirtual

Returns the minimum width of the menu item.

Reimplemented from MenuItem.

◆ process_action()

void ItemHorizontalMenu::process_action ( const MenuAction &  action)
overridevirtual

Processes the menu action.

Reimplemented from MenuItem.

◆ select_blink()

bool ItemHorizontalMenu::select_blink ( ) const
inlineoverridevirtual

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

Reimplemented from MenuItem.


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