HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UI_KeyBindings.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_KeyBindings.h ( UI Library, C++)
7  *
8  * COMMENTS:
9  * All apps and directories that define key bindings should include us.
10  */
11 #ifndef __UI_KeyBindings_h__
12 #define __UI_KeyBindings_h__
13 
14 #define COMMAND_KEY_BIT 0x40000000
15 #define OTHER_KEY_BIT 0x20000000
16 #define ARROW_KEY_BIT 0x10000000
17 #define FUNCTION_KEY_BIT 0x08000000
18 #define ALT_KEY_BIT 0x04000000
19 #define CTRL_KEY_BIT 0x02000000
20 #define SHIFT_KEY_BIT 0x01000000
21 #define CONFLICT_KEY_BIT 0x00800000 // Special bit for the hotkey manager
22 #define CONFLICT_ANCESTOR_KEY_BIT 0x00400000 // Special bit for the hotkey manager
23 #define CONFLICT_DESCENDANT_KEY_BIT 0x00200000 // Special bit for the hotkey manager
24 #define CHARACTER_BITS 0x001FFFFF // Unicode range.
25 #define SPECIAL_BITS (~CHARACTER_BITS)
26 #define MODIFIER_BITS (SHIFT_KEY_BIT|CTRL_KEY_BIT|ALT_KEY_BIT|COMMAND_KEY_BIT)
27 
28 #define KEY_IS_ALTED(key) ((key) & ALT_KEY_BIT)
29 #define KEY_IS_CTRLED(key) ((key) & CTRL_KEY_BIT)
30 #define KEY_IS_SHIFTED(key) ((key) & SHIFT_KEY_BIT)
31 #define KEY_IS_COMMANDED(key) ((key) & COMMAND_KEY_BIT)
32 
33 #define KEY_IS_ARROW(key) ((key) & ARROW_KEY_BIT)
34 #define KEY_IS_OTHER(key) ((key) & OTHER_KEY_BIT)
35 #define KEY_IS_FUNCTION(key) ((key) & FUNCTION_KEY_BIT)
36 #define KEY_CHAR_ONLY(key) ((key) & CHARACTER_BITS)
37 #define KEY_SPECIAL_ONLY(key) ((key) & SPECIAL_BITS)
38 #define KEY_NO_CONFLICT(key) ((key) & ~(CONFLICT_KEY_BIT | CONFLICT_ANCESTOR_KEY_BIT | CONFLICT_DESCENDANT_KEY_BIT))
39 #define KEY_HAS_MODIFIERS(key) (((key) & MODIFIER_BITS)!=0)
40 
41 #define ALT_KEY(key) ((key) | ALT_KEY_BIT)
42 #define CTRL_KEY(key) ((key) | CTRL_KEY_BIT)
43 #define SHIFT_KEY(key) ((key) | SHIFT_KEY_BIT)
44 #define COMMAND_KEY(key) ((key) | COMMAND_KEY_BIT)
45 #define OTHER_KEY(key) ((key) | OTHER_KEY_BIT)
46 #define ARROW_KEY(key) ((key) | ARROW_KEY_BIT)
47 #define FUNCTION_KEY(key) ((key) | FUNCTION_KEY_BIT)
48 
49 #define NO_ALT_KEY(key) ((key) & ~ALT_KEY_BIT)
50 #define NO_CTRL_KEY(key) ((key) & ~CTRL_KEY_BIT)
51 #define NO_SHIFT_KEY(key) ((key) & ~SHIFT_KEY_BIT)
52 #define NO_COMMAND_KEY(key) ((key) & ~COMMAND_KEY_BIT)
53 #define NO_MODIFIER_KEY(key) (((key) & MODIFIER_BITS)==0)
54 
55 
56 #define BACKSPACE_KEY 0x08
57 #define DELETE_KEY 0x7F
58 #define RETURN_KEY 0x0A
59 #define ENTER_KEY 0x0D
60 #define ESC_KEY 0x1B
61 #define TAB_KEY 0x09
62 
63 #define KEYCMP(symbol) (UI_Object::keycmp(symbol,key))
64 // Version of KEYCMP that suppresses the hotkey echoing to the error manager.
65 // UI_ErrorManager::displayHotkeyMessage() can be called later to echo a
66 // custom message.
67 #define KEYCMP_SILENT(symbol) \
68  (UI_Object::keycmp(symbol, key, UI_HotkeyEcho::theNullEcho))
69 // Version of KEYCMP that takes a custom UI_HotkeyEcho object to customize the
70 // echoing of hotkeys to the error manager.
71 #define KEYCMP_CUSTOM_ECHO(symbol, echo) (UI_Object::keycmp(symbol, key, echo))
72 
73 //
74 // ------------- Hotkey definitions: ----------------
75 //
76 
77 // Global:
78 #define UI_CMD_CUT "h.cut"
79 #define UI_CMD_COPY "h.copy"
80 #define UI_CMD_PASTE "h.paste"
81 #define UI_CMD_UNDO "h.undo"
82 #define UI_CMD_REDO "h.redo"
83 #define UI_CMD_FIND "h.find"
84 
85 // For the UI Inputfield:
86 #define UI_CMD_IFIELD_EDITOR "inputfield.editor"
87 #define UI_CMD_IFIELD_UNDO "inputfield.undo"
88 #define UI_CMD_IFIELD_HOME "inputfield.home"
89 #define UI_CMD_IFIELD_END "inputfield.end"
90 #define UI_CMD_IFIELD_UP "inputfield.up"
91 #define UI_CMD_IFIELD_DOWN "inputfield.down"
92 #define UI_CMD_IFIELD_PREV "inputfield.prev"
93 #define UI_CMD_IFIELD_NEXT "inputfield.next"
94 #define UI_CMD_IFIELD_SELECT_HOME "inputfield.select_home"
95 #define UI_CMD_IFIELD_SELECT_END "inputfield.select_end"
96 #define UI_CMD_IFIELD_SELECT_UP "inputfield.select_up"
97 #define UI_CMD_IFIELD_SELECT_DOWN "inputfield.select_down"
98 #define UI_CMD_IFIELD_SELECT_PREV "inputfield.select_prev"
99 #define UI_CMD_IFIELD_SELECT_NEXT "inputfield.select_next"
100 #define UI_CMD_IFIELD_SELECT_ALL "inputfield.select_all"
101 #define UI_CMD_IFIELD_BACKTAB "inputfield.backtab"
102 #define UI_CMD_IFIELD_JUMP_TO_MATCH "inputfield.jump_match"
103 #define UI_CMD_IFIELD_CONTEXT_HELP "inputfield.context_help"
104 #define UI_CMD_IFIELD_PREV_WORD "inputfield.prev_word"
105 #define UI_CMD_IFIELD_NEXT_WORD "inputfield.next_word"
106 #define UI_CMD_IFIELD_SELECT_PREV_WORD "inputfield.select_prev_word"
107 #define UI_CMD_IFIELD_SELECT_NEXT_WORD "inputfield.select_next_word"
108 #define UI_CMD_IFIELD_AUTOCOMPLETE "inputfield.autocomplete"
109 
110 // For the UI Textport and UI_TextEditor:
111 #define UI_CMD_TXTPORT_PAGEUP "h.pane.textport.pageup"
112 #define UI_CMD_TXTPORT_PAGEDOWN "h.pane.textport.pagedown"
113 #define UI_CMD_TXTPORT_TOP "h.pane.textport.top"
114 #define UI_CMD_TXTPORT_BOTTOM "h.pane.textport.bottom"
115 #define UI_CMD_TXTPORT_FIRSTLINE "h.pane.textport.firstline"
116 #define UI_CMD_TXTPORT_LASTLINE "h.pane.textport.lastline"
117 #define UI_CMD_TXTPORT_SELECTPAGEUP "h.pane.textport.selectpageup"
118 #define UI_CMD_TXTPORT_SELECTPAGEDOWN "h.pane.textport.selectpagedown"
119 #define UI_CMD_TXTPORT_SELECTTOP "h.pane.textport.selecttop"
120 #define UI_CMD_TXTPORT_SELECTBOTTOM "h.pane.textport.selectbottom"
121 #define UI_CMD_TXTPORT_SELECTFIRSTLINE "h.pane.textport.selectfirstline"
122 #define UI_CMD_TXTPORT_SELECTLASTLINE "h.pane.textport.selectlastline"
123 #define UI_CMD_TXTPORT_EDITOR "h.pane.textport.editor"
124 #define UI_CMD_TXTPORT_MATCH_PAREN "h.pane.textport.match_paren"
125 #define UI_CMD_TXTPORT_SEARCH_AND_REPLACE "h.pane.textport.search_and_replace"
126 #define UI_CMD_TXTPORT_JUMP_TO_LINE "h.pane.textport.jump_to_line"
127 #define UI_CMD_TXTPORT_COMMENT_OUT "h.pane.textport.comment_out"
128 #define UI_CMD_TXTPORT_UNCOMMENT "h.pane.textport.uncomment"
129 
130 // For the UI Window
131 #define UI_CMD_CONTEXT_HELP "h.context_help"
132 
133 #endif