Blender  V2.93
interface_query.c
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 
23 #include "BLI_listbase.h"
24 #include "BLI_math.h"
25 #include "BLI_rect.h"
26 #include "BLI_utildefines.h"
27 
28 #include "DNA_screen_types.h"
29 
30 #include "UI_interface.h"
31 #include "UI_view2d.h"
32 
33 #include "RNA_access.h"
34 
35 #include "interface_intern.h"
36 
37 #include "WM_api.h"
38 #include "WM_types.h"
39 
40 /* -------------------------------------------------------------------- */
44 bool ui_but_is_editable(const uiBut *but)
45 {
46  return !ELEM(but->type,
53 }
54 
56 {
58 }
59 
60 bool ui_but_is_toggle(const uiBut *but)
61 {
62  return ELEM(but->type,
70  UI_BTYPE_ROW);
71 }
72 
78 bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
79 {
80  /* note, UI_BTYPE_LABEL is included for highlights, this allows drags */
81  if ((but->type == UI_BTYPE_LABEL) && but->dragpoin == NULL) {
82  return false;
83  }
85  return false;
86  }
87  if (but->flag & UI_HIDDEN) {
88  return false;
89  }
90  if (but->flag & UI_SCROLLED) {
91  return false;
92  }
93  if ((but->type == UI_BTYPE_TEXT) &&
94  (ELEM(but->emboss, UI_EMBOSS_NONE, UI_EMBOSS_NONE_OR_STATUS)) && !labeledit) {
95  return false;
96  }
97  if ((but->type == UI_BTYPE_LISTROW) && labeledit) {
98  return false;
99  }
100 
101  return true;
102 }
103 
104 /* file selectors are exempt from utf-8 checks */
105 bool UI_but_is_utf8(const uiBut *but)
106 {
107  if (but->rnaprop) {
108  const int subtype = RNA_property_subtype(but->rnaprop);
110  }
111  return !(but->flag & UI_BUT_NO_UTF8);
112 }
113 
114 #ifdef USE_UI_POPOVER_ONCE
116 {
117  return (ELEM(but->type, UI_BTYPE_BUT, UI_BTYPE_DECORATOR) || ui_but_is_toggle(but));
118 }
119 #endif
120 
122 {
123  return (but->rnapoin.data && but->rnaprop &&
125  PROP_COLOR,
130  PROP_MATRIX,
131  PROP_EULER,
134  PROP_XYZ,
137  PROP_COORDS));
138 }
139 
141 bool UI_but_is_tool(const uiBut *but)
142 {
143  /* very evil! */
144  if (but->optype != NULL) {
145  if (g_ot_tool_set_by_id == NULL) {
146  g_ot_tool_set_by_id = WM_operatortype_find("WM_OT_tool_set_by_id", false);
147  }
148  if (but->optype == g_ot_tool_set_by_id) {
149  return true;
150  }
151  }
152  return false;
153 }
154 
156 {
157  if ((but->drawstr[0] == '\0') && !ui_block_is_popover(but->block)) {
158  return UI_but_is_tool(but);
159  }
160  return false;
161 }
162 
163 int ui_but_icon(const uiBut *but)
164 {
165  if (!(but->flag & UI_HAS_ICON)) {
166  return ICON_NONE;
167  }
168 
169  /* Consecutive icons can be toggle between. */
170  if (but->drawflag & UI_BUT_ICON_REVERSE) {
171  return but->icon - but->iconadd;
172  }
173  return but->icon + but->iconadd;
174 }
175 
178 /* -------------------------------------------------------------------- */
182 void ui_but_pie_dir(RadialDirection dir, float vec[2])
183 {
184  float angle;
185 
186  BLI_assert(dir != UI_RADIAL_NONE);
187 
188  angle = DEG2RADF((float)ui_radial_dir_to_angle[dir]);
189  vec[0] = cosf(angle);
190  vec[1] = sinf(angle);
191 }
192 
193 static bool ui_but_isect_pie_seg(const uiBlock *block, const uiBut *but)
194 {
195  const float angle_range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? M_PI_4 :
196  M_PI_4 / 2.0;
197  float vec[2];
198 
199  if (block->pie_data.flags & UI_PIE_INVALID_DIR) {
200  return false;
201  }
202 
203  ui_but_pie_dir(but->pie_dir, vec);
204 
205  if (saacos(dot_v2v2(vec, block->pie_data.pie_dir)) < angle_range) {
206  return true;
207  }
208 
209  return false;
210 }
211 
212 bool ui_but_contains_pt(const uiBut *but, float mx, float my)
213 {
214  return BLI_rctf_isect_pt(&but->rect, mx, my);
215 }
216 
217 bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
218 {
219  return BLI_rctf_isect(&but->rect, rect, NULL);
220 }
221 
222 bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, int x, int y)
223 {
224  uiBlock *block = but->block;
225  if (!ui_region_contains_point_px(region, x, y)) {
226  return false;
227  }
228 
229  float mx = x, my = y;
230  ui_window_to_block_fl(region, block, &mx, &my);
231 
232  if (but->pie_dir != UI_RADIAL_NONE) {
233  if (!ui_but_isect_pie_seg(block, but)) {
234  return false;
235  }
236  }
237  else if (!ui_but_contains_pt(but, mx, my)) {
238  return false;
239  }
240 
241  return true;
242 }
243 
244 bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
245 {
246  rcti rect;
247  int x = event->x, y = event->y;
248 
249  ui_window_to_block(region, but->block, &x, &y);
250 
251  BLI_rcti_rctf_copy(&rect, &but->rect);
252 
253  if (but->imb || but->type == UI_BTYPE_COLOR) {
254  /* use button size itself */
255  }
256  else if (but->drawflag & UI_BUT_ICON_LEFT) {
257  rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect));
258  }
259  else {
260  const int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect);
261  rect.xmin += delta / 2;
262  rect.xmax -= delta / 2;
263  }
264 
265  return BLI_rcti_isect_pt(&rect, x, y);
266 }
267 
268 /* x and y are only used in case event is NULL... */
270  const int x,
271  const int y,
272  const bool labeledit)
273 {
274  uiBut *butover = NULL;
275 
276  if (!ui_region_contains_point_px(region, x, y)) {
277  return NULL;
278  }
279  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
280  float mx = x, my = y;
281  ui_window_to_block_fl(region, block, &mx, &my);
282 
283  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
284  if (ui_but_is_interactive(but, labeledit)) {
285  if (but->pie_dir != UI_RADIAL_NONE) {
286  if (ui_but_isect_pie_seg(block, but)) {
287  butover = but;
288  break;
289  }
290  }
291  else if (ui_but_contains_pt(but, mx, my)) {
292  butover = but;
293  break;
294  }
295  }
296  }
297 
298  /* CLIP_EVENTS prevents the event from reaching other blocks */
299  if (block->flag & UI_BLOCK_CLIP_EVENTS) {
300  /* check if mouse is inside block */
301  if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
302  break;
303  }
304  }
305  }
306 
307  return butover;
308 }
309 
310 uiBut *ui_but_find_mouse_over(const ARegion *region, const wmEvent *event)
311 {
312  return ui_but_find_mouse_over_ex(region, event->x, event->y, event->ctrl != 0);
313 }
314 
315 uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
316 {
317  if (!ui_region_contains_rect_px(region, rect_px)) {
318  return NULL;
319  }
320 
321  /* Currently no need to expose this at the moment. */
322  const bool labeledit = true;
323  rctf rect_px_fl;
324  BLI_rctf_rcti_copy(&rect_px_fl, rect_px);
325  uiBut *butover = NULL;
326 
327  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
328  rctf rect_block;
329  ui_window_to_block_rctf(region, block, &rect_block, &rect_px_fl);
330 
331  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
332  if (ui_but_is_interactive(but, labeledit)) {
333  /* No pie menu support. */
334  BLI_assert(but->pie_dir == UI_RADIAL_NONE);
335  if (ui_but_contains_rect(but, &rect_block)) {
336  butover = but;
337  break;
338  }
339  }
340  }
341 
342  /* CLIP_EVENTS prevents the event from reaching other blocks */
343  if (block->flag & UI_BLOCK_CLIP_EVENTS) {
344  /* check if mouse is inside block */
345  if (BLI_rctf_isect(&block->rect, &rect_block, NULL)) {
346  break;
347  }
348  }
349  }
350  return butover;
351 }
352 
354 {
355  if (!ui_region_contains_point_px(region, x, y)) {
356  return NULL;
357  }
358  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
359  float mx = x, my = y;
360  ui_window_to_block_fl(region, block, &mx, &my);
361  LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) {
362  if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) {
363  return but;
364  }
365  }
366  }
367 
368  return NULL;
369 }
370 
372 {
373  return ui_list_find_mouse_over_ex(region, event->x, event->y);
374 }
375 
378 /* -------------------------------------------------------------------- */
383 {
384  while (but->prev) {
385  but = but->prev;
386  if (ui_but_is_editable(but)) {
387  return but;
388  }
389  }
390  return NULL;
391 }
392 
394 {
395  while (but->next) {
396  but = but->next;
397  if (ui_but_is_editable(but)) {
398  return but;
399  }
400  }
401  return NULL;
402 }
403 
405 {
406  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
407  if (ui_but_is_editable(but)) {
408  return but;
409  }
410  }
411  return NULL;
412 }
413 
415 {
416  uiBut *but;
417 
418  but = block->buttons.last;
419  while (but) {
420  if (ui_but_is_editable(but)) {
421  return but;
422  }
423  but = but->prev;
424  }
425  return NULL;
426 }
427 
428 bool ui_but_is_cursor_warp(const uiBut *but)
429 {
430  if (U.uiflag & USER_CONTINUOUS_MOUSE) {
431  if (ELEM(but->type,
432  UI_BTYPE_NUM,
439  return true;
440  }
441  }
442 
443  return false;
444 }
445 
447 {
448  return but->rnaprop && (RNA_property_subtype(but->rnaprop) == PROP_PASSWORD);
449 }
450 
453 /* -------------------------------------------------------------------- */
458 {
459  if (but->flag & UI_BUT_HAS_SEP_CHAR) {
460  const char *str_sep = strrchr(but->drawstr, UI_SEP_CHAR);
461  if (str_sep != NULL) {
462  return (str_sep - but->drawstr);
463  }
464  }
465  return strlen(but->drawstr);
466 }
467 
469 {
470  if (but->tip == NULL) {
471  return 0;
472  }
473 
474  const char *str_sep = strchr(but->tip, '\n');
475  if (str_sep != NULL) {
476  return (str_sep - but->tip);
477  }
478  return strlen(but->tip);
479 }
480 
483 /* -------------------------------------------------------------------- */
487 bool ui_block_is_menu(const uiBlock *block)
488 {
489  return (((block->flag & UI_BLOCK_LOOP) != 0) &&
490  /* non-menu popups use keep-open, so check this is off */
491  ((block->flag & UI_BLOCK_KEEP_OPEN) == 0));
492 }
493 
494 bool ui_block_is_popover(const uiBlock *block)
495 {
496  return (block->flag & UI_BLOCK_POPOVER) != 0;
497 }
498 
499 bool ui_block_is_pie_menu(const uiBlock *block)
500 {
501  return ((block->flag & UI_BLOCK_RADIAL) != 0);
502 }
503 
504 bool ui_block_is_popup_any(const uiBlock *block)
505 {
506  return (ui_block_is_menu(block) || ui_block_is_popover(block) || ui_block_is_pie_menu(block));
507 }
508 
509 static const uiBut *ui_but_next_non_separator(const uiBut *but)
510 {
511  for (; but; but = but->next) {
512  if (!ELEM(but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
513  return but;
514  }
515  }
516  return NULL;
517 }
518 
519 bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title)
520 {
521  const uiBut *but = block->buttons.first;
522  if (skip_title) {
523  /* Skip the first label, since popups often have a title,
524  * we may want to consider the block empty in this case. */
525  but = ui_but_next_non_separator(but);
526  if (but && but->type == UI_BTYPE_LABEL) {
527  but = but->next;
528  }
529  }
530  return (ui_but_next_non_separator(but) == NULL);
531 }
532 
533 bool UI_block_is_empty(const uiBlock *block)
534 {
535  return UI_block_is_empty_ex(block, false);
536 }
537 
539 {
540  if (ui_block_is_menu(block) && !ui_block_is_pie_menu(block)) {
541  const uiBut *but = block->buttons.last;
542  return (but && !ELEM(but->type, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR));
543  }
544  return true;
545 }
546 
549 /* -------------------------------------------------------------------- */
554  const int x,
555  const int y,
556  bool only_clip)
557 {
558  if (!ui_region_contains_point_px(region, x, y)) {
559  return NULL;
560  }
561  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
562  if (only_clip) {
563  if ((block->flag & UI_BLOCK_CLIP_EVENTS) == 0) {
564  continue;
565  }
566  }
567  float mx = x, my = y;
568  ui_window_to_block_fl(region, block, &mx, &my);
569  if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
570  return block;
571  }
572  }
573  return NULL;
574 }
575 
576 uiBlock *ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
577 {
578  return ui_block_find_mouse_over_ex(region, event->x, event->y, only_clip);
579 }
580 
583 /* -------------------------------------------------------------------- */
588 {
589  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
590  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
591  if (but->active) {
592  return but;
593  }
594  }
595  }
596 
597  return NULL;
598 }
599 
600 uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
601 {
602  LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
603  LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
604  if (((but->flag & flag_include) == flag_include) && ((but->flag & flag_exclude) == 0)) {
605  return but;
606  }
607  }
608  }
609 
610  return NULL;
611 }
612 
615 /* -------------------------------------------------------------------- */
619 bool ui_region_contains_point_px(const ARegion *region, int x, int y)
620 {
621  rcti winrct;
622  ui_region_winrct_get_no_margin(region, &winrct);
623  if (!BLI_rcti_isect_pt(&winrct, x, y)) {
624  return false;
625  }
626 
627  /* also, check that with view2d, that the mouse is not over the scroll-bars
628  * NOTE: care is needed here, since the mask rect may include the scroll-bars
629  * even when they are not visible, so we need to make a copy of the mask to
630  * use to check
631  */
632  if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
633  const View2D *v2d = &region->v2d;
634  int mx = x, my = y;
635 
636  ui_window_to_region(region, &mx, &my);
637  if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) ||
638  UI_view2d_mouse_in_scrollers(region, &region->v2d, x, y)) {
639  return false;
640  }
641  }
642 
643  return true;
644 }
645 
646 bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
647 {
648  rcti winrct;
649  ui_region_winrct_get_no_margin(region, &winrct);
650  if (!BLI_rcti_isect(&winrct, rect_px, NULL)) {
651  return false;
652  }
653 
654  /* See comment in 'ui_region_contains_point_px' */
655  if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
656  const View2D *v2d = &region->v2d;
657  rcti rect_region;
658  ui_window_to_region_rcti(region, &rect_region, rect_px);
659  if (!BLI_rcti_isect(&v2d->mask, &rect_region, NULL) ||
660  UI_view2d_rect_in_scrollers(region, &region->v2d, rect_px)) {
661  return false;
662  }
663  }
664 
665  return true;
666 }
667 
670 /* -------------------------------------------------------------------- */
676 {
677  LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
678  rcti winrct;
679 
680  ui_region_winrct_get_no_margin(region, &winrct);
681 
682  if (BLI_rcti_isect_pt(&winrct, x, y)) {
683  return region;
684  }
685  }
686  return NULL;
687 }
688 
690 {
691  return ui_screen_region_find_mouse_over_ex(screen, event->x, event->y);
692 }
693 
696 /* -------------------------------------------------------------------- */
701 {
703 }
704 
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
Definition: BLI_listbase.h:184
MINLINE float saacos(float fac)
#define M_PI_4
Definition: BLI_math_base.h:44
#define DEG2RADF(_deg)
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
bool BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y)
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y)
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
#define ELEM(...)
@ USER_CONTINUOUS_MOUSE
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ PROP_MATRIX
Definition: RNA_types.h:144
@ PROP_DIRECTION
Definition: RNA_types.h:141
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_ACCELERATION
Definition: RNA_types.h:143
@ PROP_BYTESTRING
Definition: RNA_types.h:120
@ PROP_FILENAME
Definition: RNA_types.h:118
@ PROP_PASSWORD
Definition: RNA_types.h:123
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_AXISANGLE
Definition: RNA_types.h:147
@ PROP_EULER
Definition: RNA_types.h:145
@ PROP_COORDS
Definition: RNA_types.h:153
@ PROP_DIRPATH
Definition: RNA_types.h:117
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:151
@ PROP_TRANSLATION
Definition: RNA_types.h:140
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:149
@ PROP_QUATERNION
Definition: RNA_types.h:146
@ PROP_FILEPATH
Definition: RNA_types.h:116
@ PROP_VELOCITY
Definition: RNA_types.h:142
@ UI_BUT_ICON_LEFT
Definition: UI_interface.h:260
@ UI_BUT_ICON_REVERSE
Definition: UI_interface.h:298
@ UI_EMBOSS_NONE
Definition: UI_interface.h:108
@ UI_EMBOSS_NONE_OR_STATUS
Definition: UI_interface.h:115
@ UI_BUT_NO_UTF8
Definition: UI_interface.h:210
@ UI_BUT_HAS_SEP_CHAR
Definition: UI_interface.h:225
#define UI_SEP_CHAR
Definition: UI_interface.h:86
@ UI_BLOCK_CLIP_EVENTS
Definition: UI_interface.h:155
@ UI_BLOCK_RADIAL
Definition: UI_interface.h:161
@ UI_BLOCK_LOOP
Definition: UI_interface.h:140
@ UI_BLOCK_KEEP_OPEN
Definition: UI_interface.h:149
@ UI_BLOCK_POPOVER
Definition: UI_interface.h:162
@ UI_BTYPE_BUT
Definition: UI_interface.h:334
@ UI_BTYPE_TOGGLE
Definition: UI_interface.h:344
@ UI_BTYPE_LISTBOX
Definition: UI_interface.h:370
@ UI_BTYPE_ROUNDBOX
Definition: UI_interface.h:363
@ UI_BTYPE_TOGGLE_N
Definition: UI_interface.h:345
@ UI_BTYPE_NUM_SLIDER
Definition: UI_interface.h:343
@ UI_BTYPE_HSVCIRCLE
Definition: UI_interface.h:372
@ UI_BTYPE_LISTROW
Definition: UI_interface.h:371
@ UI_BTYPE_TEXT
Definition: UI_interface.h:336
@ UI_BTYPE_BUT_TOGGLE
Definition: UI_interface.h:349
@ UI_BTYPE_HSVCUBE
Definition: UI_interface.h:360
@ UI_BTYPE_LABEL
Definition: UI_interface.h:358
@ UI_BTYPE_CURVE
Definition: UI_interface.h:367
@ UI_BTYPE_ICON_TOGGLE_N
Definition: UI_interface.h:347
@ UI_BTYPE_DECORATOR
Definition: UI_interface.h:392
@ UI_BTYPE_ROW
Definition: UI_interface.h:335
@ UI_BTYPE_SEARCH_MENU
Definition: UI_interface.h:376
@ UI_BTYPE_SEPR_LINE
Definition: UI_interface.h:387
@ UI_BTYPE_PROGRESS_BAR
Definition: UI_interface.h:384
@ UI_BTYPE_CHECKBOX_N
Definition: UI_interface.h:352
@ UI_BTYPE_SEPR
Definition: UI_interface.h:386
@ UI_BTYPE_NUM
Definition: UI_interface.h:341
@ UI_BTYPE_CURVEPROFILE
Definition: UI_interface.h:369
@ UI_BTYPE_TRACK_PREVIEW
Definition: UI_interface.h:373
@ UI_BTYPE_COLOR
Definition: UI_interface.h:353
@ UI_BTYPE_CHECKBOX
Definition: UI_interface.h:351
@ UI_BTYPE_ICON_TOGGLE
Definition: UI_interface.h:346
char UI_view2d_mouse_in_scrollers(const struct ARegion *region, const struct View2D *v2d, int x, int y)
char UI_view2d_rect_in_scrollers(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect)
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
const short ui_radial_dir_to_angle[8]
Definition: interface.c:1523
void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src)
Definition: interface.c:244
void ui_window_to_region(const ARegion *region, int *r_x, int *r_y)
Definition: interface.c:238
void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *r_x, float *r_y)
Definition: interface.c:190
void ui_window_to_block_rctf(const struct ARegion *region, uiBlock *block, rctf *rct_dst, const rctf *rct_src)
Definition: interface.c:217
void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect)
Definition: interface.c:339
void ui_window_to_block(const ARegion *region, uiBlock *block, int *r_x, int *r_y)
Definition: interface.c:227
RadialDirection
@ UI_RADIAL_NONE
@ UI_PIE_DEGREES_RANGE_LARGE
@ UI_PIE_INVALID_DIR
@ UI_HIDDEN
@ UI_SCROLLED
@ UI_HAS_ICON
uiBut * ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
uiBut * ui_but_prev(uiBut *but)
size_t ui_but_drawstr_len_without_sep_char(const uiBut *but)
bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title)
bool UI_block_can_add_separator(const uiBlock *block)
bool ui_block_is_popup_any(const uiBlock *block)
uiBlock * ui_block_find_mouse_over_ex(const ARegion *region, const int x, const int y, bool only_clip)
uiBut * ui_region_find_active_but(ARegion *region)
bool ui_but_is_toggle(const uiBut *but)
bool ui_but_contains_pt(const uiBut *but, float mx, float my)
uiBut * ui_but_last(uiBlock *block)
bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
bool ui_but_contains_password(const uiBut *but)
bool UI_but_is_utf8(const uiBut *but)
size_t ui_but_tip_len_only_first_line(const uiBut *but)
ARegion * ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y)
bool UI_block_is_empty(const uiBlock *block)
static wmOperatorType * g_ot_tool_set_by_id
static bool ui_but_isect_pie_seg(const uiBlock *block, const uiBut *but)
bool ui_region_contains_point_px(const ARegion *region, int x, int y)
bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
uiBut * ui_list_find_mouse_over(ARegion *region, const wmEvent *event)
bool ui_block_is_popover(const uiBlock *block)
bool ui_but_is_editable(const uiBut *but)
bool ui_block_is_pie_menu(const uiBlock *block)
uiBut * ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
bool ui_but_is_cursor_warp(const uiBut *but)
ARegion * ui_screen_region_find_mouse_over(bScreen *screen, const wmEvent *event)
uiBlock * ui_block_find_mouse_over(const ARegion *region, const wmEvent *event, bool only_clip)
uiBut * ui_but_find_mouse_over_ex(const ARegion *region, const int x, const int y, const bool labeledit)
uiBut * ui_but_find_mouse_over(const ARegion *region, const wmEvent *event)
static const uiBut * ui_but_next_non_separator(const uiBut *but)
void ui_interface_tag_script_reload_queries(void)
uiBut * ui_but_next(uiBut *but)
bool ui_block_is_menu(const uiBlock *block)
uiBut * ui_but_first(uiBlock *block)
bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
bool ui_but_is_popover_once_compat(const uiBut *but)
bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
void ui_but_pie_dir(RadialDirection dir, float vec[2])
bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, int x, int y)
int ui_but_icon(const uiBut *but)
bool ui_but_is_editable_as_text(const uiBut *but)
bool UI_but_is_tool(const uiBut *but)
uiBut * ui_list_find_mouse_over_ex(ARegion *region, int x, int y)
bool UI_but_has_tooltip_label(const uiBut *but)
bool ui_but_has_array_value(const uiBut *but)
#define sinf(x)
#define cosf(x)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
Definition: rna_access.c:1160
ListBase uiblocks
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
float pie_dir[2]
void * data
Definition: RNA_types.h:52
ListBase regionbase
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79
struct PieMenuData pie_data
ListBase buttons
const char * tip
struct uiBut * prev
struct uiBut * next
void * dragpoin
eButType type
signed char pie_dir
uiBlock * block
eUIEmbossType emboss
struct ImBuf * imb
BIFIconID icon
struct wmOperatorType * optype
short iconadd
char drawstr[UI_MAX_DRAW_STR]
struct PropertyRNA * rnaprop
struct PointerRNA rnapoin
int y
Definition: WM_types.h:581
short ctrl
Definition: WM_types.h:618
int x
Definition: WM_types.h:581
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)