supertux
object_menu.hpp
1 // SuperTux
2 // Copyright (C) 2015 Hume2 <teratux.mail@gmail.com>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_EDITOR_OBJECT_MENU_HPP
18 #define HEADER_SUPERTUX_EDITOR_OBJECT_MENU_HPP
19 
20 #include "gui/menu.hpp"
21 
22 #include <functional>
23 
24 class Editor;
25 class GameObject;
26 
27 class ObjectMenu final : public Menu
28 {
29 public:
30  enum {
31  MNID_UPDATE,
32  MNID_PATCH_NOTES,
33  MNID_REMOVE,
34  MNID_REMOVEFUNCTION,
35  MNID_TEST_FROM_HERE,
36  MNID_OPEN_PARTICLE_EDITOR
37  };
38 
39 public:
40  ObjectMenu(GameObject* go, const std::function<bool (GameObject*)>& remove_function = {});
41  ~ObjectMenu() override;
42 
43  void refresh() override;
44 
45  virtual void menu_action(MenuItem& item) override;
46  virtual bool on_back_action() override;
47 
48 private:
49  Editor& m_editor;
50  GameObject* m_object;
51  const std::function<bool (GameObject*)> m_remove_function;
52 
53 private:
54  ObjectMenu(const ObjectMenu&) = delete;
55  ObjectMenu& operator=(const ObjectMenu&) = delete;
56 };
57 
58 #endif
59 
60 /* EOF */
virtual bool on_back_action() override
Executed before the menu is exited.
Definition: object_menu.cpp:140
void refresh() override
Perform actions to bring the menu up to date with configuration changes.
Definition: object_menu.cpp:41
Definition: menu_item.hpp:23
Definition: object_menu.hpp:27
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Definition: menu.hpp:55
Definition: editor.hpp:49