Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
p_extras.h
1 /* Libmacro - A multi-platform, extendable macro and hotkey C library
2  Copyright (C) 2013 Jonathan Pelletier, New Paradigm Software
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef MCR_EXTRAS_LINUX_P_EXTRAS_H_
20 #define MCR_EXTRAS_LINUX_P_EXTRAS_H_
21 
22 #include "mcr/extras/base_cpp.h"
24 
25 #include "mcr/extras/util/string.h"
26 
27 namespace mcr
28 {
29 class LibmacroPrivate;
31 class LibmacroPlatformPrivate;
32 class MCR_API LibmacroPlatform final
33 {
34  friend struct Libmacro;
35  friend class LibmacroPrivate;
36  friend class LibmacroPlatformPrivate;
37 public:
38  LibmacroPlatform(Libmacro &context);
39  LibmacroPlatform(const LibmacroPlatform &copytron);
41  LibmacroPlatform &operator =(const LibmacroPlatform &copytron);
42 
43  size_t echo(const mcr_Key &val) const;
44  mcr_Key echoKey(size_t echo) const;
45  size_t setEcho(const mcr_Key &val, bool updateFlag = true);
46  size_t echoCount() const;
47  void removeEcho(size_t code);
48  void updateEchos();
49 
50  // key=>echo
51  // grab path add, remove, set all
52  size_t grabCount() const;
53  void setGrabCount(size_t count, bool updateFlag = true);
54  String grab(size_t index) const;
55  void setGrab(size_t index, const String &value, bool updateFlag = true);
56  inline void setGrab(size_t index, const std::string &value, bool updateFlag = true)
57  {
58  setGrab(index, String(value.c_str(), value.size()), updateFlag);
59  }
60  void updateGrabs();
61 
62  void clear();
63 
64  static inline bool valid(mcr_ApplyType keyApply)
65  {
66  return keyApply == MCR_SET || keyApply == MCR_UNSET;
67  }
68 
69 private:
70  Libmacro *_context;
71  LibmacroPlatformPrivate *_private;
72 
73  void initialize();
74  void reset();
75 };
76 }
77 
78 #endif
Definition: types.h:162
Definition: key.h:38
Read from grabbers and dispatch signals. This may block incoming events.
Libmacro, by Jonathan Pelletier, New Paradigm Software. Alpha version.
Definition: classes.h:31
mcr_ApplyType
Definition: types.h:160