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::string hotkeyDescription(
44  const char *hotkey_symbol) = 0;
45  virtual std::string hotkeyLabel(
46  const char *hotkey_symbol) = 0;
47  virtual bool isKeyMatch(const char *key,
48  const char *hotkey_symbol) = 0;
49  virtual bool isKeycodeMatch(int key_code,
50  const char *hotkey_symbol) = 0;
51  virtual std::vector<std::string>
52  findConflicts(const char *hotkey_symbol,
53  const char *key) = 0;
54  virtual std::vector<std::string>
55  findConflicts(
56  const char *context,
57  const char *command,
58  const char *key) = 0;
59 
60  virtual std::vector<std::vector<std::string> >
61  resolveAssignments(const std::vector<std::string> &contexts,
62  const std::vector<std::string> &hotkey_symbols) = 0;
63 
64  virtual int changeIndex() = 0;
65 
66 
67  // Functions for manager UI
68  virtual std::vector< std::map<std::string, std::string> >
69  commandsInContext(const char * context) = 0;
70 
71  virtual std::vector< std::map<std::string, std::string> >
72  contextsInContext(const char *context) = 0;
73 
74  virtual std::vector< std::map<std::string, std::string> >
75  commandCategoriesInCategory(
76  const char *category) = 0;
77 
78  virtual std::vector< std::map<std::string, std::string> >
79  commandsInCategory(
80  const char *category) = 0;
81 
82  virtual std::vector< std::map<std::string, std::string> >
83  commandBindingsInContext(
84  const char *context) = 0;
85 
86 
87  // Modify hotkeys and key assignments
88  virtual bool addCommand(
89  const char *hotkey_symbol,
90  const char *label,
91  const char *description,
92  const std::vector<std::string> &assignments = std::vector<std::string>()) = 0;
93 
94  virtual bool addContext(const char *hotkey_symbol,
95  const char *label,
96  const char *description) = 0;
97 
98  virtual void installDefinitions(
99  HOM_PluginHotkeyDefinitions const & definitions) = 0;
100  virtual void uninstallDefinitions(
101  HOM_PluginHotkeyDefinitions const & definitions) = 0;
102 
103  virtual bool addCommandBinding(
104  const char *context,
105  const char *command) = 0;
106  virtual bool removeCommandBinding(
107  const char *context,
108  const char *command) = 0;
109 
110 
111  virtual void removeHotkeySymbol(
112  const char* hotkey_symbol) = 0;
113 
114  virtual std::string hotkeySymbol(
115  const char *english_context,
116  const char *english_command = nullptr) = 0;
117  virtual bool clearAssignments(
118  const char *hotkey_symbol) = 0;
119  // NB: The hotkey_symbol overload is deprecated.
120  virtual bool addAssignment(const char *hotkey_symbol,
121  const char *key) = 0;
122  // NB: The hotkey_symbol overload is deprecated.
123  virtual bool removeAssignment(const char *hotkey_symbol,
124  const char *key) = 0;
125  // NB: The hotkey_symbol overload is deprecated.
126  virtual bool clearAssignments(
127  const char *context,
128  const char *command) = 0;
129  virtual bool addAssignment(
130  const char *context,
131  const char *command,
132  const char *key) = 0;
133  virtual bool removeAssignment(
134  const char *context,
135  const char *command,
136  const char *key) = 0;
137 
138  virtual std::map<std::string, std::vector<std::string> >
139  _getHotkeysStatus(
140  const char *hotkey_symbol,
141  const std::vector<std::string> &layout_keys,
142  int modifier_mask = 0) = 0;
143 
144  // NB: The hotkey_symbol overload is deprecated.
145  virtual std::vector<int> availableKeycodes(
146  const char *hotkey_symbol,
147  const std::vector<int> &layout_keycodes,
148  int modifier_mask = 0) = 0;
149 
150  virtual std::vector<int> availableKeycodes(
151  const char *context,
152  const char *command,
153  const std::vector<int> &layout_keycodes,
154  int modifier_mask = 0) = 0;
155 
156 
157  // Key utilities
158  virtual std::string keycodeToString(int keycode,
159  short modifiers = 0) = 0;
160  virtual int stringToKeycode(const char *key,
161  short modifiers = 0) = 0;
162 
163 
164  // backup/restore/save
165  virtual void _createBackupTables() = 0;
166  virtual void _restoreBackupTables() = 0;
167  virtual void revertToDefaults(
168  const char *hotkey_symbol,
169  bool one_level_only) = 0;
170  virtual void revertToDefaults(
171  const char *context,
172  const char *command,
173  bool one_level_only) = 0;
174  virtual bool saveOverrides() = 0;
175 
176 
177  // Keymaps
178  virtual bool saveAsKeymap(
179  const char *name,
180  const char *path = nullptr) = 0;
181  virtual bool loadKeymap(
182  const char *name,
183  const char *path = nullptr) = 0;
184  virtual bool importKeymap(const char *name,
185  const char *path) = 0;
186  virtual std::vector<std::pair<std::string, std::string> >
187  keymaps() = 0;
188  virtual std::string currentKeymap() = 0;
189 };
190 
191 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual ~HOM_hotkeys()
Definition: HOM_hotkeys.h:27
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
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:349
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)