Debian Codegraph @

src/game/menu/confirmationmenu.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2012 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D 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 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #ifndef CONFIRMATIONMENU_HPP
17 #define CONFIRMATIONMENU_HPP
18
19 #include <functional>
20 #include <memory>
21
22 #include "surfacemenu.hpp"
23
24 #include <MenuItem>
25 #include <MenuItemAction>
26
27 //! Yes/No menu.
28 class ConfirmationMenu : public SurfaceMenu
29 {
30 public:
31 //! Constructor.
32 ConfirmationMenu(std::string id, int width, int height);
33
34 void setAcceptAction(MTFH::MenuItemActionPtr action);
35
36 void setAcceptAction(std::function<void()> actionFunction);
37
38 void setCancelAction(MTFH::MenuItemActionPtr action);
39
40 void setCancelAction(std::function<void()> actionFunction);
41
42 void setText(std::wstring text);
43
44 //! \reimp
45 virtual void selectCurrentItem();
46
47 //! \reimp
48 virtual void render();
49
50 private:
51 MTFH::MenuItemPtr m_acceptItem;
52 MTFH::MenuItemPtr m_cancelItem;
53
54 std::wstring m_text;
55 };
56
57 using ConfirmationMenuPtr = std::shared_ptr<ConfirmationMenu>;
58
59 #endif // CONFIRMATIONMENU_HPP