UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_input.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 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 {
34  const struct value_s* property;
35  int key;
36  const char* description;
37  bool inherited;
38  struct uiKeyBinding_s* next;
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);
51 void UI_ResetInput(void);
52 
53 /* focus */
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);
61 
62 /* mouse capture */
65 void UI_MouseRelease(void);
66 
67 /* all inputs */
68 void UI_ReleaseInput(void);
void UI_InvalidateMouse(void)
Force to invalidate the mouse position and then to update hover nodes...
Definition: ui_input.cpp:560
int UI_GetKeyBindingCount(void)
Definition: ui_input.cpp:272
bool UI_HasFocus(uiNode_t const *node)
check if a node got the focus
Definition: ui_input.cpp:230
const struct value_s * property
Definition: ui_input.h:34
const char * description
Definition: ui_input.h:36
void UI_RequestFocus(uiNode_t *node)
request the focus for a node
Definition: ui_input.cpp:206
struct uiKeyBinding_s uiKeyBinding_t
unsigned short unicode
Definition: cl_input.cpp:69
void UI_ResetInput(void)
Definition: ui_input.cpp:538
void UI_SetKeyBinding(const char *path, int key, const char *description)
Set a binding from a key to a node to active.
Definition: ui_input.cpp:362
struct uiKeyBinding_s * next
Definition: ui_input.h:38
bool UI_KeyRelease(unsigned int key, unsigned short unicode)
Called by the client when the user released a key.
Definition: ui_input.cpp:413
unsigned int key
Definition: cl_input.cpp:68
uiNode_t * UI_GetHoveredNode(void)
Get the current hovered node.
Definition: ui_input.cpp:552
void UI_MouseScroll(int deltaX, int deltaY)
Called when we are in UI mode and scroll via mousewheel.
Definition: ui_input.cpp:756
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
uiNode_t * node
Definition: ui_input.h:33
QGL_EXTERN GLuint index
Definition: r_gl.h:110
void UI_MouseDown(int x, int y, int button)
Called when we are in UI mode and down a mouse button.
Definition: ui_input.cpp:801
void UI_MouseUp(int x, int y, int button)
Called when we are in UI mode and up a mouse button.
Definition: ui_input.cpp:839
bool UI_KeyPressed(unsigned int key, unsigned short unicode)
Called by the client when the user type a key.
Definition: ui_input.cpp:430
uiNode_t * UI_GetMouseCapture(void)
Return the captured node.
Definition: ui_input.cpp:508
void UI_ReleaseInput(void)
Release all captured input (keyboard or mouse)
Definition: ui_input.cpp:496
uiKeyBinding_t * UI_GetKeyBindingByIndex(int index)
Definition: ui_input.cpp:277
bool inherited
Definition: ui_input.h:37
void UI_MouseRelease(void)
Release the captured node.
Definition: ui_input.cpp:526
bool UI_CheckMouseMove(void)
Call mouse move only if the mouse position change.
Definition: ui_input.cpp:569
void UI_SetMouseCapture(uiNode_t *node)
Captured the mouse into a node.
Definition: ui_input.cpp:516
void UI_RemoveFocus(void)
Definition: ui_input.cpp:241
void UI_MouseMove(int x, int y)
Is called every time the mouse position change.
Definition: ui_input.cpp:588