|
Blender V4.3
|
#include <cstdarg>#include <cstdlib>#include <cstring>#include <iostream>#include "DNA_ID.h"#include "MEM_guardedalloc.h"#include "DNA_userdef_types.h"#include "BLI_listbase.h"#include "BLI_rect.h"#include "BLI_string.h"#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.hh"#include "UI_interface_icons.hh"#include "UI_view2d.hh"#include "BLT_translation.hh"#include "ED_screen.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 |
Macros | |
| #define | MENU_BORDER int(0.3f * U.widget_unit) |
Search Box Region & Interaction
Definition in file interface_region_search.cc.
Definition at line 46 of file interface_region_search.cc.
Referenced by ui_searchbox_butrect().
| #define SEARCH_ITEMS 10 |
Definition at line 98 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 944 of file interface_region_search.cc.
References ELEM, 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 1083 of file interface_region_search.cc.
References uiBut::block, uiBut::drawstr, uiBlock::evil_C, uiBut::hardmax, 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, |
| const char * | name, | ||
| void * | poin, | ||
| int | iconid, | ||
| int | but_flag, | ||
| uint8_t | name_prefix_offset ) |
Public function exported for functions that use UI_BTYPE_SEARCH_MENU.
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 100 of file interface_region_search.cc.
References uiSearchItems::active, uiSearchItems::autocpl, BLI_assert, BLI_strncpy(), uiSearchItems::but_flags, uiSearchItems::has_icon, uiSearchItems::icons, uiSearchItems::maxitem, uiSearchItems::maxstrlen, MEM_callocN, uiSearchItems::more, 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(), 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(), and operator_search_update_fn().
| 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 179 of file interface_region_search.cc.
References 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 279 of file interface_region_search.cc.
References BLI_assert, BLI_strdup(), BLI_strncpy(), uiBut::editstr, uiBut::hardmax, uiButSearch::item_active, uiButSearch::item_active_str, MEM_SAFE_FREE, uiBut::type, UI_BTYPE_SEARCH_MENU, and UI_SEP_CHAR.
Referenced by ui_textedit_end().
Definition at line 529 of file interface_region_search.cc.
References AUTOCOMPLETE_NO_MATCH, BLI_assert, uiBut::editstr, str, uiBut::type, UI_autocomplete_begin(), UI_autocomplete_end(), UI_BTYPE_SEARCH_MENU, ui_but_string_get_maxncpy(), and ui_searchbox_update_fn().
Referenced by ui_textedit_autocomplete().
|
static |
Definition at line 234 of file interface_region_search.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), col, MENU_BORDER, SEARCH_ITEMS, UI_POPUP_MENU_TOP, 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 933 of file interface_region_search.cc.
References 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 853 of file interface_region_search.cc.
References uiButSearch::arg, uiBlock::aspect, uiBut::block, CTX_wm_screen(), data, ED_region_floating_init(), ED_region_tag_redraw(), uiBlock::flag, uiBut::hardmax, uiButSearch::item_sep_string, uiButSearch::listen_fn, MEM_callocN, uiBut::optype, uiButSearch::preview_cols, uiButSearch::preview_rows, RGN_TYPE_TEMPORARY, 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 1072 of file interface_region_search.cc.
References 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 1053 of file interface_region_search.cc.
References ui_searchbox_create_generic_ex(), and ui_searchbox_region_draw_cb__operator().
Referenced by UI_but_func_operator_search().
| bool ui_searchbox_event | ( | bContext * | C, |
| ARegion * | region, | ||
| uiBut * | but, | ||
| ARegion * | butregion, | ||
| const wmEvent * | event ) |
Definition at line 343 of file interface_region_search.cc.
References uiButSearch::arg, BLI_assert, BLI_rcti_isect_pt(), CTX_wm_area(), CTX_wm_window(), EVT_DOWNARROWKEY, EVT_UPARROWKEY, is_inside(), uiButSearch::item_active, uiButSearch::item_context_menu_fn, MOUSEMOVE, MOUSEPAN, RIGHTMOUSE, uiBut::type, UI_BTYPE_SEARCH_MENU, ui_pan_to_scroll(), ui_searchbox_butrect(), ui_searchbox_select(), USER_TOOLTIPS, WHEELDOWNMOUSE, WHEELUPMOUSE, wm_searchbox_tooltip_init(), WM_tooltip_clear(), WM_tooltip_timer_init(), and wmEvent::xy.
Referenced by ui_do_but_textedit().
Definition at line 266 of file interface_region_search.cc.
References UI_search_items_find_index().
Referenced by ui_textedit_end().
Definition at line 1062 of file interface_region_search.cc.
References CTX_wm_screen(), and ui_region_temp_remove().
Referenced by ui_textedit_end().
Definition at line 272 of file interface_region_search.cc.
References BLI_rcti_isect_pt(), and xy.
|
static |
Definition at line 719 of file interface_region_search.cc.
References UI_BUT_HAS_SEP_CHAR, UI_MENU_ITEM_SEPARATOR_HINT, UI_MENU_ITEM_SEPARATOR_NONE, and UI_MENU_ITEM_SEPARATOR_SHORTCUT.
Referenced by ui_searchbox_region_layout_fn().
Definition at line 1067 of file interface_region_search.cc.
Referenced by ui_searchbox_create_menu().
Definition at line 962 of file interface_region_search.cc.
References BLI_rcti_size_x(), BLI_strncpy_rlen(), BLT_I18NCONTEXT_OPERATOR_DEFAULT, CTX_IFACE_, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, wmOperatorType::idname, IFACE_, min_ii(), ot, str_tolower_titlecaps_ascii(), ui_draw_menu_item(), ui_draw_widget_menu_back(), UI_HOVER, UI_icon_draw(), UI_MENU_ITEM_SEPARATOR_NONE, UI_MENU_ITEM_SEPARATOR_SHORTCUT, ui_searchbox_butrect(), wmOrtho2_region_pixelspace(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_searchbox_create_operator().
Definition at line 549 of file interface_region_search.cc.
References BLI_rcti_size_x(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, IFACE_, 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_draw(), ui_icon_ensure_deferred(), UI_ICON_SIZE, UI_MENU_ITEM_SEPARATOR_HINT, UI_MENU_ITEM_SEPARATOR_NONE, UI_MENU_ITEM_SEPARATOR_SHORTCUT, ui_searchbox_butrect(), UI_STYLE_TEXT_LEFT, UI_UNIT_X, wmOrtho2_region_pixelspace(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by ui_searchbox_create_generic_ex().
|
static |
Definition at line 690 of file interface_region_search.cc.
References MEM_freeN().
Referenced by ui_searchbox_create_generic_ex().
Definition at line 735 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, CTX_wm_window(), View2D::cur, uiBlock::flag, int, Panel::ofsx, Panel::ofsy, uiBlock::panel, uiBlock::rect, uiBut::rect, UI_BLOCK_SEARCH_MENU, UI_MENU_ITEM_SEPARATOR_NONE, UI_POPUP_MARGIN, UI_SCALE_FAC, ui_searchbox_item_separator(), UI_searchbox_size_x(), UI_searchbox_size_y(), UI_view2d_view_to_region_rcti(), UI_view2d_view_to_region_y(), ARegion::v2d, ARegion::winrct, 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 711 of file interface_region_search.cc.
References params, and uiSearchboxData::search_listener.
Referenced by ui_searchbox_create_generic_ex().
Definition at line 199 of file interface_region_search.cc.
References uiSearchboxData::active, ED_region_tag_redraw(), uiBut::flag, 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 174 of file interface_region_search.cc.
References UI_UNIT_X.
Referenced by blender::ed::space_node::create_search_popup_block(), 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().
| int UI_searchbox_size_y | ( | ) |
Height in pixels, it's using hard-coded values still.
Definition at line 169 of file interface_region_search.cc.
References SEARCH_ITEMS, UI_POPUP_MENU_TOP, 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 451 of file interface_region_search.cc.
References BLI_assert, uiBut::changed, ED_region_tag_redraw(), uiBut::editstr, uiButSearch::item_active, uiButSearch::items_update_fn, reset(), STREQLEN, uiBut::type, UI_BTYPE_SEARCH_MENU, 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 437 of file interface_region_search.cc.
References uiButSearch::arg, 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 312 of file interface_region_search.cc.
References uiButSearch::arg, BLI_assert, uiButSearch::item_active, uiButSearch::item_tooltip_fn, LISTBASE_FOREACH, ARegion::regiondata, UI_BTYPE_SEARCH_MENU, UI_region_searchbox_region_get(), and ui_searchbox_butrect().
Referenced by ui_searchbox_event().