Gazebo Common

API Reference

4.7.0
gz/common/KeyEvent.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_COMMON_KEYEVENT_HH_
18 #define GZ_COMMON_KEYEVENT_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <gz/common/config.hh>
24 #include <gz/common/events/Export.hh>
26 
27 namespace ignition
28 {
29  namespace common
30  {
31  // Forward declare private data class
32  class KeyEventPrivate;
33 
36  class IGNITION_COMMON_EVENTS_VISIBLE KeyEvent
37  {
39  public: enum EventType {NO_EVENT, PRESS, RELEASE};
40 
42  public: KeyEvent();
43 
46  public: KeyEvent(const KeyEvent &_other);
47 
48  // \brief Move constructor.
50  public: KeyEvent(KeyEvent &&_other);
51 
53  public: ~KeyEvent();
54 
57  public: EventType Type() const;
58 
61  public: void SetType(const EventType _type);
62 
65  public: int Key() const;
66 
69  public: void SetKey(const int _key);
70 
74  public: std::string Text() const;
75 
78  public: void SetText(const std::string &_text);
79 
82  public: bool Control() const;
83 
86  public: void SetControl(const bool _control);
87 
90  public: bool Shift() const;
91 
94  public: void SetShift(const bool _shift);
95 
98  public: bool Alt() const;
99 
102  public: void SetAlt(const bool _alt);
103 
107  public: KeyEvent &operator=(const KeyEvent &_other);
108 
112  public: KeyEvent& operator=(KeyEvent&& other);
113 
116  private: std::unique_ptr<KeyEventPrivate> dataPtr;
118  };
119  }
120 }
121 #endif
Forward declarations for the common classes.
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Microsoft Visual Studio does not automatically export the interface information for member variables ...
Definition: gz/common/SuppressWarning.hh:65
EventType
Key event types enumeration.
Definition: gz/common/KeyEvent.hh:39
Generic description of a keyboard event.
Definition: gz/common/KeyEvent.hh:36
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
Definition: gz/common/SuppressWarning.hh:68