Blender  V3.3
ED_numinput.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define NUM_STR_REP_LEN 64
14 #define NUM_MAX_ELEMENTS 3
15 
16 struct wmEvent;
17 
18 typedef struct NumInput {
20  short idx_max;
21  int unit_sys;
25 
27  short flag;
36 
38  short idx;
43  int str_cur;
45 
47 enum {
48  NUM_AFFECT_ALL = (1 << 0),
49  /* (1 << 9) and above are reserved for internal flags! */
50 };
51 
52 /* NumInput.val_flag[] */
53 enum {
54  /* Public! */
55  NUM_NULL_ONE = (1 << 0),
56  NUM_NO_NEGATIVE = (1 << 1),
57  NUM_NO_ZERO = (1 << 2),
58  NUM_NO_FRACTION = (1 << 3),
59  /* (1 << 9) and above are reserved for internal flags! */
60 };
61 
62 struct UnitSettings;
63 
64 /* -------------------------------------------------------------------- */
82 void initNumInput(NumInput *n);
86 void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings);
87 bool hasNumInput(const NumInput *n);
91 bool applyNumInput(NumInput *n, float *vec);
92 bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event);
93 
95 #define NUM_MODAL_INCREMENT_UP 18
96 #define NUM_MODAL_INCREMENT_DOWN 19
97 
99  const char *str,
100  const struct UnitSettings *unit,
101  int type,
102  double *r_value,
103  bool use_single_line_error,
104  char **r_error);
105 
108 #ifdef __cplusplus
109 }
110 #endif
void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings)
Definition: numinput.c:87
void initNumInput(NumInput *n)
Definition: numinput.c:69
#define NUM_STR_REP_LEN
Definition: ED_numinput.h:13
bool user_string_to_number(bContext *C, const char *str, const struct UnitSettings *unit, int type, double *r_value, bool use_single_line_error, char **r_error)
struct NumInput NumInput
@ NUM_NO_NEGATIVE
Definition: ED_numinput.h:56
@ NUM_NULL_ONE
Definition: ED_numinput.h:55
@ NUM_NO_ZERO
Definition: ED_numinput.h:57
@ NUM_NO_FRACTION
Definition: ED_numinput.h:58
@ NUM_AFFECT_ALL
Definition: ED_numinput.h:48
#define NUM_MAX_ELEMENTS
Definition: ED_numinput.h:14
bool applyNumInput(NumInput *n, float *vec)
Definition: numinput.c:189
bool hasNumInput(const NumInput *n)
Definition: numinput.c:170
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event)
_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:25
#define str(s)
short idx_max
Definition: ED_numinput.h:20
float val[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:31
short val_flag[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:29
int unit_sys
Definition: ED_numinput.h:21
float val_inc[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:35
char str[NUM_STR_REP_LEN]
Definition: ED_numinput.h:40
float val_org[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:33
int unit_type[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:23
short flag
Definition: ED_numinput.h:27
bool unit_use_radians
Definition: ED_numinput.h:24
int str_cur
Definition: ED_numinput.h:43
short idx
Definition: ED_numinput.h:38