Blender
V3.3
|
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include "DNA_ID.h"
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_view2d.h"
#include "BLT_translation.h"
#include "ED_screen.h"
#include "GPU_state.h"
#include "interface_intern.h"
#include "interface_regions_intern.h"
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.
#define MENU_BORDER (int)(0.3f * U.widget_unit) |
Definition at line 46 of file interface_region_search.cc.
#define SEARCH_ITEMS 10 |
Definition at line 91 of file interface_region_search.cc.
|
static |
Similar to Python's str.title
except...
Definition at line 872 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 1000 of file interface_region_search.cc.
References uiBut::block, uiButSearch::but, 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 93 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(), 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 | ( | uiSearchItems * | items, |
const char * | name | ||
) |
Check if a string is in an existing search box.
Definition at line 172 of file interface_region_search.cc.
References uiSearchItems::name_prefix_offsets, uiSearchItems::names, STREQ, and uiSearchItems::totitem.
Referenced by 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 272 of file interface_region_search.cc.
References BLI_assert, BLI_strncpy(), data, uiBut::editstr, uiBut::hardmax, uiButSearch::item_active, ARegion::regiondata, uiBut::type, UI_BTYPE_SEARCH_MENU, and UI_SEP_CHAR.
Referenced by ui_textedit_end().
Definition at line 522 of file interface_region_search.cc.
References AUTOCOMPLETE_NO_MATCH, BLI_assert, C, data, uiBut::editstr, ARegion::regiondata, str, uiBut::type, UI_autocomplete_begin(), UI_autocomplete_end(), UI_BTYPE_SEARCH_MENU, ui_but_string_get_max_length(), and ui_searchbox_update_fn().
Referenced by ui_textedit_autocomplete().
|
static |
Definition at line 227 of file interface_region_search.cc.
References BLI_rcti_size_x(), BLI_rcti_size_y(), col, data, 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 | ( | struct bContext * | C, |
struct ARegion * | butregion, | ||
uiButSearch * | search_but | ||
) |
Search-box for string button.
Definition at line 861 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 692 of file interface_region_search.cc.
References uiBut::a1, uiBut::a2, uiBlock::aspect, 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, uiButSearch::but, C, CTX_wm_screen(), CTX_wm_window(), View2D::cur, data, ED_region_floating_init(), ED_region_tag_redraw(), uiBlock::flag, uiBut::hardmax, uiButSearch::item_sep_string, MEM_callocN, Panel::ofsx, Panel::ofsy, uiBut::optype, uiBlock::panel, uiBut::rect, uiBlock::rect, ARegion::regiondata, RGN_TYPE_TEMPORARY, SEARCH_ITEMS, type, ARegion::type, UI_BLOCK_SEARCH_MENU, ui_fontscale(), UI_fontstyle_set(), UI_MAX_NAME_STR, UI_POPUP_MARGIN, ui_region_temp_add(), ui_searchbox_region_draw_fn(), ui_searchbox_region_free_fn(), UI_searchbox_size_x(), UI_searchbox_size_y(), UI_style_get(), UI_view2d_view_to_region_rcti(), UI_view2d_view_to_region_y(), ARegion::v2d, uiStyle::widget, ARegion::winrct, ARegion::winx, WM_window_pixels_x(), rcti::xmax, rctf::xmax, rcti::xmin, rctf::xmin, rcti::ymax, rctf::ymax, rcti::ymin, and rctf::ymin.
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 989 of file interface_region_search.cc.
References C, ARegionType::draw, ARegion::type, 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 970 of file interface_region_search.cc.
References C, ARegionType::draw, ARegion::type, 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 337 of file interface_region_search.cc.
References Freestyle::a, blender::compositor::active, blender::compositor::area(), 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, ARegion::regiondata, RIGHTMOUSE, uiBut::type, type, UI_BTYPE_SEARCH_MENU, 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.
int ui_searchbox_find_index | ( | ARegion * | region, |
const char * | name | ||
) |
Definition at line 259 of file interface_region_search.cc.
References data, ARegion::regiondata, and UI_search_items_find_index().
Referenced by ui_textedit_end().
Definition at line 979 of file interface_region_search.cc.
References C, CTX_wm_screen(), and ui_region_temp_remove().
Referenced by ui_textedit_end().
Definition at line 265 of file interface_region_search.cc.
References BLI_rcti_isect_pt(), data, ARegion::regiondata, ARegion::winrct, rcti::xmin, xy, and rcti::ymin.
|
static |
Definition at line 984 of file interface_region_search.cc.
Referenced by ui_searchbox_create_menu().
|
static |
Definition at line 890 of file interface_region_search.cc.
References Freestyle::a, BLI_rcti_size_x(), BLI_strncpy_rlen(), BLT_I18NCONTEXT_OPERATOR_DEFAULT, CTX_IFACE_, data, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, wmOperatorType::idname, min_ii(), ot, ARegion::regiondata, str_tolower_titlecaps_ascii(), UI_ACTIVE, ui_draw_menu_item(), ui_draw_widget_menu_back(), 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 542 of file interface_region_search.cc.
References Freestyle::a, BLI_rcti_size_x(), C, data, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, ARegion::regiondata, UI_ACTIVE, UI_BUT_HAS_SEP_CHAR, UI_BUT_INACTIVE, UI_DPI_ICON_SIZE, ui_draw_menu_item(), ui_draw_preview_item(), ui_draw_widget_menu_back(), UI_icon_draw(), ui_icon_ensure_deferred(), 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().
Definition at line 671 of file interface_region_search.cc.
References Freestyle::a, data, MEM_freeN, and ARegion::regiondata.
Referenced by ui_searchbox_create_generic_ex().
Definition at line 192 of file interface_region_search.cc.
References C, data, ED_region_tag_redraw(), uiBut::flag, ARegion::regiondata, UI_BUT_VALUE_CLEAR, and ui_searchbox_update().
Referenced by ui_searchbox_event(), and ui_searchbox_update().
int UI_searchbox_size_x | ( | void | ) |
Definition at line 167 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_create_generic_ex(), wm_enum_search_menu(), and wm_search_menu_invoke().
int UI_searchbox_size_y | ( | void | ) |
Height in pixels, it's using hard-coded values still.
Definition at line 162 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(), merged_element_search_menu(), blender::ed::space_node::node_find_menu(), template_common_search_menu(), ui_searchbox_create_generic_ex(), wm_enum_search_menu(), and wm_search_menu_invoke().
Region is the search box itself.
Definition at line 444 of file interface_region_search.cc.
References Freestyle::a, BLI_assert, uiButSearch::but, C, uiBut::changed, data, ED_region_tag_redraw(), uiBut::editstr, uiButSearch::item_active, uiButSearch::items_update_fn, ARegion::regiondata, 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 430 of file interface_region_search.cc.
References uiButSearch::arg, uiButSearch::but, 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 303 of file interface_region_search.cc.
References uiButSearch::arg, BLI_assert, C, data, uiButSearch::item_active, uiButSearch::item_tooltip_fn, LISTBASE_FOREACH, ARegion::regiondata, UI_BTYPE_SEARCH_MENU, UI_region_searchbox_region_get(), ui_searchbox_butrect(), and ARegion::uiblocks.
Referenced by ui_searchbox_event().