accelerator_key.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Harry Storbacka
27 */
28 
29 
30 #pragma once
31 
32 #include "api_gui.h"
33 #include <memory>
34 #include "../Core/Signals/callback_v2.h"
35 #include "../GUI/gui_message.h"
36 #include "../GUI/gui_message_input.h"
37 #include <vector>
38 
39 namespace clan
40 {
43 
44 class AcceleratorKey_Impl;
45 
48 {
51 
52 public:
55 
62  AcceleratorKey(int id, int mod1=-1, int mod2=-1, int mod3=-1);
63 
65 
69 
70 public:
72 
76  bool get_shift() const;
77 
81  bool get_alt() const;
82 
86  bool get_ctrl() const;
87 
91  int get_id() const;
92 
94  bool is_null() const { return !impl; }
95 
97  void throw_if_null() const;
98 
99 
103 
104 public:
105 
107  void set_shift(bool);
108 
110  void set_alt(bool);
111 
113  void set_ctrl(bool);
114 
116  void set_id(int);
117 
118 
122 
123 private:
124  std::shared_ptr<AcceleratorKey_Impl> impl;
126 };
127 
128 }
129 
void set_shift(bool)
Set Shift.
bool is_null() const
Returns true if this object is invalid.
Definition: accelerator_key.h:94
void throw_if_null() const
Throw an exception if this object is invalid.
void set_alt(bool)
Set Alt.
Callback_v2.
Definition: callback_v2.h:156
bool get_shift() const
Get Shift.
bool get_ctrl() const
Get Ctrl.
void set_ctrl(bool)
Set Ctrl.
Callback_v2< std::shared_ptr< GUIMessage > &, AcceleratorKey > & func_pressed()
AcceleratorKey()
Constructs a null instance.
bool get_alt() const
Get Alt.
GUI Accelerator Table Entry.
Definition: accelerator_key.h:47
int get_id() const
Get Id.
void set_id(int)
Set Id.