Blender  V2.93
wm_event_system.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2007 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 /* return value of handler-operator call */
27 #define WM_HANDLER_CONTINUE 0
28 #define WM_HANDLER_BREAK 1
29 #define WM_HANDLER_HANDLED 2
30 #define WM_HANDLER_MODAL 4 /* MODAL|BREAK means unhandled */
31 
32 struct ARegion;
33 struct GHOST_TabletData;
34 struct ScrArea;
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* wmKeyMap is in DNA_windowmanager.h, it's saveable */
41 
49 };
50 
51 typedef bool (*EventHandlerPoll)(const ARegion *region, const wmEvent *event);
52 
53 typedef struct wmEventHandler {
55 
57  char flag; /* WM_HANDLER_BLOCKING, ... */
58 
61 
64  void (*post_fn)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data);
65  void *user_data;
66 };
67 
71  void *user_data;
72 };
73 
75 typedef struct wmEventHandler_Keymap {
77 
80 
83 
86 
88 typedef struct wmEventHandler_Gizmo {
90 
94 
96 typedef struct wmEventHandler_UI {
98 
99  wmUIHandlerFunc handle_fn; /* callback receiving events */
100  wmUIHandlerRemoveFunc remove_fn; /* callback when handler is removed */
101  void *user_data; /* user data pointer */
102 
104  struct {
105  struct ScrArea *area;
106  struct ARegion *region;
107  struct ARegion *menu;
110 
112 typedef struct wmEventHandler_Op {
114 
117 
120 
122  struct {
123  /* To override the window, and hence the screen. Set for few cases only, usually window/screen
124  * can be taken from current context. */
125  struct wmWindow *win;
126 
127  struct ScrArea *area;
128  struct ARegion *region;
129  short region_type;
132 
134 typedef struct wmEventHandler_Dropbox {
136 
140 
141 /* wm_event_system.c */
142 void wm_event_free_all(wmWindow *win);
143 void wm_event_free(wmEvent *event);
145 
146 /* goes over entire hierarchy: events -> window -> screen -> area -> region */
148 
149 void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata);
150 
151 void wm_event_do_depsgraph(bContext *C, bool is_after_open_file);
154 
156  wmWindow *win,
157  ARegion *region,
158  bool reactivate_button);
159 
160 /* wm_event_query.c */
161 float wm_pressure_curve(float raw_pressure);
162 void wm_tablet_data_from_ghost(const struct GHOST_TabletData *tablet_data, wmTabletData *wmtab);
163 
164 /* wm_keymap.c */
165 
166 /* wm_dropbox.c */
167 void wm_dropbox_free(void);
168 void wm_drags_check_ops(bContext *C, const wmEvent *event);
169 void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
170 
171 #ifdef __cplusplus
172 }
173 #endif
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define C
Definition: RandGen.cpp:39
void(* wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata)
Definition: WM_api.h:283
struct wmKeyMap *() wmEventHandler_KeymapDynamicFn(wmWindowManager *wm, struct wmEventHandler_Keymap *handler) ATTR_WARN_UNUSED_RESULT
Definition: WM_api.h:252
int(* wmUIHandlerFunc)(struct bContext *C, const struct wmEvent *event, void *userdata)
Definition: WM_api.h:282
wmEventHandler head
struct wmGizmoMap * gizmo_map
wmEventHandler_KeymapDynamicFn * keymap_fn
void(* post_fn)(wmKeyMap *keymap, wmKeyMapItem *kmi, void *user_data)
struct wmEventHandler_KeymapPost post
struct wmEventHandler_KeymapDynamic dynamic
struct bToolRef * keymap_tool
wmEventHandler head
struct wmWindow * win
struct ScrArea * area
struct ARegion * region
struct wmEventHandler_Op::@1171 context
struct wmEventHandler_UI::@1170 context
wmUIHandlerRemoveFunc remove_fn
struct ARegion * menu
wmUIHandlerFunc handle_fn
struct ScrArea * area
struct ARegion * region
wmEventHandler head
struct wmEventHandler * prev
EventHandlerPoll poll
struct wmEventHandler * next
enum eWM_EventHandlerType type
float wm_pressure_curve(float raw_pressure)
struct wmEventHandler_Op wmEventHandler_Op
void wm_event_do_handlers(bContext *C)
void wm_dropbox_free(void)
Definition: wm_dragdrop.c:121
eWM_EventHandlerType
@ WM_HANDLER_TYPE_UI
@ WM_HANDLER_TYPE_OP
@ WM_HANDLER_TYPE_KEYMAP
@ WM_HANDLER_TYPE_GIZMO
@ WM_HANDLER_TYPE_DROPBOX
void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
void wm_event_free_all(wmWindow *win)
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata)
void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
Definition: wm_dragdrop.c:499
void wm_drags_check_ops(bContext *C, const wmEvent *event)
Definition: wm_dragdrop.c:301
struct wmEventHandler wmEventHandler
struct wmEventHandler_Dropbox wmEventHandler_Dropbox
struct wmEventHandler_UI wmEventHandler_UI
void wm_event_handler_ui_cancel_ex(bContext *C, wmWindow *win, ARegion *region, bool reactivate_button)
void wm_event_free(wmEvent *event)
bool(* EventHandlerPoll)(const ARegion *region, const wmEvent *event)
void wm_tablet_data_from_ghost(const struct GHOST_TabletData *tablet_data, wmTabletData *wmtab)
struct wmEventHandler_Keymap wmEventHandler_Keymap
void wm_event_free_handler(wmEventHandler *handler)
void wm_event_do_notifiers(bContext *C)
struct wmEventHandler_Gizmo wmEventHandler_Gizmo