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 INVALID_KEY 0x00
57 #define BACKSPACE_KEY 0x08
58 #define DELETE_KEY 0x7F
59 #define RETURN_KEY 0x0A
60 #define ENTER_KEY 0x0D
61 #define ESC_KEY 0x1B
62 #define TAB_KEY 0x09
63 
64 #define KEYCMP(symbol) (UI_Object::keycmp(symbol,key))
65 // Version of KEYCMP that suppresses the hotkey echoing to the error manager.
66 // UI_ErrorManager::displayHotkeyMessage() can be called later to echo a
67 // custom message.
68 #define KEYCMP_SILENT(symbol) \
69  (UI_Object::keycmp(symbol, key, UI_HotkeyEcho::theNullEcho))
70 // Version of KEYCMP that takes a custom UI_HotkeyEcho object to customize the
71 // echoing of hotkeys to the error manager.
72 #define KEYCMP_CUSTOM_ECHO(symbol, echo) (UI_Object::keycmp(symbol, key, echo))
73 
74 //
75 // ------------- Hotkey definitions: ----------------
76 //
77 
78 // Global:
79 #define UI_CMD_CUT "h.cut"
80 #define UI_CMD_COPY "h.copy"
81 #define UI_CMD_PASTE "h.paste"
82 #define UI_CMD_UNDO "h.undo"
83 #define UI_CMD_REDO "h.redo"
84 #define UI_CMD_FIND "h.find"
85 
86 // For the UI Inputfield:
87 #define UI_CMD_IFIELD_EDITOR "inputfield.editor"
88 #define UI_CMD_IFIELD_UNDO "inputfield.undo"
89 #define UI_CMD_IFIELD_HOME "inputfield.home"
90 #define UI_CMD_IFIELD_END "inputfield.end"
91 #define UI_CMD_IFIELD_UP "inputfield.up"
92 #define UI_CMD_IFIELD_DOWN "inputfield.down"
93 #define UI_CMD_IFIELD_PREV "inputfield.prev"
94 #define UI_CMD_IFIELD_NEXT "inputfield.next"
95 #define UI_CMD_IFIELD_SELECT_HOME "inputfield.select_home"
96 #define UI_CMD_IFIELD_SELECT_END "inputfield.select_end"
97 #define UI_CMD_IFIELD_SELECT_UP "inputfield.select_up"
98 #define UI_CMD_IFIELD_SELECT_DOWN "inputfield.select_down"
99 #define UI_CMD_IFIELD_SELECT_PREV "inputfield.select_prev"
100 #define UI_CMD_IFIELD_SELECT_NEXT "inputfield.select_next"
101 #define UI_CMD_IFIELD_SELECT_ALL "inputfield.select_all"
102 #define UI_CMD_IFIELD_BACKTAB "inputfield.backtab"
103 #define UI_CMD_IFIELD_JUMP_TO_MATCH "inputfield.jump_match"
104 #define UI_CMD_IFIELD_CONTEXT_HELP "inputfield.context_help"
105 #define UI_CMD_IFIELD_PREV_WORD "inputfield.prev_word"
106 #define UI_CMD_IFIELD_NEXT_WORD "inputfield.next_word"
107 #define UI_CMD_IFIELD_SELECT_PREV_WORD "inputfield.select_prev_word"
108 #define UI_CMD_IFIELD_SELECT_NEXT_WORD "inputfield.select_next_word"
109 #define UI_CMD_IFIELD_AUTOCOMPLETE "inputfield.autocomplete"
110 
111 // For the UI Textport and UI_TextEditor:
112 #define UI_CMD_TXTPORT_PREV "h.pane.textport.prev"
113 #define UI_CMD_TXTPORT_NEXT "h.pane.textport.next"
114 #define UI_CMD_TXTPORT_UP "h.pane.textport.up"
115 #define UI_CMD_TXTPORT_DOWN "h.pane.textport.down"
116 #define UI_CMD_TXTPORT_PAGEUP "h.pane.textport.pageup"
117 #define UI_CMD_TXTPORT_PAGEDOWN "h.pane.textport.pagedown"
118 #define UI_CMD_TXTPORT_TOP "h.pane.textport.top"
119 #define UI_CMD_TXTPORT_BOTTOM "h.pane.textport.bottom"
120 #define UI_CMD_TXTPORT_FIRSTLINE "h.pane.textport.firstline"
121 #define UI_CMD_TXTPORT_LASTLINE "h.pane.textport.lastline"
122 #define UI_CMD_TXTPORT_PREVWORD "h.pane.textport.prevword"
123 #define UI_CMD_TXTPORT_NEXTWORD "h.pane.textport.nextword"
124 #define UI_CMD_TXTPORT_SELECTPREV "h.pane.textport.selectprev"
125 #define UI_CMD_TXTPORT_SELECTNEXT "h.pane.textport.selectnext"
126 #define UI_CMD_TXTPORT_SELECTUP "h.pane.textport.selectup"
127 #define UI_CMD_TXTPORT_SELECTDOWN "h.pane.textport.selectdown"
128 #define UI_CMD_TXTPORT_SELECTPAGEUP "h.pane.textport.selectpageup"
129 #define UI_CMD_TXTPORT_SELECTPAGEDOWN "h.pane.textport.selectpagedown"
130 #define UI_CMD_TXTPORT_SELECTTOP "h.pane.textport.selecttop"
131 #define UI_CMD_TXTPORT_SELECTBOTTOM "h.pane.textport.selectbottom"
132 #define UI_CMD_TXTPORT_SELECTFIRSTLINE "h.pane.textport.selectfirstline"
133 #define UI_CMD_TXTPORT_SELECTLASTLINE "h.pane.textport.selectlastline"
134 #define UI_CMD_TXTPORT_SELECTPREVWORD "h.pane.textport.selectprevword"
135 #define UI_CMD_TXTPORT_SELECTNEXTWORD "h.pane.textport.selectnextword"
136 #define UI_CMD_TXTPORT_EDITOR "h.pane.textport.editor"
137 #define UI_CMD_TXTPORT_MATCH_PAREN "h.pane.textport.match_paren"
138 #define UI_CMD_TXTPORT_SEARCH_AND_REPLACE "h.pane.textport.search_and_replace"
139 #define UI_CMD_TXTPORT_JUMP_TO_LINE "h.pane.textport.jump_to_line"
140 #define UI_CMD_TXTPORT_COMMENT_OUT "h.pane.textport.comment_out"
141 #define UI_CMD_TXTPORT_UNCOMMENT "h.pane.textport.uncomment"
142 #define UI_CMD_TXTPORT_TOGGLE_COMMENT "h.pane.textport.toggle_comment"
143 #define UI_CMD_TXTPORT_ZOOM_IN "h.pane.textport.zoom_in"
144 #define UI_CMD_TXTPORT_ZOOM_OUT "h.pane.textport.zoom_out"
145 #define UI_CMD_TXTPORT_ZOOM_RESET "h.pane.textport.zoom_reset"
146 
147 // For the UI Window
148 #define UI_CMD_CONTEXT_HELP "h.context_help"
149 
150 #endif