Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
key.h
Go to the documentation of this file.
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 
23 #pragma once
24 
25 #include "ui/control.h"
26 
27 #include "common/event.h"
28 #include "common/restext.h"
29 #include "common/key.h"
30 
31 
32 namespace Ui {
33 
34 class CKey : public CControl
35 {
36 public:
37  CKey();
38  virtual ~CKey();
39 
41  bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
43  bool EventProcess(const Event &event);
44 
46  void Draw();
47 
49 
50  void SetBinding(InputBinding b);
51  InputBinding GetBinding();
53 
54 protected:
56  bool TestKey(unsigned int key);
57 
58 protected:
59  CRobotMain* m_robotMain;
60 
61  InputBinding m_binding;
62  bool m_catch;
63 };
64 
65 
66 } // namespace Ui
67 
bool TestKey(unsigned int key)
Checks if a key is already used.
Definition: key.cpp:109
Definition: robotmain.h:196
Translation and string resource utilities.
void Draw()
Draws button.
Definition: key.cpp:127
2D point
Definition: point.h:46
Key-related macros and enums.
bool EventProcess(const Event &event)
Management of an event.
Definition: key.cpp:64
Event types, structs and event queue.
void SetBinding(InputBinding b)
Management of binding.
Definition: key.cpp:213
Definition: key.h:34
Binding for input slot.
Definition: robotmain.h:171
EventType
Type of event message.
Definition: event.h:35
Event sent by system, interface or game.
Definition: event.h:686
Definition: control.h:64
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
Creates a new key slot button.
Definition: key.cpp:50