HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UI_HotkeyHelper.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
* NAME: UI_HotkeyHelper.h (UI Library, C++)
7
*
8
* COMMENTS: Helper class for hotkey handling
9
*/
10
11
#ifndef __UI_HOTKEYHELPER_H__
12
#define __UI_HOTKEYHELPER_H__
13
14
#include "
UI_API.h
"
15
#include <
UT/UT_PtrProxy.h
>
16
#include <
UT/UT_StringMap.h
>
17
#include "
UI_Object.h
"
18
19
class
UI_Event
;
20
21
/// Hotkey handler method. Returns true if successfully consumed.
22
typedef
bool (
UI_Object
::*
UI_HotkeyMethod
)(
int
key,
UI_Event
*);
23
24
25
/// The UI_HotkeyHelper class allows one to maintain a table of hotkeys and
26
/// their associated handler functions (of type UI_HotkeyMethod) so that we
27
/// can easily perform functions like dispatching hotkey handlers as well as
28
/// testing to see if a hotkey is going to be handled without invoking the
29
/// handler.
30
class
UI_API
UI_HotkeyHelper
31
{
32
public
:
33
struct
Entry
34
{
35
const
char
*
mySymbol
;
36
UI_HotkeyMethod
myMethod
;
37
bool
myEchoFlag
;
38
};
39
40
/// Default constructor
41
UI_HotkeyHelper
(
UI_Object
*client);
42
/// Construct via array of hotkey entries terminated by nullptr mySymbol.
43
UI_HotkeyHelper
(
UI_Object
*client,
const
Entry
*hotkey_entries);
44
/// Destructor
45
virtual
~
UI_HotkeyHelper
();
46
47
/// Adds an array of hotkey entries terminated by nullptr mySymbol.
48
void
addHotkeys(
const
Entry
*hotkey_entries);
49
/// Add a single hotkey entry
50
void
addHotkey(
const
Entry
&entry);
51
/// Remove a hotkey entry
52
void
removeHotkey(
const
char
*symbol);
53
54
/// Invoke the handler for the given UI hotkey event.
55
/// Returns true if consumed, false otherwise.
56
bool
processHotkey(
int
key,
UI_Event
*
event
);
57
58
/// Will we handle the given UI hotkey symbol?
59
bool
willProcessHotkey(
int
key,
UI_Event
*
event
);
60
61
private
:
// methods
62
63
UI_HotkeyHelper
(
const
UI_HotkeyHelper
&
copy
);
// not yet done
64
UI_HotkeyHelper
&
operator=
(
const
UI_HotkeyHelper
&
copy
);
// not yet done
65
66
struct
TableEntry
67
{
68
TableEntry(
UI_HotkeyMethod
method,
bool
echo)
69
: myMethod(method), myEchoFlag(echo) {}
70
71
UI_HotkeyMethod
myMethod;
72
bool
myEchoFlag;
73
};
74
75
private
:
// data
76
77
UT_RefProxy<UI_Object>
myClient;
78
UT_StringMap<TableEntry>
myTable;
79
80
};
81
82
#endif // __UI_HOTKEYHELPER_H__
UI_Object.h
UT_StringMap< TableEntry >
UI_HotkeyHelper::Entry
Definition:
UI_HotkeyHelper.h:33
Filesystem::copy
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
UT_RefProxy< UI_Object >
UI_HotkeyHelper::Entry::myMethod
UI_HotkeyMethod myMethod
Definition:
UI_HotkeyHelper.h:36
UI_Object
Definition:
UI_Object.h:45
UT_PtrProxy.h
event
struct _cl_event * event
Definition:
glcorearb.h:2961
UI_HotkeyHelper::Entry::mySymbol
const char * mySymbol
Definition:
UI_HotkeyHelper.h:35
UI_HotkeyHelper
Definition:
UI_HotkeyHelper.h:30
UI_HotkeyHelper::Entry::myEchoFlag
bool myEchoFlag
Definition:
UI_HotkeyHelper.h:37
UI_Event
Definition:
UI_Event.h:17
UI_HotkeyMethod
bool(UI_Object::* UI_HotkeyMethod)(int key, UI_Event *)
Hotkey handler method. Returns true if successfully consumed.
Definition:
UI_HotkeyHelper.h:22
UI_API.h
nanovdb::operator=
LeafData & operator=(const LeafData &)=delete
UI_API
#define UI_API
Definition:
UI_API.h:10
UT_StringMap.h
UI
UI_HotkeyHelper.h
Generated on Fri Nov 8 2024 03:41:40 for HDK by
1.8.6