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 17 /** \file 18 * \ingroup wm 19 * 20 * Callback function definitions, needed for both Types & API headers. 21 */ 22 23 #pragma once 24 25 #include "BLI_compiler_attrs.h" 26 27 struct wmMsgBus; 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /* wmGizmoGroup */ 34 typedef bool (*wmGizmoGroupFnPoll)(const struct bContext *, 35 struct wmGizmoGroupType *) ATTR_WARN_UNUSED_RESULT; 36 typedef void (*wmGizmoGroupFnInit)(const struct bContext *, struct wmGizmoGroup *); 37 typedef void (*wmGizmoGroupFnRefresh)(const struct bContext *, struct wmGizmoGroup *); 38 typedef void (*wmGizmoGroupFnDrawPrepare)(const struct bContext *, struct wmGizmoGroup *); 39 typedef void (*wmGizmoGroupFnInvokePrepare)(const struct bContext *, 40 struct wmGizmoGroup *, 41 struct wmGizmo *, 42 const struct wmEvent *); 43 typedef struct wmKeyMap *(*wmGizmoGroupFnSetupKeymap)(const struct wmGizmoGroupType *, 44 struct wmKeyConfig *)ATTR_WARN_UNUSED_RESULT; 45 typedef void (*wmGizmoGroupFnMsgBusSubscribe)(const struct bContext *, 46 struct wmGizmoGroup *, 47 struct wmMsgBus *); 48 49 /* wmGizmo */ 50 /* See: wmGizmoType for docs on each type. */ 51 52 typedef void (*wmGizmoFnSetup)(struct wmGizmo *); 53 typedef void (*wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *); 54 typedef void (*wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int); 55 typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const int mval[2]); 56 typedef int (*wmGizmoFnModal)(struct bContext *, 57 struct wmGizmo *, 58 const struct wmEvent *, 59 eWM_GizmoFlagTweak); 60 typedef void (*wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *); 61 typedef void (*wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4]); 62 typedef int (*wmGizmoFnInvoke)(struct bContext *, struct wmGizmo *, const struct wmEvent *); 63 typedef void (*wmGizmoFnExit)(struct bContext *, struct wmGizmo *, const bool); 64 typedef int (*wmGizmoFnCursorGet)(struct wmGizmo *); 65 typedef void (*wmGizmoFnSelectRefresh)(struct wmGizmo *); 66 typedef void (*wmGizmoFnFree)(struct wmGizmo *); 67 68 /* wmGizmoProperty ('value' type defined by 'wmGizmoProperty.data_type') */ 69 typedef void (*wmGizmoPropertyFnGet)(const struct wmGizmo *, 70 struct wmGizmoProperty *, 71 /* typically 'float *' */ 72 void *value); 73 typedef void (*wmGizmoPropertyFnSet)(const struct wmGizmo *, 74 struct wmGizmoProperty *, 75 /* typically 'const float *' */ 76 const void *value); 77 typedef void (*wmGizmoPropertyFnRangeGet)(const struct wmGizmo *, 78 struct wmGizmoProperty *, 79 /* typically 'float[2]' */ 80 void *range); 81 typedef void (*wmGizmoPropertyFnFree)(const struct wmGizmo *, struct wmGizmoProperty *); 82 83 typedef struct wmGizmoPropertyFnParams { 84 wmGizmoPropertyFnGet value_get_fn; 85 wmGizmoPropertyFnSet value_set_fn; 86 wmGizmoPropertyFnRangeGet range_get_fn; 87 wmGizmoPropertyFnFree free_fn; 88 void *user_data; 89 } wmGizmoPropertyFnParams; 90 91 #ifdef __cplusplus 92 } 93 #endif 94