UI: move queries into interface_query.c

This commit is contained in:
Campbell Barton 2018-06-30 10:58:56 +02:00
parent b89307acfd
commit 62ff53ff19
3 changed files with 32 additions and 29 deletions

View File

@ -404,6 +404,10 @@ typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
/* interface_query.c */
bool UI_but_is_tool(const uiBut *but);
#define UI_but_is_decorator(but) \
((but)->func == ui_but_anim_decorate_cb)
bool UI_block_is_empty(const uiBlock *block);
@ -1265,8 +1269,4 @@ void UI_widgetbase_draw_cache_end(void);
/* Support click-drag motion which presses the button and closes a popover (like a menu). */
#define USE_UI_POPOVER_ONCE
bool UI_but_is_tool(const uiBut *but);
#define UI_but_is_decorator(but) \
((but)->func == ui_but_anim_decorate_cb)
#endif /* __UI_INTERFACE_H__ */

View File

@ -467,16 +467,6 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
}
}
#ifdef USE_UI_POPOVER_ONCE
bool ui_but_is_popover_once_compat(const uiBut *but)
{
return (
(but->type == UI_BTYPE_BUT) ||
ui_but_is_toggle(but)
);
}
#endif
static uiBut *ui_but_prev(uiBut *but)
{
while (but->prev) {
@ -9841,18 +9831,3 @@ void ui_but_clipboard_free(void)
{
curvemapping_free_data(&but_copypaste_curve);
}
bool UI_but_is_tool(const uiBut *but)
{
/* very evil! */
if (but->optype != NULL) {
static wmOperatorType *ot = NULL;
if (ot == NULL) {
ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
}
if (but->optype == ot) {
return true;
}
}
return false;
}

View File

@ -32,6 +32,9 @@
#include "interface_intern.h"
#include "WM_api.h"
#include "WM_types.h"
/* -------------------------------------------------------------------- */
/** \name Button (uiBut)
* \{ */
@ -66,6 +69,31 @@ bool ui_but_is_toggle(const uiBut *but)
);
}
#ifdef USE_UI_POPOVER_ONCE
bool ui_but_is_popover_once_compat(const uiBut *but)
{
return (
(but->type == UI_BTYPE_BUT) ||
ui_but_is_toggle(but)
);
}
#endif
bool UI_but_is_tool(const uiBut *but)
{
/* very evil! */
if (but->optype != NULL) {
static wmOperatorType *ot = NULL;
if (ot == NULL) {
ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
}
if (but->optype == ot) {
return true;
}
}
return false;
}
/** \} */
/* -------------------------------------------------------------------- */