HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_hotkeys.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_hotKeys_h__
10 #define __HOM_hotKeys_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Module.h"
15 #include "HOM_EnumValue.h"
16 #include "HOM_EnumModules.h"
17 #include "HOM_Errors.h"
18 #include <vector>
19 #include <map>
20 
22 
23 SWIGOUT(%rename(hotkeys) HOM_hotkeys;)
25 {
26 public:
27  virtual ~HOM_hotkeys()
28  {}
29 
30  virtual std::string __repr__() = 0;
31 
32  // Hotkey information
33 
34  // NB: The hotkey_symbol overload is deprecated.
35  virtual std::vector<std::string>
36  assignments(
37  const char *hotkey_symbol) = 0;
38  virtual std::vector<std::string>
39  assignments(
40  const char *context,
41  const char *command,
42  bool resolve_refs = true) = 0;
43  virtual std::vector<std::vector<std::string>>
44  assignmentsAsTuples(
45  const char *context,
46  const char *command,
47  bool resolve_refs = true) = 0;
48  virtual std::string hotkeyDescription(
49  const char *hotkey_symbol) = 0;
50  virtual std::string hotkeyLabel(
51  const char *hotkey_symbol) = 0;
52  virtual bool isKeyMatch(const char *key,
53  const char *hotkey_symbol) = 0;
54  virtual bool isKeycodeMatch(int key_code,
55  const char *hotkey_symbol) = 0;
56  virtual std::vector<std::string>
57  findConflicts(const char *hotkey_symbol,
58  const char *key) = 0;
59  virtual std::vector<std::string>
60  findConflicts(
61  const char *context,
62  const char *command,
63  const char *key) = 0;
64 
65  virtual std::vector<std::vector<std::string> >
66  resolveAssignments(const std::vector<std::string> &contexts,
67  const std::vector<std::string> &hotkey_symbols) = 0;
68 
69  virtual int changeIndex() = 0;
70 
71 
72  // Functions for manager UI
73  virtual std::vector< std::map<std::string, std::string> >
74  commandsInContext(const char * context) = 0;
75 
76  virtual std::vector< std::map<std::string, std::string> >
77  contextsInContext(const char *context) = 0;
78 
79  virtual std::vector< std::map<std::string, std::string> >
80  commandCategoriesInCategory(
81  const char *category) = 0;
82 
83  virtual std::vector< std::map<std::string, std::string> >
84  commandsInCategory(
85  const char *category) = 0;
86 
87  virtual std::vector< std::map<std::string, std::string> >
88  commandBindingsInContext(
89  const char *context) = 0;
90 
91 
92  // Modify hotkeys and key assignments
93  virtual bool addCommand(
94  const char *hotkey_symbol,
95  const char *label,
96  const char *description,
97  const std::vector<std::string> &assignments = std::vector<std::string>()) = 0;
98 
99  virtual bool addContext(const char *hotkey_symbol,
100  const char *label,
101  const char *description) = 0;
102 
103  virtual void installDefinitions(
104  HOM_PluginHotkeyDefinitions const & definitions) = 0;
105  virtual void uninstallDefinitions(
106  HOM_PluginHotkeyDefinitions const & definitions) = 0;
107 
108  virtual bool addCommandBinding(
109  const char *context,
110  const char *command) = 0;
111  virtual bool removeCommandBinding(
112  const char *context,
113  const char *command) = 0;
114 
115 
116  virtual void removeHotkeySymbol(
117  const char* hotkey_symbol) = 0;
118 
119  virtual std::string hotkeySymbol(
120  const char *english_context,
121  const char *english_command = nullptr) = 0;
122  virtual bool clearAssignments(
123  const char *hotkey_symbol) = 0;
124  // NB: The hotkey_symbol overload is deprecated.
125  virtual bool addAssignment(const char *hotkey_symbol,
126  const char *key) = 0;
127  // NB: The hotkey_symbol overload is deprecated.
128  virtual bool removeAssignment(const char *hotkey_symbol,
129  const char *key) = 0;
130  // NB: The hotkey_symbol overload is deprecated.
131  virtual bool clearAssignments(
132  const char *context,
133  const char *command) = 0;
134  virtual bool addAssignment(
135  const char *context,
136  const char *command,
137  const char *key) = 0;
138  virtual bool removeAssignment(
139  const char *context,
140  const char *command,
141  const char *key) = 0;
142 
143  virtual std::map<std::string, std::vector<std::string> >
144  _getHotkeysStatus(
145  const char *hotkey_symbol,
146  const std::vector<std::string> &layout_keys,
147  int modifier_mask = 0) = 0;
148 
149  // NB: The hotkey_symbol overload is deprecated.
150  virtual std::vector<int> availableKeycodes(
151  const char *hotkey_symbol,
152  const std::vector<int> &layout_keycodes,
153  int modifier_mask = 0) = 0;
154 
155  virtual std::vector<int> availableKeycodes(
156  const char *context,
157  const char *command,
158  const std::vector<int> &layout_keycodes,
159  int modifier_mask = 0) = 0;
160 
161 
162  // Key utilities
163  virtual std::string keycodeToString(int keycode,
164  short modifiers = 0) = 0;
165  virtual int stringToKeycode(const char *key,
166  short modifiers = 0) = 0;
167 
168  virtual std::vector<std::string>
169  splitKeySequenceString(const char *key) = 0;
170 
171 
172  // backup/restore/save
173  virtual void _createBackupTables() = 0;
174  virtual void _restoreBackupTables() = 0;
175  virtual void revertToDefaults(
176  const char *hotkey_symbol,
177  bool one_level_only) = 0;
178  virtual void revertToDefaults(
179  const char *context,
180  const char *command,
181  bool one_level_only) = 0;
182  virtual bool saveOverrides() = 0;
183 
184 
185  // Keymaps
186  virtual bool saveAsKeymap(
187  const char *name,
188  const char *path = nullptr) = 0;
189  virtual bool loadKeymap(
190  const char *name,
191  const char *path = nullptr) = 0;
192  virtual bool importKeymap(const char *name,
193  const char *path) = 0;
194  virtual std::vector<std::pair<std::string, std::string> >
195  keymaps() = 0;
196  virtual std::string currentKeymap() = 0;
197 };
198 
199 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual ~HOM_hotkeys()
Definition: HOM_hotkeys.h:27
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
virtual void addCommand(std::string const &symbol, std::string const &label, std::string const &description)=0
virtual void addContext(std::string const &symbol, std::string const &label, std::string const &description)=0
#define HOM_API
Definition: HOM_API.h:13
GLuint const GLchar * name
Definition: glcorearb.h:786
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)