| 1 | // SuperTux |
| 2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
| 3 | // 2015 Hume2 <teratux.mail@gmail.com> |
| 4 | // |
| 5 | // This program is free software: you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License as published by |
| 7 | // the Free Software Foundation, either version 3 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | #ifndef HEADER_SUPERTUX_GUI_MENU_ITEM_HPP |
| 19 | #define |
| 20 | |
| 21 | #include "gui/menu.hpp" |
| 22 | |
| 23 | class |
| 24 | { |
| 25 | public: |
| 26 | (const std::string& text, int id = -1); |
| 27 | virtual (); |
| 28 | |
| 29 | int () const { return m_id; } |
| 30 | |
| 31 | void (const std::string& help_text); |
| 32 | const std::string& () const { return m_help; } |
| 33 | |
| 34 | void (const std::string& text) { m_text = text; } |
| 35 | const std::string& () const { return m_text; } |
| 36 | |
| 37 | /** Draws the menu item. */ |
| 38 | virtual void (DrawingContext&, const Vector& pos, int , bool active); |
| 39 | |
| 40 | /** Returns true when the menu item has no action and therefore can be skipped. |
| 41 | Useful for labels and horizontal lines.*/ |
| 42 | virtual bool () const { |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | /** Returns the minimum width of the menu item. */ |
| 47 | virtual int () const; |
| 48 | |
| 49 | /** Processes the menu action. */ |
| 50 | virtual void (const MenuAction& action) { } |
| 51 | |
| 52 | /** Processes the given event. */ |
| 53 | virtual void (const SDL_Event& ev) { } |
| 54 | |
| 55 | virtual Color () const; |
| 56 | |
| 57 | /** Returns true when the MenuManager shouldn't do anything else. */ |
| 58 | virtual bool () const { |
| 59 | return false; |
| 60 | } |
| 61 | |
| 62 | /** Returns true when the width must be recalculated when an action is |
| 63 | processed */ |
| 64 | virtual bool () const { |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | private: |
| 69 | int ; |
| 70 | std::string ; |
| 71 | std::string ; |
| 72 | |
| 73 | private: |
| 74 | (const MenuItem&) = delete; |
| 75 | MenuItem& (const MenuItem&) = delete; |
| 76 | }; |
| 77 | |
| 78 | #endif |
| 79 | |
| 80 | /* EOF */ |
| 81 | |