|
Blender V5.0
|
#include "MEM_guardedalloc.h"#include <cstdarg>#include <cstdlib>#include <cstring>#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_math_base.h"#include "BLI_rect.h"#include "BLI_string.h"#include "BLI_string_utf8.h"#include "BLI_task.hh"#include "BLI_utildefines.h"#include "BKE_context.hh"#include "BKE_screen.hh"#include "WM_api.hh"#include "WM_types.hh"#include "RNA_access.hh"#include "UI_interface_icons.hh"#include "UI_view2d.hh"#include "BLT_translation.hh"#include "ED_screen.hh"#include "BLF_api.hh"#include "GPU_state.hh"#include "interface_intern.hh"#include "interface_regions_intern.hh"Go to the source code of this file.
Classes | |
| struct | uiSearchItems |
| struct | uiSearchboxData |
Search Box Region & Interaction
Definition in file interface_region_search.cc.
| #define SEARCH_ITEMS 10 |
Definition at line 102 of file interface_region_search.cc.
Referenced by ui_searchbox_butrect(), ui_searchbox_create_generic_ex(), and UI_searchbox_size_y().
|
static |
Similar to Python's str.title except...
Definition at line 1063 of file interface_region_search.cc.
References ELEM, i, len, and str.
Referenced by ui_searchbox_region_draw_cb__operator().
| void ui_but_search_refresh | ( | uiButSearch * | but | ) |
XXX weak: search_func adds all partial matches.
Definition at line 1206 of file interface_region_search.cc.
References uiBut::block, uiBut::drawstr, uiBlock::evil_C, uiBut::hardmax, i, uiSearchItems::maxitem, uiSearchItems::maxstrlen, MEM_callocN(), MEM_freeN(), uiSearchItems::more, uiSearchItems::names, PROP_STRING, uiButSearch::results_are_suggestions, RNA_property_type(), uiBut::rnaprop, uiSearchItems::totitem, UI_but_flag_enable(), UI_BUT_REDALERT, UI_search_items_find_index(), and ui_searchbox_update_fn().
Referenced by UI_but_func_search_set().
| bool UI_search_item_add | ( | uiSearchItems * | items, |
| blender::StringRef | name, | ||
| void * | poin, | ||
| int | iconid, | ||
| int | but_flag, | ||
| uint8_t | name_prefix_offset ) |
Public function exported for functions that use ButType::SearchMenu.
Use inside searchfunc to add items.
| items | Stores the items. |
| name | Text to display for the item. |
| poin | Opaque pointer (for use by the caller). |
| iconid | The icon, #ICON_NONE for no icon. |
| but_flag | Button flags (uiBut.flag) indicating the state of the item, typically UI_BUT_DISABLED, UI_BUT_INACTIVE or UI_BUT_HAS_SEP_CHAR. |
Definition at line 104 of file interface_region_search.cc.
References uiSearchItems::active, uiSearchItems::autocpl, BLI_assert, uiSearchItems::but_flags, uiSearchItems::has_icon, uiSearchItems::icons, uiSearchItems::maxitem, uiSearchItems::maxstrlen, MEM_callocN(), uiSearchItems::more, name, uiSearchItems::name_prefix_offsets, uiSearchItems::names, uiSearchItems::offset_i, uiSearchItems::pointers, uiSearchItems::totitem, UI_autocomplete_update_name(), UI_BUT_DISABLED, UI_BUT_HAS_SEP_CHAR, UI_BUT_INACTIVE, and UI_BUT_REDALERT.
Referenced by add_collection_search_item(), blender::ui::attribute_search_add_items(), blender::ui::attribute_search_item_add(), blender::ui::grease_pencil_layer_search_add_items(), blender::ed::space_node::grid_search_item_add(), id_search_add(), blender::ed::space_node::link_drag_search_update_fn(), menu_search_update_fn(), blender::ed::outliner::merged_element_search_fn_recursive(), blender::ed::space_node::node_find_update_fn(), operator_enum_search_update_fn(), operator_search_update_fn(), and blender::ed::space_node::volume_grid_search_add_items().
| int UI_search_items_find_index | ( | const uiSearchItems * | items, |
| const char * | name ) |
Check if a string is in an existing search box.
Definition at line 238 of file interface_region_search.cc.
References i, name, uiSearchItems::name_prefix_offsets, uiSearchItems::names, STREQ, and uiSearchItems::totitem.
Referenced by blender::ed::outliner::merged_element_search_fn_recursive(), ui_but_search_refresh(), and ui_searchbox_find_index().
String validated to be of correct length (but->hardmax).
Definition at line 341 of file interface_region_search.cc.
References BLI_assert, BLI_strdup(), BLI_strncpy(), data, uiBut::editstr, uiBut::hardmax, uiButSearch::item_active, uiButSearch::item_active_str, MEM_SAFE_FREE, name, ARegion::regiondata, SearchMenu, uiBut::type, and UI_SEP_CHAR.
Referenced by ui_textedit_end().
Definition at line 599 of file interface_region_search.cc.
References AUTOCOMPLETE_NO_MATCH, BLI_assert, C, data, uiBut::editstr, ARegion::regiondata, SearchMenu, str, uiBut::type, UI_autocomplete_begin(), UI_autocomplete_end(), ui_but_string_get_maxncpy(), and ui_searchbox_update_fn().
Referenced by ui_textedit_autocomplete().
|
static |
Definition at line 293 of file interface_region_search.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), col, data, SEARCH_ITEMS, UI_SEARCHBOX_TRIA_H, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_searchbox_event(), ui_searchbox_region_draw_cb__operator(), ui_searchbox_region_draw_fn(), and wm_searchbox_tooltip_init().
| ARegion * ui_searchbox_create_generic | ( | bContext * | C, |
| ARegion * | butregion, | ||
| uiButSearch * | search_but ) |
Search-box for string button.
Definition at line 1052 of file interface_region_search.cc.
References C, and ui_searchbox_create_generic_ex().
Referenced by template_common_search_menu(), ui_but_add_search(), UI_but_func_search_set(), and uiDefSearchButO_ptr().
|
static |
Definition at line 971 of file interface_region_search.cc.
References uiButSearch::arg, uiBlock::aspect, uiBut::block, C, CTX_wm_screen(), data, ARegionType::draw, ED_region_floating_init(), ED_region_tag_redraw(), uiBlock::flag, ARegionType::free, uiBut::hardmax, i, uiButSearch::item_sep_string, ARegionType::layout, uiButSearch::listen_fn, ARegionType::listener, MEM_calloc_arrayN(), MEM_callocN(), uiBut::optype, uiButSearch::preview_cols, uiButSearch::preview_rows, ARegion::regiondata, ARegionType::regionid, RGN_TYPE_TEMPORARY, ARegion::runtime, SEARCH_ITEMS, UI_BLOCK_SEARCH_MENU, ui_fontscale(), UI_fontstyle_set(), UI_MAX_NAME_STR, ui_region_temp_add(), ui_searchbox_region_draw_fn(), ui_searchbox_region_free_fn(), ui_searchbox_region_layout_fn(), ui_searchbox_region_listen_fn(), UI_style_get(), and uiStyle::widget.
Referenced by ui_searchbox_create_generic(), ui_searchbox_create_menu(), and ui_searchbox_create_operator().
| ARegion * ui_searchbox_create_menu | ( | bContext * | C, |
| ARegion * | butregion, | ||
| uiButSearch * | search_but ) |
Definition at line 1195 of file interface_region_search.cc.
References C, ARegion::runtime, ui_searchbox_create_generic_ex(), and ui_searchbox_region_draw_cb__menu().
Referenced by UI_but_func_menu_search().
| ARegion * ui_searchbox_create_operator | ( | bContext * | C, |
| ARegion * | butregion, | ||
| uiButSearch * | search_but ) |
Definition at line 1176 of file interface_region_search.cc.
References C, ARegion::runtime, ui_searchbox_create_generic_ex(), and ui_searchbox_region_draw_cb__operator().
Referenced by UI_but_func_operator_search().
Draws a downwards facing triangle.
| rect | Rectangle under which the triangle icon is drawn. Usually from the last result item that can be displayed. |
Definition at line 629 of file interface_region_search.cc.
References BLI_rcti_cent_x(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, U, UI_icon_draw_ex(), UI_ICON_SIZE, UI_NO_ICON_OVERLAY_TEXT, UI_SEARCHBOX_TRIA_H, x, y, and rcti::ymin.
Referenced by ui_searchbox_region_draw_cb__operator(), and ui_searchbox_region_draw_fn().
Draws an upwards facing triangle.
| rect | Rectangle above which the triangle icon is drawn. Usually from the first result item that can be displayed. |
Definition at line 646 of file interface_region_search.cc.
References BLI_rcti_cent_x(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, U, UI_icon_draw_ex(), UI_ICON_SIZE, UI_NO_ICON_OVERLAY_TEXT, UI_SEARCHBOX_TRIA_H, x, y, and rcti::ymax.
Referenced by ui_searchbox_region_draw_cb__operator(), and ui_searchbox_region_draw_fn().
| bool ui_searchbox_event | ( | bContext * | C, |
| ARegion * | region, | ||
| uiBut * | but, | ||
| ARegion * | butregion, | ||
| const wmEvent * | event ) |
Definition at line 405 of file interface_region_search.cc.
References active, uiButSearch::arg, BLI_assert, BLI_rcti_isect_pt(), C, CTX_wm_area(), CTX_wm_window(), data, EVT_DOWNARROWKEY, EVT_UPARROWKEY, is_inside(), uiButSearch::item_active, uiButSearch::item_context_menu_fn, MOUSEMOVE, MOUSEPAN, wmEvent::prev_xy, ARegion::regiondata, RIGHTMOUSE, SearchMenu, uiBut::type, U, ui_pan_to_scroll(), ui_searchbox_butrect(), ui_searchbox_select(), USER_TOOLTIPS, WHEELDOWNMOUSE, WHEELUPMOUSE, ARegion::winrct, wm_searchbox_tooltip_init(), WM_tooltip_clear(), WM_tooltip_timer_init(), rcti::xmin, wmEvent::xy, and rcti::ymin.
Referenced by ui_do_but_textedit().
| int ui_searchbox_find_index | ( | ARegion * | region, |
| const char * | name ) |
Definition at line 328 of file interface_region_search.cc.
References data, name, ARegion::regiondata, and UI_search_items_find_index().
Referenced by ui_textedit_end().
Definition at line 1185 of file interface_region_search.cc.
References C, CTX_wm_screen(), and ui_region_temp_remove().
Referenced by ui_textedit_end().
| bool ui_searchbox_inside | ( | ARegion * | region, |
| const int | xy[2] ) |
Definition at line 334 of file interface_region_search.cc.
References BLI_rcti_isect_pt(), data, ARegion::regiondata, ARegion::winrct, rcti::xmin, xy, and rcti::ymin.
Definition at line 1190 of file interface_region_search.cc.
Referenced by ui_searchbox_create_menu().
Definition at line 1081 of file interface_region_search.cc.
References BLI_strncpy_utf8_rlen(), BLT_I18NCONTEXT_OPERATOR_DEFAULT, CTX_IFACE_, data, IFACE_, min_ii(), ot, ARegion::regiondata, str_tolower_titlecaps_ascii(), ui_draw_menu_item(), ui_draw_widget_menu_back(), UI_HOVER, UI_MENU_ITEM_SEPARATOR_NONE, UI_MENU_ITEM_SEPARATOR_SHORTCUT, ui_searchbox_butrect(), ui_searchbox_draw_clip_tri_down(), ui_searchbox_draw_clip_tri_up(), wmOrtho2_region_pixelspace(), rcti::xmax, and rcti::xmin.
Referenced by ui_searchbox_create_operator().
Definition at line 656 of file interface_region_search.cc.
References C, data, IFACE_, name, ARegion::regiondata, UI_BUT_HAS_SEP_CHAR, UI_BUT_INACTIVE, ui_draw_menu_item(), ui_draw_preview_item(), ui_draw_widget_menu_back(), UI_HOVER, ui_icon_ensure_deferred(), UI_MENU_ITEM_SEPARATOR_HINT, UI_MENU_ITEM_SEPARATOR_NONE, UI_MENU_ITEM_SEPARATOR_SHORTCUT, ui_searchbox_butrect(), ui_searchbox_draw_clip_tri_down(), ui_searchbox_draw_clip_tri_up(), UI_STYLE_TEXT_LEFT, UI_UNIT_X, wmOrtho2_region_pixelspace(), rcti::xmax, and rcti::xmin.
Referenced by ui_searchbox_create_generic_ex().
|
static |
Definition at line 825 of file interface_region_search.cc.
References data, MEM_freeN(), and ARegion::regiondata.
Referenced by ui_searchbox_create_generic_ex().
Definition at line 854 of file interface_region_search.cc.
References BLI_rctf_cent_y(), BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rctf_translate(), BLI_rcti_rctf_copy(), BLI_rcti_size_x(), BLI_rcti_size_y(), BLI_rcti_translate(), uiBut::block, C, CTX_wm_window(), View2D::cur, data, uiBlock::flag, Panel::ofsx, Panel::ofsy, padding(), uiBlock::panel, uiBlock::rect, uiBut::rect, ARegion::regiondata, U, UI_BLOCK_SEARCH_MENU, UI_POPUP_MARGIN, UI_POPUP_MENU_TOP, UI_SEARCHBOX_BOUNDS, ui_searchbox_size_x_from_items(), UI_searchbox_size_y(), UI_view2d_view_to_region_rcti(), UI_view2d_view_to_region_y(), ARegion::v2d, ARegion::winrct, ARegion::winx, ARegion::winy, WM_window_native_pixel_x(), rctf::xmax, rcti::xmax, rctf::xmin, rcti::xmin, rctf::ymax, rcti::ymax, rctf::ymin, and rcti::ymin.
Referenced by ui_searchbox_create_generic_ex().
|
static |
Definition at line 846 of file interface_region_search.cc.
Referenced by ui_searchbox_create_generic_ex().
Definition at line 258 of file interface_region_search.cc.
References C, data, ED_region_tag_redraw(), uiBut::flag, ARegion::regiondata, step, UI_BUT_VALUE_CLEAR, and ui_searchbox_update().
Referenced by ui_searchbox_event(), and ui_searchbox_update().
| int UI_searchbox_size_x | ( | ) |
Definition at line 178 of file interface_region_search.cc.
References UI_UNIT_X.
Referenced by blender::ed::space_node::create_search_popup_block(), wm_enum_search_menu(), and wm_search_menu_invoke().
|
static |
Definition at line 183 of file interface_region_search.cc.
References Array< T, InlineBufferCapacity, Allocator >::index_range(), blender::threading::parallel_for(), and uiSearchItems::totitem.
Referenced by ui_searchbox_region_layout_fn(), and UI_searchbox_size_x_guess().
| int UI_searchbox_size_x_guess | ( | const bContext * | C, |
| const uiButSearchUpdateFn | update_fn, | ||
| void * | arg ) |
Guess a good width for the search box based on the searchable items.
Definition at line 210 of file interface_region_search.cc.
References C, Array< T, InlineBufferCapacity, Allocator >::data(), i, uiSearchItems::icons, uiSearchItems::maxitem, uiSearchItems::maxstrlen, MEM_SAFE_FREE, uiSearchItems::name_prefix_offsets, uiSearchItems::names, and ui_searchbox_size_x_from_items().
Referenced by blender::ed::space_node::node_find_menu(), and template_common_search_menu().
| int UI_searchbox_size_y | ( | ) |
Height in pixels, it's using hard-coded values still.
Definition at line 173 of file interface_region_search.cc.
References SEARCH_ITEMS, UI_SEARCHBOX_TRIA_H, and UI_UNIT_Y.
Referenced by blender::ed::space_node::create_search_popup_block(), blender::ed::outliner::merged_element_search_menu(), blender::ed::space_node::node_find_menu(), template_common_search_menu(), ui_searchbox_region_layout_fn(), wm_enum_search_menu(), and wm_search_menu_invoke().
Region is the search box itself.
Definition at line 521 of file interface_region_search.cc.
References BLI_assert, C, uiBut::changed, data, ED_region_tag_redraw(), uiBut::editstr, uiButSearch::item_active, uiButSearch::items_update_fn, name, ARegion::regiondata, reset(), SearchMenu, STREQLEN, uiBut::type, ui_searchbox_select(), ui_searchbox_update_fn(), and UI_SEP_CHAR.
Referenced by ui_but_set_string_interactive(), ui_do_but_textedit(), ui_searchbox_select(), and ui_textedit_begin().
|
static |
Wrap uiButSearchUpdateFn callback.
Definition at line 507 of file interface_region_search.cc.
References uiButSearch::arg, C, uiBut::changed, CTX_wm_window(), uiBut::editstr, uiButSearch::items_update_fn, str, and WM_tooltip_clear().
Referenced by ui_but_search_refresh(), ui_searchbox_autocomplete(), and ui_searchbox_update().
|
static |
Definition at line 374 of file interface_region_search.cc.
References uiButSearch::arg, BLI_assert, C, data, uiButSearch::item_active, uiButSearch::item_tooltip_fn, LISTBASE_FOREACH, ARegion::regiondata, ARegion::runtime, SearchMenu, UI_region_searchbox_region_get(), and ui_searchbox_butrect().
Referenced by ui_searchbox_event().