PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
_pge_menuitem.h
1 /*
2  * Platformer Game Engine by Wohlstand, a free platform for game making
3  * Copyright (c) 2015 Vitaly Novichkov <admin@wohlnet.ru>
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  * 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 
19 #ifndef _MENUITEM_H
20 #define _MENUITEM_H
21 
22 #include <QString>
23 #include <functional>
24 
25 class PGE_Menu;
26 
28 {
29 public:
30  PGE_Menuitem();
31  virtual ~PGE_Menuitem();
32  PGE_Menuitem(const PGE_Menuitem &_it);
33  PGE_Menuitem operator=(const PGE_Menuitem &_it)
34  {
35  this->title = _it.title;
36  this->value = _it.value;
37  this->_width = _it._width;
38  this->type = _it.type;
39  this->valueOffset = _it.valueOffset;
40  this->_font_id = _it._font_id;
41  this->extAction = _it.extAction;
42  return *this;
43  }
44 
45  virtual void left();
46  virtual void right();
47  virtual void toggle();
48 
49  virtual void render(int x, int y);
50 
51  QString title;
52  QString value;
53  enum itemType{
54  ITEM_Normal=0,
55  ITEM_Bool,
56  ITEM_Int,
57  ITEM_NamedInt,
58  ITEM_KeyGrab,
59  ITEM_StrList
60  };
61 
62  itemType type;
64 protected:
65  std::function<void()> extAction;
66  int _width;
67  int _font_id;
68 
69 private:
70  friend class PGE_Menu;
71 };
72 
73 
74 #endif // _MENUITEM_H
75 
int valueOffset
X-offset where must be rendered value label.
Definition: _pge_menuitem.h:63
Definition: _pge_menuitem.h:27
Definition: pge_menu.h:40