Colobot
maindialog.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "common/event.h"
23 #include "common/restext.h"
24 
25 #include <vector>
26 #include <functional>
27 
28 
29 class CSettings;
30 class CSoundInterface;
31 class CRobotMain;
32 
33 namespace Gfx
34 {
35 class CEngine;
36 class CParticle;
37 }
38 
39 namespace Ui
40 {
41 
42 class CInterface;
43 
45 {
46 public:
47  CMainDialog();
48  ~CMainDialog();
49 
50  bool EventProcess(const Event &event);
51 
52 
53  typedef std::function<void()> DialogCallback;
54  void StartQuestion(const std::string& text,
55  bool warningYes = false, bool warningNo = false,
56  bool fireParticles = false,
57  DialogCallback yes = nullptr, DialogCallback no = nullptr);
58  void StartQuestion(ResTextType text,
59  bool warningYes = false, bool warningNo = false,
60  bool fireParticles = false,
61  DialogCallback yes = nullptr, DialogCallback no = nullptr);
62  void StartInformation(const std::string& title,
63  const std::string& text,
64  const std::string& details,
65  bool warning = false,
66  bool fireParticles = false,
67  DialogCallback ok = nullptr);
68  void StartPauseMenu();
69  void StopDialog();
70  bool IsDialog();
71 
72 protected:
73  void StartDialog(Math::Point dim, bool fireParticles);
74  void FrameDialog(float rTime);
75 
76 protected:
77  CRobotMain* m_main;
78  Gfx::CEngine* m_engine;
79  Gfx::CParticle* m_particle;
80  CInterface* m_interface;
81  CSoundInterface* m_sound;
82  CSettings* m_settings;
83 
84  enum class DialogType
85  {
86  Question,
87  PauseMenu
88  };
89 
90  bool m_dialogOpen;
91  DialogType m_dialogType;
92  bool m_dialogFireParticles;
93  Math::Point m_dialogPos;
94  Math::Point m_dialogDim;
95  float m_dialogTime;
96  float m_dialogParti;
97 
98  DialogCallback m_callbackYes;
99  DialogCallback m_callbackNo;
100 };
101 
102 } // namespace Ui
Definition: maindialog.h:44
Definition: robotmain.h:107
Definition: robotmain.h:151
Particle engine.
Definition: particle.h:223
ResTextType
Text resources available for translation.
Definition: restext.h:49
Definition: settings.h:31
Translation and string resource utilities.
2D point
Definition: point.h:50
Namespace for (new) graphics code.
Definition: app.h:49
The graphics engine.
Definition: engine.h:620
Event types, structs and event queue.
Event sent by system, interface or game.
Definition: event.h:709
Definition: interface.h:58
Sound plugin interface.
Definition: sound.h:57