1 /**
2  * @file
3  */
4 
5 /*
6 Copyright (C) 2002-2013 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 /* prototype */
28 struct uiNode_t;
29 
30 #define UI_MAX_KEYBINDING	128
31 
32 typedef struct uiKeyBinding_s {
33 	uiNode_t* node;						/**< Node target. */
34 	const struct value_s* property;		/**< Property target, else nullptr. */
35 	int key;							/**< Keynum to catch. */
36 	const char* description;			/**< Description of this binding */
37 	bool inherited;						/**< True if this binding is inherited from another binding. */
38 	struct uiKeyBinding_s* next;		/**< Next binding from the window list. */
39 } uiKeyBinding_t;
40 
41 void UI_SetKeyBinding(const char* path, int key, const char* description);
42 
43 /* mouse input */
44 void UI_MouseScroll(int deltaX, int deltaY);
45 void UI_MouseMove(int x, int y);
46 void UI_MouseDown(int x, int y, int button);
47 void UI_MouseUp(int x, int y, int button);
48 void UI_InvalidateMouse(void);
49 bool UI_CheckMouseMove(void);
50 uiNode_t* UI_GetHoveredNode(void);
51 void UI_ResetInput(void);
52 
53 /* focus */
54 void UI_RequestFocus(uiNode_t* node);
55 bool UI_HasFocus(uiNode_t const* node);
56 void UI_RemoveFocus(void);
57 bool UI_KeyRelease(unsigned int key, unsigned short unicode);
58 bool UI_KeyPressed(unsigned int key, unsigned short unicode);
59 int UI_GetKeyBindingCount(void);
60 uiKeyBinding_t* UI_GetKeyBindingByIndex(int index);
61 
62 /* mouse capture */
63 uiNode_t* UI_GetMouseCapture(void);
64 void UI_SetMouseCapture(uiNode_t* node);
65 void UI_MouseRelease(void);
66 
67 /* all inputs */
68 void UI_ReleaseInput(void);
69