62 #define MENU_BORDER (int)(0.3f * U.widget_unit)
107 #define SEARCH_ITEMS 10
125 const uint8_t name_prefix_offset)
139 if (poin == items->
active) {
167 if (name_prefix_offset != 0) {
202 for (
int i = 0; i < items->
totitem; i++) {
209 for (
int i = 0; i < items->
totitem; i++) {
224 data->active += step;
226 if (
data->items.totitem == 0) {
229 else if (
data->active >=
data->items.totitem) {
230 if (
data->items.more) {
231 data->items.offset++;
232 data->active =
data->items.totitem - 1;
236 data->active =
data->items.totitem - 1;
239 else if (
data->active < 0) {
240 if (
data->items.offset) {
241 data->items.offset--;
262 *r_rect =
data->bbox;
265 row = itemnr /
data->prv_cols;
277 *r_rect =
data->bbox;
278 r_rect->
xmin =
data->bbox.xmin + 3.0f;
279 r_rect->
xmax =
data->bbox.xmax - 3.0f;
310 if (
data->active != -1) {
311 const char *name =
data->items.names[
data->active] +
313 (
data->items.name_prefix_offsets ?
314 data->items.name_prefix_offsets[
data->active] :
338 double *
UNUSED(pass_delay),
339 bool *r_exit_on_event)
341 *r_exit_on_event =
true;
374 int type =
event->type, val =
event->val;
375 bool handled =
false;
376 bool tooltip_timer_started =
false;
398 if (
data->active != -1) {
422 for (
a = 0;
a <
data->items.totitem;
a++) {
427 if (
data->active !=
a) {
439 if (
data->active != -1) {
443 tooltip_timer_started =
true;
452 if (handled && (tooltip_timer_started ==
false)) {
471 const bool is_first_search = !search_but->
but.
changed;
484 data->items.totitem = 0;
485 data->items.more = 0;
486 if (
reset ==
false) {
487 data->items.offset_i =
data->items.offset;
490 data->items.offset_i =
data->items.offset = 0;
500 if (
data->items.totitem) {
502 if (
data->items.offset_i <
data->items.maxitem) {
503 data->active =
data->items.offset_i;
504 data->items.offset_i = 0;
508 if (
data->items.totitem -
data->items.offset_i <=
data->items.maxitem) {
509 data->active =
data->items.offset_i -
data->items.totitem +
data->items.maxitem;
510 data->items.offset_i =
data->items.totitem -
data->items.maxitem;
514 data->items.offset_i -=
data->items.maxitem / 2;
515 data->active =
data->items.maxitem / 2;
519 data->items.offset =
data->items.offset_i;
520 data->items.totitem = 0;
533 for (
a = 0;
a <
data->items.totitem;
a++) {
534 const char *name =
data->items.names[
a] +
536 (
data->items.name_prefix_offsets ?
data->items.name_prefix_offsets[
a] :
582 if (
data->noback ==
false) {
587 if (
data->items.totitem) {
593 for (
a = 0;
a <
data->items.totitem;
a++) {
607 if (
data->items.more) {
613 if (
data->items.offset) {
621 const int search_sep_len =
data->sep_string ? strlen(
data->sep_string) : 0;
623 for (
a = 0;
a <
data->items.totitem;
a++) {
625 char *name =
data->items.names[
a];
626 int icon =
data->items.icons[
a];
627 char *name_sep_test =
NULL;
641 if ((search_sep_len == 0) ||
642 !(name_sep_test = strstr(
data->items.names[
a],
data->sep_string))) {
643 if (!icon &&
data->items.has_icon) {
653 char *name_sep =
NULL;
655 name_sep = name_sep_test;
656 name_sep_test = strstr(name_sep + search_sep_len,
data->sep_string);
657 }
while (name_sep_test !=
NULL);
659 name_sep += search_sep_len;
660 const char name_sep_prev = *name_sep;
670 *name_sep = name_sep_prev;
671 rect.
xmin += name_width;
674 if (icon == ICON_BLANK1) {
684 if (
data->items.more) {
690 if (
data->items.offset) {
706 for (
a = 0;
a <
data->items.maxitem;
a++) {
714 if (
data->items.name_prefix_offsets !=
NULL) {
756 if (but->
a1 > 0 && but->
a2 > 0) {
757 data->preview =
true;
767 data->use_sep =
true;
780 data->bbox.xmin = margin;
782 data->bbox.ymin = margin;
787 data->bbox.ymin += search_but_h;
790 data->bbox.ymax -= search_but_h;
809 rect_fl.
xmax = rect_fl.
xmin + searchbox_width;
838 if (rect_i.
ymin < 0) {
852 data->bbox.xmin = margin;
854 data->bbox.ymin = margin;
878 data->items.totitem = 0;
880 data->items.pointers =
MEM_callocN(
data->items.maxitem *
sizeof(
void *),
"search pointers");
883 data->items.name_prefix_offsets =
NULL;
884 for (
int i = 0; i <
data->items.maxitem; i++) {
900 bool prev_delim =
true;
902 for (i = 0; (i <
len) &&
str[i]; i++) {
903 if (
str[i] >=
'A' &&
str[i] <=
'Z') {
904 if (prev_delim ==
false) {
908 else if (
str[i] ==
'_') {
912 prev_delim =
ELEM(
str[i],
' ') || (
str[i] >=
'0' &&
str[i] <=
'9');
923 if (
data->noback ==
false) {
928 if (
data->items.totitem) {
933 for (
a = 0;
a <
data->items.totitem;
a++) {
934 rcti rect_pre, rect_post;
949 char *text_pre_p = strstr(
ot->
idname,
"_OT_");
950 if (text_pre_p ==
NULL) {
958 text_pre[text_pre_len] =
':';
959 text_pre[text_pre_len + 1] =
'\0';
967 data->items.icons[
a],
973 data->items.names[
a],
982 if (
data->items.more) {
988 if (
data->items.offset) {
1049 for (x1 = 0; x1 < items->
maxitem; x1++) {
1060 else if (items->
more == 0) {
1067 for (x1 = 0; x1 < items->
maxitem; x1++) {
struct ScrArea * CTX_wm_area(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int min_ii(int a, int b)
void BLI_rctf_translate(struct rctf *rect, float x, float y)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
#define STREQLEN(a, b, n)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
ID and Library types, which are fundamental for sdna.
void ED_region_floating_init(struct ARegion *region)
void ED_region_tag_redraw(struct ARegion *region)
_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
_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
void GPU_blend(eGPUBlend blend)
Read Guarded memory(de)allocation.
void UI_fontstyle_set(const struct uiFontStyle *fs)
const struct uiStyle * UI_style_get(void)
#define AUTOCOMPLETE_NO_MATCH
void UI_but_drawflag_enable(uiBut *but, int flag)
AutoComplete * UI_autocomplete_begin(const char *startname, size_t maxlen)
int UI_autocomplete_end(AutoComplete *autocpl, char *autoname)
struct ARegion * UI_region_searchbox_region_get(const struct ARegion *button_region)
void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
void UI_but_flag_enable(uiBut *but, int flag)
void UI_icon_draw(float x, float y, int icon_id)
void UI_view2d_view_to_region_rcti(const struct View2D *v2d, const struct rctf *rect_src, struct rcti *rect_dst) ATTR_NONNULL()
float UI_view2d_view_to_region_y(const struct View2D *v2d, float y)
void reset()
clear internal cached data and reset random seed
static bool is_inside(int x, int y, int cols, int rows)
int ui_but_string_get_max_length(uiBut *but)
void ui_fontscale(short *points, float aspect)
void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool big)
#define UI_POPUP_MENU_TOP
void ui_draw_menu_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, uiMenuItemSeparatorType separator_type, int *r_xmax)
void ui_draw_preview_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow)
@ UI_MENU_ITEM_SEPARATOR_NONE
@ UI_MENU_ITEM_SEPARATOR_HINT
@ UI_MENU_ITEM_SEPARATOR_SHORTCUT
int UI_searchbox_size_x(void)
int ui_searchbox_find_index(ARegion *region, const char *name)
int UI_searchbox_size_y(void)
void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset)
ARegion * ui_searchbox_create_operator(bContext *C, ARegion *butregion, uiButSearch *search_but)
static void str_tolower_titlecaps_ascii(char *str, const size_t len)
static void ui_searchbox_region_free_cb(ARegion *region)
void ui_but_search_refresh(uiButSearch *search_but)
static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region)
bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int state, const uint8_t name_prefix_offset)
static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr)
static void ui_searchbox_select(bContext *C, ARegion *region, uiBut *but, int step)
static struct ARegion * wm_searchbox_tooltip_init(struct bContext *C, struct ARegion *region, int *UNUSED(r_pass), double *UNUSED(pass_delay), bool *r_exit_on_event)
void ui_searchbox_free(bContext *C, ARegion *region)
ARegion * ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiButSearch *search_but)
bool ui_searchbox_apply(uiBut *but, ARegion *region)
static void ui_searchbox_update_fn(bContext *C, uiButSearch *search_but, const char *str, uiSearchItems *items)
bool ui_searchbox_inside(ARegion *region, int x, int y)
static void ui_searchbox_region_draw_cb__menu(const bContext *UNUSED(C), ARegion *UNUSED(region))
bool ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, ARegion *butregion, const wmEvent *event)
static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *region)
struct uiSearchboxData uiSearchboxData
ARegion * ui_searchbox_create_menu(bContext *C, ARegion *butregion, uiButSearch *search_but)
int UI_search_items_find_index(uiSearchItems *items, const char *name)
int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *str)
void ui_region_temp_remove(bContext *C, bScreen *screen, ARegion *region)
ARegion * ui_region_temp_add(bScreen *screen)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool active
all scheduled work for the GPU.
PropertyType RNA_property_type(PropertyRNA *prop)
void(* draw)(const struct bContext *C, struct ARegion *region)
struct ARegionType * type
uiButSearchUpdateFn items_update_fn
bool results_are_suggestions
const char * item_sep_string
uiButSearchTooltipFn item_tooltip_fn
uiButSearchContextMenuFn item_context_menu_fn
struct wmOperatorType * optype
char drawstr[UI_MAX_DRAW_STR]
struct PropertyRNA * rnaprop
uint8_t * name_prefix_offsets
void wmOrtho2_region_pixelspace(const ARegion *region)
int WM_window_pixels_x(const wmWindow *win)