Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
interface.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.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 // interface.h
21 
22 #pragma once
23 
24 #include "common/event.h"
25 #include "common/misc.h"
26 
27 #include "math/point.h"
28 
29 #include "graphics/engine/camera.h"
30 #include "graphics/engine/engine.h"
31 
32 #include "ui/control.h"
33 #include "ui/button.h"
34 #include "ui/color.h"
35 #include "ui/check.h"
36 #include "ui/key.h"
37 #include "ui/group.h"
38 #include "ui/image.h"
39 #include "ui/label.h"
40 #include "ui/edit.h"
41 #include "ui/editvalue.h"
42 #include "ui/scroll.h"
43 #include "ui/slider.h"
44 #include "ui/list.h"
45 #include "ui/shortcut.h"
46 #include "ui/compass.h"
47 #include "ui/target.h"
48 #include "ui/map.h"
49 #include "ui/window.h"
50 
51 #include <string>
52 
53 namespace Ui {
54 
55 const int MAXCONTROL = 100;
56 
57 
59 {
60 public:
61  CInterface();
62  ~CInterface();
63 
64  bool EventProcess(const Event &event);
65  bool GetTooltip(Math::Point pos, std::string &name);
66 
67  void Flush();
68  CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
69  CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
70  CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
71  CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
72  CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
73  CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
74  CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
75  CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
76  CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
77  CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
78  CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
79  CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
80  CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
81  CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
82 
83  CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
84  CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
85  CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name);
86 
87  bool DeleteControl(EventType eventMsg);
88  CControl* SearchControl(EventType eventMsg);
89 
90  void Draw();
91 
92 protected:
93  int GetNextFreeControl();
94  template <typename T> inline T* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
95 
96  CEventQueue* m_event;
97  Gfx::CEngine* m_engine;
98  Gfx::CCamera* m_camera;
99 
100  CControl* m_table[MAXCONTROL];
101 };
102 
103 
104 }
105 
Main graphics engine - CEngine class.
Definition: map.h:72
Definition: shortcut.h:30
Definition: controller.h:32
Camera handling - CCamera class.
Point struct and related functions.
Definition: list.h:42
Definition: group.h:33
Global event queue.
Definition: event.h:751
Definition: target.h:40
Definition: compass.h:33
Definition: editvalue.h:46
Definition: button.h:30
Definition: color.h:34
Definition: label.h:32
Definition: slider.h:32
2D point
Definition: point.h:49
Definition: check.h:33
Definition: image.h:34
Camera moving in 3D scene.
Definition: camera.h:133
Key slot control.
The graphics engine.
Definition: engine.h:684
CEdit class.
Event types, structs and event queue.
Definition: edit.h:131
Definition: key.h:38
Definition: scroll.h:37
EventType
Type of event message.
Definition: event.h:38
Event sent by system, interface or game.
Definition: event.h:678
Definition: window.h:56
Definition: interface.h:58
Definition: control.h:66