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