Gazebo Common

API Reference

6.0.0
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/events/Export.hh>
24#include <gz/utils/SuppressWarning.hh>
25
26namespace gz
27{
28 namespace common
29 {
30 // Forward declare private data class
31 class KeyEventPrivate;
32
35 class GZ_COMMON_EVENTS_VISIBLE KeyEvent
36 {
38 public: enum EventType {NO_EVENT, PRESS, RELEASE};
39
41 public: KeyEvent();
42
45 public: KeyEvent(const KeyEvent &_other);
46
47 // \brief Move constructor.
49 public: KeyEvent(KeyEvent &&_other);
50
52 public: ~KeyEvent();
53
56 public: EventType Type() const;
57
60 public: void SetType(EventType _type);
61
64 public: int Key() const;
65
68 public: void SetKey(int _key);
69
73 public: std::string Text() const;
74
77 public: void SetText(const std::string &_text);
78
81 public: bool Control() const;
82
85 public: void SetControl(bool _control);
86
89 public: bool Shift() const;
90
93 public: void SetShift(bool _shift);
94
97 public: bool Alt() const;
98
101 public: void SetAlt(bool _alt);
102
106 public: KeyEvent &operator=(const KeyEvent &_other);
107
111 public: KeyEvent& operator=(KeyEvent&& other);
112
113 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
115 private: std::unique_ptr<KeyEventPrivate> dataPtr;
116 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
117 };
118 }
119}
120#endif