Blender V4.3
interface_handlers.cc File Reference
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <variant>
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
#include "DNA_curveprofile_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BLI_array.hh"
#include "BLI_array_utils.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math_geom.h"
#include "BLI_rect.h"
#include "BLI_sort_utils.h"
#include "BLI_string.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_time.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_blender_undo.hh"
#include "BKE_brush.hh"
#include "BKE_colorband.hh"
#include "BKE_colortools.hh"
#include "BKE_context.hh"
#include "BKE_curveprofile.h"
#include "BKE_movieclip.h"
#include "BKE_paint.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "BKE_tracking.h"
#include "BKE_unit.hh"
#include "GHOST_C-api.h"
#include "IMB_colormanagement.hh"
#include "ED_screen.hh"
#include "ED_undo.hh"
#include "UI_abstract_view.hh"
#include "UI_interface.hh"
#include "UI_interface_c.hh"
#include "UI_string_search.hh"
#include "BLF_api.hh"
#include "interface_intern.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "wm_event_system.hh"

Go to the source code of this file.

Classes

struct  uiBlockInteraction_Handle
 
struct  uiSelectContextElem
 
struct  uiSelectContextStore
 
struct  uiButMultiState
 
struct  uiHandleButtonMulti
 
struct  uiTextEdit
 
struct  uiHandleButtonData
 
struct  uiAfterFunc
 
struct  uiDragToggleHandle
 

Macros

#define CASE_NUM_TO_DIR(n, d)
 
Feature Defines

These defines allow developers to locally toggle functionality which may be useful for testing (especially conflicts in dragging). Ideally the code would be refactored to support this functionality in a less fragile way. Until then keep these defines.

#define USE_CONT_MOUSE_CORRECT
 
#define USE_DRAG_TOGGLE
 
#define USE_DRAG_MULTINUM
 
#define USE_ALLSELECT
 
#define USE_KEYNAV_LIMIT
 
#define USE_DRAG_POPUP
 
Local Defines
#define UI_MAX_PASSWORD_STR   128
 
#define UI_PROP_SCALE_LOG_MIN   0.5e-8f
 
#define UI_PROP_SCALE_LOG_SNAP_OFFSET   0.03f
 
#define UI_DRAG_MAP_SOFT_RANGE_PIXEL_MAX   1000
 

Functions

Local Prototypes
static int ui_do_but_EXIT (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_but_find_select_in_enum__cmp (const uiBut *but_a, const uiBut *but_b)
 
static void ui_textedit_string_set (uiBut *but, uiTextEdit &text_edit, const char *str)
 
static void button_tooltip_timer_reset (bContext *C, uiBut *but)
 
static void ui_block_interaction_begin_ensure (bContext *C, uiBlock *block, uiHandleButtonData *data, const bool is_click)
 
static uiBlockInteraction_Handleui_block_interaction_begin (bContext *C, uiBlock *block, const bool is_click)
 
static void ui_block_interaction_end (bContext *C, uiBlockInteraction_CallbackData *callbacks, uiBlockInteraction_Handle *interaction)
 
static void ui_block_interaction_update (bContext *C, uiBlockInteraction_CallbackData *callbacks, uiBlockInteraction_Handle *interaction)
 
static void ui_mouse_motion_keynav_init (uiKeyNavLock *keynav, const wmEvent *event)
 
static bool ui_mouse_motion_keynav_test (uiKeyNavLock *keynav, const wmEvent *event)
 
static void with_but_active_as_semi_modal (bContext *C, ARegion *region, uiBut *but, blender::FunctionRef< void()> fn)
 
static int ui_handle_region_semi_modal_buttons (bContext *C, const wmEvent *event, ARegion *region)
 
UI Queries
bool ui_but_is_editing (const uiBut *but)
 
void ui_pan_to_scroll (const wmEvent *event, int *type, int *val)
 
uiButui_but_find_select_in_enum (uiBut *but, int direction)
 
static float ui_mouse_scale_warp_factor (const bool shift)
 
static void ui_mouse_scale_warp (uiHandleButtonData *data, const float mx, const float my, float *r_mx, float *r_my, const bool shift)
 
UI Utilities
static bool ui_but_dragedit_update_mval (uiHandleButtonData *data, int mx)
 
static bool ui_rna_is_userdef (PointerRNA *ptr, PropertyRNA *prop)
 
bool UI_but_is_userdef (const uiBut *but)
 
static void ui_rna_update_preferences_dirty (PointerRNA *ptr, PropertyRNA *prop)
 
static void ui_but_update_preferences_dirty (uiBut *but)
 
static void ui_afterfunc_update_preferences_dirty (uiAfterFunc *after)
 
Button Drag Multi-Number
static void ui_multibut_add (uiHandleButtonData *data, uiBut *but)
 
static void ui_multibut_free (uiHandleButtonData *data, uiBlock *block)
 
static bool ui_multibut_states_tag (uiBut *but_active, uiHandleButtonData *data, const wmEvent *event)
 
static void ui_multibut_states_create (uiBut *but_active, uiHandleButtonData *data)
 
static void ui_multibut_states_apply (bContext *C, uiHandleButtonData *data, uiBlock *block)
 
Button Drag Toggle
static bool ui_drag_toggle_but_is_supported (const uiBut *but)
 
static int ui_drag_toggle_but_pushed_state (uiBut *but)
 
static bool ui_drag_toggle_set_xy_xy (bContext *C, ARegion *region, const int pushed_state, const int xy_src[2], const int xy_dst[2])
 
static void ui_drag_toggle_set (bContext *C, uiDragToggleHandle *drag_info, const int xy_input[2])
 
static void ui_handler_region_drag_toggle_remove (bContext *, void *userdata)
 
static int ui_handler_region_drag_toggle (bContext *C, const wmEvent *event, void *userdata)
 
static bool ui_but_is_drag_toggle (const uiBut *but)
 
Button Drag
static bool ui_but_drag_init (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
Button Apply
static void ui_apply_but_IMAGE (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_HISTOGRAM (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_WAVEFORM (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_TRACKPREVIEW (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const bool interactive)
 
Button Copy & Paste
static void ui_but_get_pasted_text_from_clipboard (const bool ensure_utf8, char **r_buf_paste, int *r_buf_len)
 
static int get_but_property_array_length (uiBut *but)
 
static void ui_but_set_float_array (bContext *C, uiBut *but, uiHandleButtonData *data, const float *values, const int values_len)
 
static void float_array_to_string (const float *values, const int values_len, char *output, int output_maxncpy)
 
static void ui_but_copy_numeric_array (uiBut *but, char *output, int output_maxncpy)
 
static bool parse_float_array (char *text, float *values, int values_len_expected)
 
static void ui_but_paste_numeric_array (bContext *C, uiBut *but, uiHandleButtonData *data, char *buf_paste)
 
static void ui_but_copy_numeric_value (uiBut *but, char *output, int output_maxncpy)
 
static void ui_but_paste_numeric_value (bContext *C, uiBut *but, uiHandleButtonData *data, char *buf_paste)
 
static void ui_but_paste_normalized_vector (bContext *C, uiBut *but, uiHandleButtonData *data, char *buf_paste)
 
static void ui_but_copy_color (uiBut *but, char *output, int output_maxncpy)
 
static void ui_but_paste_color (bContext *C, uiBut *but, char *buf_paste)
 
static void ui_but_copy_text (uiBut *but, char *output, int output_maxncpy)
 
static void ui_but_paste_text (bContext *C, uiBut *but, uiHandleButtonData *data, char *buf_paste)
 
static void ui_but_copy_colorband (uiBut *but)
 
static void ui_but_paste_colorband (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_but_copy_curvemapping (uiBut *but)
 
static void ui_but_paste_curvemapping (bContext *C, uiBut *but)
 
static void ui_but_copy_CurveProfile (uiBut *but)
 
static void ui_but_paste_CurveProfile (bContext *C, uiBut *but)
 
static void ui_but_copy_operator (bContext *C, uiBut *but, char *output, int output_maxncpy)
 
static bool ui_but_copy_menu (uiBut *but, char *output, int output_maxncpy)
 
static bool ui_but_copy_popover (uiBut *but, char *output, int output_maxncpy)
 
static bool ui_but_copy (bContext *C, uiBut *but, const bool copy_array)
 
static void ui_but_paste (bContext *C, uiBut *but, uiHandleButtonData *data, const bool paste_array)
 
void ui_but_clipboard_free ()
 
Button Text Password

Functions to convert password strings that should not be displayed to asterisk representation (e.g. 'mysecretpasswd' -> '*************')

It converts every UTF-8 character to an asterisk, and also remaps the cursor position and selection start/end.

Note
remapping is used, because password could contain UTF-8 characters.
static int ui_text_position_from_hidden (uiBut *but, int pos)
 
static int ui_text_position_to_hidden (uiBut *but, int pos)
 
void ui_but_text_password_hide (char password_str[UI_MAX_PASSWORD_STR], uiBut *but, const bool restore)
 
Button Number Editing (various types)
static void ui_numedit_begin (uiBut *but, uiHandleButtonData *data)
 
static void ui_numedit_end (uiBut *but, uiHandleButtonData *data)
 
static void ui_numedit_apply (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
 
static void ui_but_extra_operator_icon_apply (bContext *C, uiBut *but, uiButExtraOpIcon *op_icon)
 
Menu/Popup Begin/End (various popup types)
static void ui_block_open_begin (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_block_open_end (bContext *C, uiBut *but, uiHandleButtonData *data)
 
int ui_but_menu_direction (uiBut *but)
 
static uiButui_but_list_row_text_activate (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event, uiButtonActivateType activate_type)
 
Events for Various Button Types
static uiButExtraOpIconui_but_extra_operator_icon_mouse_over_get (uiBut *but, ARegion *region, const wmEvent *event)
 
static bool ui_do_but_ANY_drag_toggle (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event, int *r_retval)
 
static int ui_do_but_BUT (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_HOTKEYEVT (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_KEYEVT (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_TAB (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_TEX (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_SEARCH_UNLINK (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_TOG (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static void force_activate_view_item_but (bContext *C, ARegion *region, uiButViewItem *but, const bool close_popup=true)
 
static int ui_do_but_VIEW_ITEM (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static float ui_numedit_apply_snapf (uiBut *but, float tempf, float softmin, float softmax, const enum eSnapType snap)
 
static float ui_numedit_apply_snap (int temp, float softmin, float softmax, const enum eSnapType snap)
 
static bool ui_numedit_but_NUM (uiButNumber *but, uiHandleButtonData *data, int mx, const bool is_motion, const enum eSnapType snap, float fac)
 
static void ui_numedit_set_active (uiBut *but)
 
static int ui_do_but_NUM (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_SLI (uiBut *but, uiHandleButtonData *data, int mx, const bool is_horizontal, const bool is_motion, const bool snap, const bool shift)
 
static int ui_do_but_SLI (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_SCROLL (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_GRIP (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_LISTROW (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_BLOCK (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_UNITVEC (uiBut *but, uiHandleButtonData *data, int mx, int my, const enum eSnapType snap)
 
static void ui_palette_set_active (uiButColor *color_but)
 
static int ui_do_but_COLOR (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_UNITVEC (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static void clamp_axis_max_v3 (float v[3], const float max)
 
static void ui_rgb_to_color_picker_HSVCUBE_compat_v (const uiButHSVCube *hsv_but, const float rgb[3], float hsv[3])
 
static void ui_rgb_to_color_picker_HSVCUBE_v (const uiButHSVCube *hsv_but, const float rgb[3], float hsv[3])
 
static void ui_color_picker_to_rgb_HSVCUBE_v (const uiButHSVCube *hsv_but, const float hsv[3], float rgb[3])
 
static bool ui_numedit_but_HSVCUBE (uiBut *but, uiHandleButtonData *data, int mx, int my, const enum eSnapType snap, const bool shift)
 
static int ui_do_but_HSVCUBE (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_HSVCIRCLE (uiBut *but, uiHandleButtonData *data, float mx, float my, const enum eSnapType snap, const bool shift)
 
static int ui_do_but_HSVCIRCLE (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_COLORBAND (uiBut *but, uiHandleButtonData *data, int mx)
 
static int ui_do_but_COLORBAND (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_CURVE (uiBlock *block, uiBut *but, uiHandleButtonData *data, int evtx, int evty, bool snap, const bool shift)
 
static int ui_do_but_CURVE (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_CURVEPROFILE (uiBlock *block, uiBut *but, uiHandleButtonData *data, int evtx, int evty, bool snap, const bool shift)
 
static bool point_draw_handles (CurveProfilePoint *point)
 
static int ui_do_but_CURVEPROFILE (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_HISTOGRAM (uiBut *but, uiHandleButtonData *data, int mx, int my)
 
static int ui_do_but_HISTOGRAM (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_WAVEFORM (uiBut *but, uiHandleButtonData *data, int mx, int my)
 
static int ui_do_but_WAVEFORM (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static bool ui_numedit_but_TRACKPREVIEW (bContext *C, uiBut *but, uiHandleButtonData *data, int mx, int my, const bool shift)
 
static int ui_do_but_TRACKPREVIEW (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_button (bContext *C, uiBlock *block, uiBut *but, const wmEvent *event)
 
Button Tool Tip
static void ui_blocks_set_tooltips (ARegion *region, const bool enable)
 
void UI_but_tooltip_refresh (bContext *C, uiBut *but)
 
void UI_but_tooltip_timer_remove (bContext *C, uiBut *but)
 
static ARegionui_but_tooltip_init (bContext *C, ARegion *region, int *pass, double *r_pass_delay, bool *r_exit_on_event)
 
Button State Handling
static bool button_modal_state (uiHandleButtonState state)
 
void ui_but_active_free (const bContext *C, uiBut *but)
 
void ui_but_semi_modal_state_free (const bContext *C, uiBut *but)
 
static uiButui_context_button_active (const ARegion *region, bool(*but_check_cb)(const uiBut *))
 
uiButUI_context_active_but_get (const bContext *C)
 
uiButUI_context_active_but_get_respect_popup (const bContext *C)
 
uiButUI_region_active_but_get (const ARegion *region)
 
uiButUI_region_but_find_rect_over (const ARegion *region, const rcti *rect_px)
 
uiBlockUI_region_block_find_mouse_over (const ARegion *region, const int xy[2], bool only_clip)
 
uiButUI_region_active_but_prop_get (const ARegion *region, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
 
uiButUI_context_active_but_prop_get (const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
 
void UI_context_active_but_prop_handle (bContext *C, const bool handle_undo)
 
void UI_context_active_but_clear (bContext *C, wmWindow *win, ARegion *region)
 
wmOperatorUI_context_active_operator_get (const bContext *C)
 
ARegionUI_region_searchbox_region_get (const ARegion *button_region)
 
void UI_context_update_anim_flag (const bContext *C)
 
void ui_but_update_view_for_active (const bContext *C, const uiBlock *block)
 
Button Activation Handling
static uiButui_but_find_open_event (ARegion *region, const wmEvent *event)
 
static int ui_handle_button_over (bContext *C, const wmEvent *event, ARegion *region)
 
void ui_but_activate_event (bContext *C, ARegion *region, uiBut *but)
 
void ui_but_activate_over (bContext *C, ARegion *region, uiBut *but)
 
void ui_but_execute_begin (bContext *, ARegion *region, uiBut *but, void **active_back)
 
void ui_but_execute_end (bContext *C, ARegion *, uiBut *but, void *active_back)
 
static bool ui_handle_button_activate_by_type (bContext *C, ARegion *region, uiBut *but)
 
static void foreach_semi_modal_but_as_active (bContext *C, ARegion *region, blender::FunctionRef< void(uiBut *semi_modal_but)> fn)
 
Handle Events for Activated Buttons
static bool ui_button_value_default (uiBut *but, double *r_value)
 
static int ui_handle_button_event (bContext *C, const wmEvent *event, uiBut *but)
 
static int ui_list_activate_hovered_row (bContext *C, ARegion *region, const uiList *ui_list, const wmEvent *event, bool activate_dragging)
 
static bool ui_list_is_hovering_draggable_but (bContext *C, const uiList *list, const ARegion *region, const wmEvent *event)
 
static int ui_list_handle_click_drag (bContext *C, const uiList *ui_list, ARegion *region, const wmEvent *event)
 
static void ui_list_activate_row_from_index (bContext *C, ARegion *region, uiBut *listbox, uiList *ui_list, int index)
 
static int ui_list_get_increment (const uiList *ui_list, const int type, const int columns)
 
static int ui_handle_list_event (bContext *C, const wmEvent *event, ARegion *region, uiBut *listbox)
 
static int ui_handle_viewlist_items_hover (const wmEvent *event, ARegion *region)
 
static int ui_handle_view_item_event (bContext *C, const wmEvent *event, uiBut *active_but, ARegion *region)
 
static void ui_handle_button_return_submenu (bContext *C, const wmEvent *event, uiBut *but)
 
Menu Towards (mouse motion logic)
static void ui_mouse_motion_towards_init_ex (uiPopupBlockHandle *menu, const int xy[2], const bool force)
 
static void ui_mouse_motion_towards_init (uiPopupBlockHandle *menu, const int xy[2])
 
static void ui_mouse_motion_towards_reinit (uiPopupBlockHandle *menu, const int xy[2])
 
static bool ui_mouse_motion_towards_check (uiBlock *block, uiPopupBlockHandle *menu, const int xy[2], const bool use_wiggle_room)
 
Menu Scroll
static char ui_menu_scroll_test (uiBlock *block, int my)
 
static void ui_menu_scroll_apply_offset_y (ARegion *region, uiBlock *block, float dy)
 
static bool ui_menu_scroll_to_but (ARegion *region, uiBlock *block, uiBut *but_target)
 
static bool ui_menu_scroll_to_y (ARegion *region, uiBlock *block, int y)
 
static bool ui_menu_scroll_step (ARegion *region, uiBlock *block, const int scroll_dir)
 
Menu Event Handling
static void ui_region_auto_open_clear (ARegion *region)
 
static bool ui_menu_pass_event_to_parent_if_nonactive (uiPopupBlockHandle *menu, const uiBut *but, const int level, const bool is_parent_menu, const int retval)
 
static int ui_handle_menu_button (bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
 
float ui_block_calc_pie_segment (uiBlock *block, const float event_xy[2])
 
static int ui_handle_menu_letter_press_search (uiPopupBlockHandle *menu, const wmEvent *event)
 
static int ui_handle_menu_event (bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level, const bool is_parent_inside, const bool is_parent_menu, const bool is_floating)
 
static int ui_handle_menu_return_submenu (bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
 
static bool ui_but_pie_menu_supported_apply (uiBut *but)
 
static int ui_but_pie_menu_apply (bContext *C, uiPopupBlockHandle *menu, uiBut *but, bool force_close)
 
static uiButui_block_pie_dir_activate (uiBlock *block, const wmEvent *event, RadialDirection dir)
 
static int ui_but_pie_button_activate (bContext *C, uiBut *but, uiPopupBlockHandle *menu)
 
static int ui_pie_handler (bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
 
static int ui_handle_menus_recursive (bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level, const bool is_parent_inside, const bool is_parent_menu, const bool is_floating)
 
void UI_popup_menu_retval_set (const uiBlock *block, const int retval, const bool enable)
 
UI Event Handlers
static int ui_region_handler (bContext *C, const wmEvent *event, void *)
 
static void ui_region_handler_remove (bContext *C, void *)
 
static int ui_popup_handler (bContext *C, const wmEvent *event, void *userdata)
 
static void ui_popup_handler_remove (bContext *C, void *userdata)
 
void UI_region_handlers_add (ListBase *handlers)
 
void UI_popup_handlers_add (bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, const char flag)
 
void UI_popup_handlers_remove (ListBase *handlers, uiPopupBlockHandle *popup)
 
void UI_popup_handlers_remove_all (bContext *C, ListBase *handlers)
 
bool UI_textbutton_activate_rna (const bContext *C, ARegion *region, const void *rna_poin_data, const char *rna_prop_id)
 
bool UI_textbutton_activate_but (const bContext *C, uiBut *actbut)
 
Public Utilities
void UI_region_free_active_but_all (bContext *C, ARegion *region)
 
void UI_screen_free_active_but_highlight (const bContext *C, bScreen *screen)
 
uiButUI_but_active_drop_name_button (const bContext *C)
 
bool UI_but_active_drop_name (const bContext *C)
 
bool UI_but_active_drop_color (bContext *C)
 
UI Block Interaction API
void UI_block_interaction_set (uiBlock *block, uiBlockInteraction_CallbackData *callbacks)
 

Structs & Defines

#define BUTTON_FLASH_DELAY   0.020
 
#define MENU_SCROLL_INTERVAL   0.1
 
#define PIE_MENU_INTERVAL   0.01
 
#define BUTTON_AUTO_OPEN_THRESH   0.2
 
#define BUTTON_MOUSE_TOWARDS_THRESH   1.0
 
#define BUTTON_KEYNAV_PX_LIMIT   8
 
#define MENU_TOWARDS_MARGIN   20
 
#define MENU_TOWARDS_WIGGLE_ROOM   64
 
#define BUTTON_DRAGLOCK_THRESH   3
 
#define USE_ALLSELECT_LAYER_HACK
 
#define IS_ALLSELECT_EVENT(event)   (((event)->modifier & KM_ALT) != 0)
 
#define UI_BUT_IS_SELECT_CONTEXT   UI_BUT_NODE_ACTIVE
 
#define DRAG_MULTINUM_THRESHOLD_DRAG_X   (UI_UNIT_Y / 4)
 
#define DRAG_MULTINUM_THRESHOLD_DRAG_Y   (UI_UNIT_Y / 4)
 
#define DRAG_MULTINUM_THRESHOLD_VERTICAL   (0.75f)
 
enum  uiButtonActivateType {
  BUTTON_ACTIVATE_OVER , BUTTON_ACTIVATE , BUTTON_ACTIVATE_APPLY , BUTTON_ACTIVATE_TEXT_EDITING ,
  BUTTON_ACTIVATE_OPEN
}
 
enum  uiHandleButtonState {
  BUTTON_STATE_INIT , BUTTON_STATE_HIGHLIGHT , BUTTON_STATE_WAIT_FLASH , BUTTON_STATE_WAIT_RELEASE ,
  BUTTON_STATE_WAIT_KEY_EVENT , BUTTON_STATE_NUM_EDITING , BUTTON_STATE_TEXT_EDITING , BUTTON_STATE_TEXT_SELECTING ,
  BUTTON_STATE_MENU_OPEN , BUTTON_STATE_WAIT_DRAG , BUTTON_STATE_EXIT
}
 
enum  uiMenuScrollType { MENU_SCROLL_UP , MENU_SCROLL_DOWN , MENU_SCROLL_TOP , MENU_SCROLL_BOTTOM }
 
static ColorBand but_copypaste_coba = {0}
 
static CurveMapping but_copypaste_curve = {0}
 
static bool but_copypaste_curve_alive = false
 
static CurveProfile but_copypaste_profile = {0}
 
static bool but_copypaste_profile_alive = false
 
static bool ui_selectcontext_begin (bContext *C, uiBut *but, uiSelectContextStore *selctx_data)
 
static void ui_selectcontext_end (uiBut *but, uiSelectContextStore *selctx_data)
 
static void ui_selectcontext_apply (bContext *C, uiBut *but, uiSelectContextStore *selctx_data, const double value, const double value_orig)
 
static void button_activate_init (bContext *C, ARegion *region, uiBut *but, uiButtonActivateType type)
 
static void button_activate_state (bContext *C, uiBut *but, uiHandleButtonState state)
 
static void button_activate_exit (bContext *C, uiBut *but, uiHandleButtonData *data, const bool mousemove, const bool onfree)
 
static int ui_handler_region_menu (bContext *C, const wmEvent *event, void *userdata)
 
static void ui_handle_button_activate (bContext *C, ARegion *region, uiBut *but, uiButtonActivateType type)
 
static bool ui_do_but_extra_operator_icon (bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static void ui_do_but_extra_operator_icons_mousemove (uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static void ui_numedit_begin_set_values (uiBut *but, uiHandleButtonData *data)
 
static void ui_multibut_restore (bContext *C, uiHandleButtonData *data, uiBlock *block)
 
static uiButMultiStateui_multibut_lookup (uiHandleButtonData *data, const uiBut *but)
 

Button Snap Values

enum  eSnapType { SNAP_OFF = 0 , SNAP_ON , SNAP_ON_SMALL }
 
static enum eSnapType ui_event_to_snap (const wmEvent *event)
 
static bool ui_event_is_snap (const wmEvent *event)
 
static void ui_color_snap_hue (const enum eSnapType snap, float *r_hue)
 

Button Text Selection/Editing

enum  { UI_TEXTEDIT_PASTE = 1 , UI_TEXTEDIT_COPY , UI_TEXTEDIT_CUT }
 
void ui_but_set_string_interactive (bContext *C, uiBut *but, const char *value)
 
void ui_but_active_string_clear_and_exit (bContext *C, uiBut *but)
 
static void ui_textedit_string_ensure_max_length (uiBut *but, uiTextEdit &text_edit, int str_maxncpy)
 
static bool ui_textedit_delete_selection (uiBut *but, uiTextEdit &text_edit)
 
static void ui_textedit_set_cursor_pos (uiBut *but, const ARegion *region, const float x)
 
static void ui_textedit_set_cursor_select (uiBut *but, uiHandleButtonData *data, const float x)
 
static bool ui_textedit_insert_buf (uiBut *but, uiTextEdit &text_edit, const char *buf, int buf_len)
 
static void ui_textedit_move (uiBut *but, uiTextEdit &text_edit, eStrCursorJumpDirection direction, const bool select, eStrCursorJumpType jump)
 
static bool ui_textedit_delete (uiBut *but, uiTextEdit &text_edit, eStrCursorJumpDirection direction, eStrCursorJumpType jump)
 
static int ui_textedit_autocomplete (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static bool ui_textedit_copypaste (uiBut *but, uiTextEdit &text_edit, const int mode)
 
static void ui_textedit_begin (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_textedit_end (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_textedit_next_but (uiBlock *block, uiBut *actbut, uiHandleButtonData *data)
 
static void ui_textedit_prev_but (uiBlock *block, uiBut *actbut, uiHandleButtonData *data)
 
static eStrCursorJumpType ui_textedit_jump_type_from_event (const wmEvent *event)
 
static int ui_do_but_textedit (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 
static int ui_do_but_textedit_select (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
 

Button Apply/Revert

static ListBase UIAfterFuncs = {nullptr, nullptr}
 
static uiAfterFuncui_afterfunc_new ()
 
static void ui_handle_afterfunc_add_operator_ex (wmOperatorType *ot, PointerRNA **properties, wmOperatorCallContext opcontext, const uiBut *context_but)
 
void ui_handle_afterfunc_add_operator (wmOperatorType *ot, wmOperatorCallContext opcontext)
 
static void popup_check (bContext *C, wmOperator *op)
 
static bool ui_afterfunc_check (const uiBlock *block, const uiBut *but)
 
static void ui_apply_but_func (bContext *C, uiBut *but)
 
static void ui_apply_but_undo (uiBut *but)
 
static void ui_apply_but_autokey (bContext *C, uiBut *but)
 
static void ui_apply_but_funcs_after (bContext *C)
 
static void ui_apply_but_BUT (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_BUTM (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_BLOCK (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_TOG (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_ROW (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_VIEW_ITEM (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
 
static bool ui_list_invoke_item_operator (bContext *C, const uiBut *context_but, wmOperatorType *ot, PointerRNA **properties)
 
static void ui_apply_but_LISTROW (bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_TEX (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_TAB (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_NUM (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_VEC (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_COLORBAND (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_CURVE (bContext *C, uiBut *but, uiHandleButtonData *data)
 
static void ui_apply_but_CURVEPROFILE (bContext *C, uiBut *but, uiHandleButtonData *data)
 

Macro Definition Documentation

◆ BUTTON_AUTO_OPEN_THRESH

#define BUTTON_AUTO_OPEN_THRESH   0.2

Definition at line 198 of file interface_handlers.cc.

Referenced by button_activate_init(), and button_activate_state().

◆ BUTTON_DRAGLOCK_THRESH

#define BUTTON_DRAGLOCK_THRESH   3

Drag-lock distance threshold (in pixels).

Definition at line 208 of file interface_handlers.cc.

Referenced by ui_but_dragedit_update_mval().

◆ BUTTON_FLASH_DELAY

#define BUTTON_FLASH_DELAY   0.020

Definition at line 195 of file interface_handlers.cc.

Referenced by button_activate_state().

◆ BUTTON_KEYNAV_PX_LIMIT

#define BUTTON_KEYNAV_PX_LIMIT   8

Pixels to move the cursor to get out of keyboard navigation.

Definition at line 201 of file interface_handlers.cc.

Referenced by ui_mouse_motion_keynav_test().

◆ BUTTON_MOUSE_TOWARDS_THRESH

#define BUTTON_MOUSE_TOWARDS_THRESH   1.0

Definition at line 199 of file interface_handlers.cc.

Referenced by ui_mouse_motion_towards_check().

◆ CASE_NUM_TO_DIR

#define CASE_NUM_TO_DIR ( n,
d )
Value:
case (EVT_ZEROKEY + n): \
case (EVT_PAD0 + n): { \
if (num_dir == UI_RADIAL_NONE) { \
num_dir = d; \
} \
} \
(void)0
@ UI_RADIAL_NONE
@ EVT_PAD0
@ EVT_ZEROKEY

Referenced by ui_pie_handler().

◆ DRAG_MULTINUM_THRESHOLD_DRAG_X

#define DRAG_MULTINUM_THRESHOLD_DRAG_X   (UI_UNIT_Y / 4)

how far to drag before we check for gesture direction (in pixels), NOTE: half the height of a button is about right...

Definition at line 305 of file interface_handlers.cc.

Referenced by ui_do_button().

◆ DRAG_MULTINUM_THRESHOLD_DRAG_Y

#define DRAG_MULTINUM_THRESHOLD_DRAG_Y   (UI_UNIT_Y / 4)

How far to drag horizontally before we stop checking which buttons the gesture spans (in pixels), locking down the buttons so we can drag freely without worrying about vertical movement.

Definition at line 312 of file interface_handlers.cc.

Referenced by ui_do_button().

◆ DRAG_MULTINUM_THRESHOLD_VERTICAL

#define DRAG_MULTINUM_THRESHOLD_VERTICAL   (0.75f)

How strict to be when detecting a vertical gesture: [0.5 == sloppy], [0.9 == strict], (unsigned dot-product).

Note
We should be quite strict here, since doing a vertical gesture by accident should be avoided, however with some care a user should be able to do a vertical movement without missing.

Definition at line 322 of file interface_handlers.cc.

Referenced by ui_do_button().

◆ IS_ALLSELECT_EVENT

#define IS_ALLSELECT_EVENT ( event)    (((event)->modifier & KM_ALT) != 0)

Ideally we would only respond to events which are expected to be used for multi button editing (additionally checking if this is a mouse[wheel] or return-key event to avoid the ALT conflict with button array pasting, see #108096, but unfortunately wheel events are not part of win->eventstate with modifiers held down. Instead, the conflict is avoided by specifically filtering out CTRL ALT V in ui_apply_but().

Definition at line 293 of file interface_handlers.cc.

Referenced by ui_apply_but(), ui_block_open_begin(), and ui_textedit_begin().

◆ MENU_SCROLL_INTERVAL

#define MENU_SCROLL_INTERVAL   0.1

Definition at line 196 of file interface_handlers.cc.

Referenced by ui_handle_menu_event().

◆ MENU_TOWARDS_MARGIN

#define MENU_TOWARDS_MARGIN   20

Margin around the menu, use to check if we're moving towards this rectangle (in pixels).

Definition at line 204 of file interface_handlers.cc.

Referenced by ui_mouse_motion_towards_check().

◆ MENU_TOWARDS_WIGGLE_ROOM

#define MENU_TOWARDS_WIGGLE_ROOM   64

Tolerance for closing menus (in pixels).

Definition at line 206 of file interface_handlers.cc.

Referenced by ui_mouse_motion_towards_check().

◆ PIE_MENU_INTERVAL

#define PIE_MENU_INTERVAL   0.01

Definition at line 197 of file interface_handlers.cc.

Referenced by ui_pie_handler().

◆ UI_BUT_IS_SELECT_CONTEXT

#define UI_BUT_IS_SELECT_CONTEXT   UI_BUT_NODE_ACTIVE

just show a tinted color so users know its activated

Definition at line 296 of file interface_handlers.cc.

Referenced by ui_selectcontext_begin().

◆ UI_DRAG_MAP_SOFT_RANGE_PIXEL_MAX

#define UI_DRAG_MAP_SOFT_RANGE_PIXEL_MAX   1000

When USER_CONTINUOUS_MOUSE is disabled or tablet input is used, Use this as a maximum soft range for mapping cursor motion to the value. Otherwise min/max of FLT_MAX, #INT_MAX cause small adjustments to jump to large numbers.

This is needed for values such as location & dimensions which don't have a meaningful min/max, Instead of mapping cursor motion to the min/max, map the motion to the click-step.

This value is multiplied by the click step to calculate a range to clamp the soft-range by. See: #68130

Definition at line 148 of file interface_handlers.cc.

Referenced by ui_numedit_begin().

◆ UI_MAX_PASSWORD_STR

#define UI_MAX_PASSWORD_STR   128

The buffer side used for password strings, where the password is stored internally, but not displayed.

Definition at line 117 of file interface_handlers.cc.

Referenced by ui_but_text_password_hide(), and ui_textedit_set_cursor_pos().

◆ UI_PROP_SCALE_LOG_MIN

#define UI_PROP_SCALE_LOG_MIN   0.5e-8f

This is a lower limit on the soft minimum of the range. Usually the derived lower limit from the visible precision is higher, so this number is the backup minimum.

Logarithmic scale does not work with a minimum value of zero, but we want to support it anyway. It is set to 0.5e... for correct rounding since when the tweaked value is lower than the log minimum (lower limit), it will snap to 0.

Definition at line 129 of file interface_handlers.cc.

Referenced by ui_numedit_begin(), and ui_numedit_but_NUM().

◆ UI_PROP_SCALE_LOG_SNAP_OFFSET

#define UI_PROP_SCALE_LOG_SNAP_OFFSET   0.03f

This constant defines an offset for the precision change in snap rounding, when going to higher values. It is set to 0.5 - log10(3) = 0.03 to make the switch at 0.3 values.

Definition at line 135 of file interface_handlers.cc.

Referenced by ui_do_but_NUM(), ui_do_but_SLI(), and ui_numedit_apply_snapf().

◆ USE_ALLSELECT

#define USE_ALLSELECT

Allow dragging/editing all other selected items at once.

Definition at line 96 of file interface_handlers.cc.

◆ USE_ALLSELECT_LAYER_HACK

#define USE_ALLSELECT_LAYER_HACK

Definition at line 256 of file interface_handlers.cc.

◆ USE_CONT_MOUSE_CORRECT

#define USE_CONT_MOUSE_CORRECT

Place the mouse at the scaled down location when un-grabbing.

Definition at line 88 of file interface_handlers.cc.

◆ USE_DRAG_MULTINUM

#define USE_DRAG_MULTINUM

Support dragging multiple number buttons at once.

Definition at line 93 of file interface_handlers.cc.

◆ USE_DRAG_POPUP

#define USE_DRAG_POPUP

Support dragging popups by their header.

Definition at line 105 of file interface_handlers.cc.

◆ USE_DRAG_TOGGLE

#define USE_DRAG_TOGGLE

Support dragging toggle buttons.

Definition at line 90 of file interface_handlers.cc.

◆ USE_KEYNAV_LIMIT

#define USE_KEYNAV_LIMIT

Check to avoid very small mouse-moves from jumping away from keyboard navigation, while larger mouse motion will override keyboard input, see: #34936.

Definition at line 102 of file interface_handlers.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UI_TEXTEDIT_PASTE 
UI_TEXTEDIT_COPY 
UI_TEXTEDIT_CUT 

Definition at line 3361 of file interface_handlers.cc.

◆ eSnapType

enum eSnapType
Enumerator
SNAP_OFF 
SNAP_ON 
SNAP_ON_SMALL 

Definition at line 742 of file interface_handlers.cc.

◆ uiButtonActivateType

Enumerator
BUTTON_ACTIVATE_OVER 
BUTTON_ACTIVATE 
BUTTON_ACTIVATE_APPLY 
BUTTON_ACTIVATE_TEXT_EDITING 
BUTTON_ACTIVATE_OPEN 

Definition at line 210 of file interface_handlers.cc.

◆ uiHandleButtonState

Enumerator
BUTTON_STATE_INIT 
BUTTON_STATE_HIGHLIGHT 
BUTTON_STATE_WAIT_FLASH 
BUTTON_STATE_WAIT_RELEASE 
BUTTON_STATE_WAIT_KEY_EVENT 
BUTTON_STATE_NUM_EDITING 
BUTTON_STATE_TEXT_EDITING 
BUTTON_STATE_TEXT_SELECTING 
BUTTON_STATE_MENU_OPEN 
BUTTON_STATE_WAIT_DRAG 
BUTTON_STATE_EXIT 

Definition at line 218 of file interface_handlers.cc.

◆ uiMenuScrollType

Enumerator
MENU_SCROLL_UP 
MENU_SCROLL_DOWN 
MENU_SCROLL_TOP 
MENU_SCROLL_BOTTOM 

Definition at line 232 of file interface_handlers.cc.

Function Documentation

◆ button_activate_exit()

◆ button_activate_init()

◆ button_activate_state()

static void button_activate_state ( bContext * C,
uiBut * but,
uiHandleButtonState state )
static

Definition at line 8526 of file interface_handlers.cc.

References uiBut::active, uiBlock::auto_open, BLI_rcti_rctf_copy(), uiBut::block, bounds(), BUTTON_AUTO_OPEN_THRESH, BUTTON_FLASH_DELAY, button_modal_state(), BUTTON_STATE_EXIT, BUTTON_STATE_HIGHLIGHT, BUTTON_STATE_MENU_OPEN, BUTTON_STATE_NUM_EDITING, BUTTON_STATE_TEXT_EDITING, BUTTON_STATE_TEXT_SELECTING, BUTTON_STATE_WAIT_DRAG, BUTTON_STATE_WAIT_FLASH, BUTTON_STATE_WAIT_RELEASE, button_tooltip_timer_reset(), CTX_wm_window(), ED_region_tag_redraw_no_rebuild(), ED_workspace_status_text(), ELEM, uiBlock::flag, uiBut::flag, FLT_MAX, uiBlock::handle, uiBut::hold_func, WorkspaceStatus::item(), uiPopupBlockHandle::popup, uiBut::rect, RPT_INFO, state, time, TIMER, uiBut::type, ui_block_interaction_begin_ensure(), UI_BLOCK_LOOP, ui_block_open_begin(), ui_block_open_end(), ui_block_to_window_fl(), ui_block_to_window_rctf(), UI_BTYPE_BLOCK, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE, UI_BTYPE_MENU, UI_BTYPE_POPOVER, UI_BTYPE_PULLDOWN, UI_BUT_DRIVEN, ui_but_is_cursor_warp(), ui_but_menu_draw_as_popover(), UI_but_paneltype_get(), UI_but_tooltip_timer_remove(), ui_but_update(), ui_handler_region_menu(), ui_numedit_begin(), ui_numedit_end(), UI_SELECT, ui_textedit_begin(), ui_textedit_end(), USER_MENUOPENAUTO, WM_cursor_grab_disable(), WM_cursor_grab_enable(), WM_CURSOR_WRAP_XY, WM_event_add_ui_handler(), WM_event_remove_ui_handler(), WM_event_timer_add(), WM_event_timer_remove(), WM_report(), and WM_stereo3d_enabled().

Referenced by button_activate_exit(), button_activate_init(), ui_but_active_string_clear_and_exit(), ui_but_drag_init(), ui_but_extra_operator_icon_apply(), ui_but_paste_colorband(), ui_but_paste_curvemapping(), ui_but_paste_CurveProfile(), ui_but_paste_numeric_value(), ui_but_set_float_array(), ui_but_set_string_interactive(), ui_do_but_ANY_drag_toggle(), ui_do_but_BLOCK(), ui_do_but_BUT(), ui_do_but_COLOR(), ui_do_but_COLORBAND(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), ui_do_but_EXIT(), ui_do_but_GRIP(), ui_do_but_HISTOGRAM(), ui_do_but_HOTKEYEVT(), ui_do_but_HSVCIRCLE(), ui_do_but_HSVCUBE(), ui_do_but_KEYEVT(), ui_do_but_NUM(), ui_do_but_SCROLL(), ui_do_but_SLI(), ui_do_but_TAB(), ui_do_but_TEX(), ui_do_but_textedit(), ui_do_but_textedit_select(), ui_do_but_TOG(), ui_do_but_TRACKPREVIEW(), ui_do_but_UNITVEC(), ui_do_but_VIEW_ITEM(), ui_do_but_WAVEFORM(), ui_handle_button_event(), ui_handle_button_return_submenu(), and ui_handler_region_menu().

◆ button_modal_state()

◆ button_tooltip_timer_reset()

◆ clamp_axis_max_v3()

static void clamp_axis_max_v3 ( float v[3],
const float max )
static

Definition at line 6612 of file interface_handlers.cc.

References max, max_fff(), mul_v3_fl(), and v.

Referenced by ui_numedit_but_HSVCUBE().

◆ float_array_to_string()

static void float_array_to_string ( const float * values,
const int values_len,
char * output,
int output_maxncpy )
static

Definition at line 2533 of file interface_handlers.cc.

References BLI_snprintf_rlen().

Referenced by ui_but_copy_color(), and ui_but_copy_numeric_array().

◆ force_activate_view_item_but()

static void force_activate_view_item_but ( bContext * C,
ARegion * region,
uiButViewItem * but,
const bool close_popup = true )
static
Parameters
close_popupIn most cases activating the view item should close the popup it is in (unless #AbstractView::keep_open() was called when building the view), if any. But this should only be done when activating the view item directly, things like clicking nested buttons or calling the context menu should keep the popup open for further interaction.

Definition at line 4957 of file interface_handlers.cc.

References uiBut::active, uiBut::block, ED_region_tag_redraw_no_rebuild(), ED_region_tag_refresh_ui(), ui_apply_but(), UI_but_execute(), UI_popup_menu_close_from_but(), UI_view_item_popup_keep_open(), and uiButViewItem::view_item.

Referenced by ui_do_but_VIEW_ITEM(), and ui_handle_view_item_event().

◆ foreach_semi_modal_but_as_active()

static void foreach_semi_modal_but_as_active ( bContext * C,
ARegion * region,
blender::FunctionRef< void(uiBut *semi_modal_but)> fn )
static

Calls fn for all buttons that are either already semi-modal active or should be made to be because the UI_BUT2_FORCE_SEMI_MODAL_ACTIVE flag is set. During the fn call, the button will appear to be the active button, i.e. ui_region_find_active_but() will return this button.

Definition at line 9424 of file interface_handlers.cc.

References uiBut::flag2, LISTBASE_FOREACH, uiBut::semi_modal_state, UI_BUT2_FORCE_SEMI_MODAL_ACTIVE, and with_but_active_as_semi_modal().

Referenced by ui_handle_region_semi_modal_buttons().

◆ get_but_property_array_length()

static int get_but_property_array_length ( uiBut * but)
static

◆ parse_float_array()

static bool parse_float_array ( char * text,
float * values,
int values_len_expected )
static

◆ point_draw_handles()

static bool point_draw_handles ( CurveProfilePoint * point)
static

Helper for ui_do_but_CURVEPROFILE. Used to tell whether to select a control point's handles.

Definition at line 7728 of file interface_handlers.cc.

References ELEM, HD_ALIGN, HD_FREE, PROF_H1_SELECT, PROF_H2_SELECT, and PROF_SELECT.

Referenced by ui_do_but_CURVEPROFILE().

◆ popup_check()

static void popup_check ( bContext * C,
wmOperator * op )
static

Definition at line 825 of file interface_handlers.cc.

References wmOperatorType::check, and wmOperator::type.

Referenced by ui_apply_but_funcs_after().

◆ ui_afterfunc_check()

static bool ui_afterfunc_check ( const uiBlock * block,
const uiBut * but )
static

◆ ui_afterfunc_new()

◆ ui_afterfunc_update_preferences_dirty()

static void ui_afterfunc_update_preferences_dirty ( uiAfterFunc * after)
static

◆ ui_apply_but()

static void ui_apply_but ( bContext * C,
uiBlock * block,
uiBut * but,
uiHandleButtonData * data,
const bool interactive )
static

Definition at line 2251 of file interface_handlers.cc.

References copy_v3_v3(), CTX_wm_window(), uiBlock::custom_interaction_callbacks, uiButColorBand::edit_coba, uiButCurveMapping::edit_cumap, uiButCurveProfile::edit_profile, uiBut::editstr, uiBut::editval, uiBut::editvec, wmWindow::eventstate, EVT_VKEY, uiBut::flag, uiHandleButtonMulti::INIT_ENABLE, IS_ALLSELECT_EVENT, KM_CTRL, KM_OSKEY, KM_PRESS, KM_SHIFT, MEM_freeN(), uiBut::type, ui_apply_but_BLOCK(), ui_apply_but_BUT(), ui_apply_but_BUTM(), ui_apply_but_COLORBAND(), ui_apply_but_CURVE(), ui_apply_but_CURVEPROFILE(), ui_apply_but_HISTOGRAM(), ui_apply_but_IMAGE(), ui_apply_but_LISTROW(), ui_apply_but_NUM(), ui_apply_but_ROW(), ui_apply_but_TAB(), ui_apply_but_TEX(), ui_apply_but_TOG(), ui_apply_but_TRACKPREVIEW(), ui_apply_but_VEC(), ui_apply_but_VIEW_ITEM(), ui_apply_but_WAVEFORM(), ui_block_interaction_update(), UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU, UI_BTYPE_BUT_TOGGLE, UI_BTYPE_CHECKBOX, UI_BTYPE_CHECKBOX_N, UI_BTYPE_COLOR, UI_BTYPE_COLORBAND, UI_BTYPE_CURVE, UI_BTYPE_CURVEPROFILE, UI_BTYPE_DECORATOR, UI_BTYPE_GRIP, UI_BTYPE_HISTOGRAM, UI_BTYPE_HOTKEY_EVENT, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_IMAGE, UI_BTYPE_KEY_EVENT, UI_BTYPE_LISTROW, UI_BTYPE_MENU, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_PREVIEW_TILE, UI_BTYPE_PULLDOWN, UI_BTYPE_ROW, UI_BTYPE_SCROLL, UI_BTYPE_SEARCH_MENU, UI_BTYPE_TAB, UI_BTYPE_TEXT, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_BTYPE_TRACK_PREVIEW, UI_BTYPE_UNITVEC, UI_BTYPE_VIEW_ITEM, UI_BTYPE_WAVEFORM, UI_BUT_DRAG_MULTI, ui_multibut_restore(), ui_multibut_states_apply(), ui_selectcontext_apply(), ui_selectcontext_begin(), and zero_v3().

Referenced by button_activate_exit(), force_activate_view_item_but(), ui_but_execute_end(), ui_but_extra_operator_icon_apply(), ui_do_but_ANY_drag_toggle(), ui_do_but_BLOCK(), ui_do_but_COLOR(), ui_do_but_HSVCIRCLE(), ui_do_but_HSVCUBE(), ui_do_but_textedit(), ui_do_but_TOG(), ui_handle_button_return_submenu(), ui_numedit_apply(), and ui_textedit_begin().

◆ ui_apply_but_autokey()

◆ ui_apply_but_BLOCK()

static void ui_apply_but_BLOCK ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_apply_but_BUT()

static void ui_apply_but_BUT ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1133 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_BUTM()

static void ui_apply_but_BUTM ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1141 of file interface_handlers.cc.

References uiBut::hardmin, uiBut::retval, ui_apply_but_func(), and ui_but_value_set().

Referenced by ui_apply_but().

◆ ui_apply_but_COLORBAND()

static void ui_apply_but_COLORBAND ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1356 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_CURVE()

static void ui_apply_but_CURVE ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1363 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_CURVEPROFILE()

static void ui_apply_but_CURVEPROFILE ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1370 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_func()

static void ui_apply_but_func ( bContext * C,
uiBut * but )
static

These functions are postponed and only executed after all other handling is done, i.e. menus are closed, in order to avoid conflicts with these functions removing the buttons we are working with.

Definition at line 847 of file interface_handlers.cc.

References uiBut::active, uiAfterFunc::apply_func, uiBut::apply_func, uiButSearch::arg, uiButSearch::arg_free_fn, uiBut::block, uiAfterFunc::context, uiBut::context, uiAfterFunc::custom_interaction_callbacks, uiBlock::custom_interaction_callbacks, uiAfterFunc::custom_interaction_handle, uiAfterFunc::drawstr, ELEM, uiAfterFunc::func, uiBut::func, uiAfterFunc::func_arg1, uiBut::func_arg1, uiAfterFunc::func_arg2, uiBut::func_arg2, uiAfterFunc::func_argN, uiBut::func_argN, uiBut::func_argN_copy_fn, uiAfterFunc::func_argN_free_fn, uiBut::func_argN_free_fn, uiAfterFunc::funcN, uiBut::funcN, uiBlock::handle, uiAfterFunc::handle_func, uiBlock::handle_func, uiAfterFunc::handle_func_arg, uiBlock::handle_func_arg, uiAfterFunc::opcontext, uiBut::opcontext, uiBut::operator_never_call, uiAfterFunc::opptr, uiBut::opptr, uiAfterFunc::optype, uiBut::optype, uiAfterFunc::popup_op, uiPopupBlockHandle::popup_op, uiAfterFunc::prev, uiAfterFunc::rename_arg1, uiBut::rename_arg1, uiAfterFunc::rename_full_func, uiBut::rename_full_func, uiAfterFunc::rename_full_new, uiBut::rename_full_new, uiAfterFunc::rename_func, uiBut::rename_func, uiAfterFunc::rename_orig, uiBut::rename_orig, uiAfterFunc::retval, uiBut::retval, uiAfterFunc::rnapoin, uiBut::rnapoin, uiAfterFunc::rnaprop, uiBut::rnaprop, uiAfterFunc::search_arg, uiAfterFunc::search_arg_free_fn, uiBut::type, ui_afterfunc_check(), ui_afterfunc_new(), UI_BTYPE_SEARCH_MENU, ui_but_drawstr_without_sep_char(), and uiBlockInteraction_Handle::user_count.

Referenced by ui_apply_but_BLOCK(), ui_apply_but_BUT(), ui_apply_but_BUTM(), ui_apply_but_COLORBAND(), ui_apply_but_CURVE(), ui_apply_but_CURVEPROFILE(), ui_apply_but_HISTOGRAM(), ui_apply_but_IMAGE(), ui_apply_but_NUM(), ui_apply_but_ROW(), ui_apply_but_TAB(), ui_apply_but_TEX(), ui_apply_but_TOG(), ui_apply_but_TRACKPREVIEW(), ui_apply_but_VEC(), and ui_apply_but_WAVEFORM().

◆ ui_apply_but_funcs_after()

◆ ui_apply_but_HISTOGRAM()

static void ui_apply_but_HISTOGRAM ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 2230 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_IMAGE()

static void ui_apply_but_IMAGE ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 2223 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_LISTROW()

static void ui_apply_but_LISTROW ( bContext * C,
uiBlock * block,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_apply_but_NUM()

◆ ui_apply_but_ROW()

◆ ui_apply_but_TAB()

static void ui_apply_but_TAB ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_apply_but_TEX()

◆ ui_apply_but_TOG()

◆ ui_apply_but_TRACKPREVIEW()

static void ui_apply_but_TRACKPREVIEW ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 2244 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_apply_but_undo()

◆ ui_apply_but_VEC()

static void ui_apply_but_VEC ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_apply_but_VIEW_ITEM()

static void ui_apply_but_VIEW_ITEM ( bContext * C,
uiBlock * block,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 1201 of file interface_handlers.cc.

References ui_apply_but_ROW().

Referenced by ui_apply_but().

◆ ui_apply_but_WAVEFORM()

static void ui_apply_but_WAVEFORM ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

Definition at line 2237 of file interface_handlers.cc.

References uiBut::retval, and ui_apply_but_func().

Referenced by ui_apply_but().

◆ ui_block_calc_pie_segment()

◆ ui_block_interaction_begin()

◆ ui_block_interaction_begin_ensure()

static void ui_block_interaction_begin_ensure ( bContext * C,
uiBlock * block,
uiHandleButtonData * data,
const bool is_click )
static
Note
ui_block_interaction_begin cannot be called when setting the button state (e.g. BUTTON_STATE_NUM_EDITING) for the following reasons.

Instead, it must be called immediately before the drag action begins.

Definition at line 12414 of file interface_handlers.cc.

References uiBlockInteraction_CallbackData::begin_fn, uiBlock::custom_interaction_callbacks, ui_block_interaction_begin(), and uiBlockInteraction_Handle::user_count.

Referenced by button_activate_state(), ui_numedit_but_NUM(), and ui_numedit_but_SLI().

◆ ui_block_interaction_end()

◆ UI_block_interaction_set()

void UI_block_interaction_set ( uiBlock * block,
uiBlockInteraction_CallbackData * callbacks )

Definition at line 12340 of file interface_handlers.cc.

References uiBlock::custom_interaction_callbacks.

Referenced by v3d_editvertex_buts().

◆ ui_block_interaction_update()

◆ ui_block_open_begin()

◆ ui_block_open_end()

◆ ui_block_pie_dir_activate()

static uiBut * ui_block_pie_dir_activate ( uiBlock * block,
const wmEvent * event,
RadialDirection dir )
static

◆ ui_blocks_set_tooltips()

static void ui_blocks_set_tooltips ( ARegion * region,
const bool enable )
static

◆ ui_but_activate_event()

void ui_but_activate_event ( bContext * C,
ARegion * region,
uiBut * but )

Exported to interface.cc: UI_but_active_only()

Note
The region is only for the button. The context needs to be set by the caller.

Definition at line 9289 of file interface_handlers.cc.

References uiBut::block, button_activate_init(), BUTTON_ACTIVATE_OVER, CTX_wm_window(), EVT_BUT_OPEN, KM_PRESS, ui_do_button(), and wm_event_init_from_window().

Referenced by UI_but_active_only_ex(), and with_but_active_as_semi_modal().

◆ ui_but_activate_over()

void ui_but_activate_over ( bContext * C,
ARegion * region,
uiBut * but )

Simulate moving the mouse over a button (or navigating to it with arrow keys).

exported so menus can start with a highlighted button, even if the mouse isn't over it

Definition at line 9306 of file interface_handlers.cc.

References button_activate_init(), and BUTTON_ACTIVATE_OVER.

Referenced by ui_block_func_POPUP().

◆ UI_but_active_drop_color()

bool UI_but_active_drop_color ( bContext * C)

◆ UI_but_active_drop_name()

bool UI_but_active_drop_name ( const bContext * C)

Returns true if highlighted button allows drop of names. called in region context.

Definition at line 12314 of file interface_handlers.cc.

References UI_but_active_drop_name_button().

Referenced by blender::ed::space_node::node_collection_drop_poll(), blender::ed::space_node::node_material_drop_poll(), blender::ed::space_node::node_object_drop_poll(), and ui_drop_name_poll().

◆ UI_but_active_drop_name_button()

uiBut * UI_but_active_drop_name_button ( const bContext * C)

◆ ui_but_active_free()

◆ ui_but_active_string_clear_and_exit()

void ui_but_active_string_clear_and_exit ( bContext * C,
uiBut * but )

◆ ui_but_clipboard_free()

void ui_but_clipboard_free ( )

◆ ui_but_copy()

◆ ui_but_copy_color()

static void ui_but_copy_color ( uiBut * but,
char * output,
int output_maxncpy )
static

◆ ui_but_copy_colorband()

static void ui_but_copy_colorband ( uiBut * but)
static

Definition at line 2689 of file interface_handlers.cc.

References but_copypaste_coba, and uiBut::poin.

Referenced by ui_but_copy().

◆ ui_but_copy_curvemapping()

static void ui_but_copy_curvemapping ( uiBut * but)
static

◆ ui_but_copy_CurveProfile()

static void ui_but_copy_CurveProfile ( uiBut * but)
static

◆ ui_but_copy_menu()

static bool ui_but_copy_menu ( uiBut * but,
char * output,
int output_maxncpy )
static

Definition at line 2763 of file interface_handlers.cc.

References BLI_snprintf(), MenuType::idname, and UI_but_menutype_get().

Referenced by ui_but_copy().

◆ ui_but_copy_numeric_array()

static void ui_but_copy_numeric_array ( uiBut * but,
char * output,
int output_maxncpy )
static

◆ ui_but_copy_numeric_value()

static void ui_but_copy_numeric_value ( uiBut * but,
char * output,
int output_maxncpy )
static

◆ ui_but_copy_operator()

static void ui_but_copy_operator ( bContext * C,
uiBut * but,
char * output,
int output_maxncpy )
static

◆ ui_but_copy_popover()

static bool ui_but_copy_popover ( uiBut * but,
char * output,
int output_maxncpy )
static

Definition at line 2773 of file interface_handlers.cc.

References BLI_snprintf(), PanelType::idname, and UI_but_paneltype_get().

Referenced by ui_but_copy().

◆ ui_but_copy_text()

static void ui_but_copy_text ( uiBut * but,
char * output,
int output_maxncpy )
static

Definition at line 2677 of file interface_handlers.cc.

References ui_but_string_get().

Referenced by ui_but_copy().

◆ ui_but_drag_init()

static bool ui_but_drag_init ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
const wmEvent * event )
static

◆ ui_but_dragedit_update_mval()

static bool ui_but_dragedit_update_mval ( uiHandleButtonData * data,
int mx )
static

Ignore mouse movements within some horizontal pixel threshold before starting to drag

Definition at line 665 of file interface_handlers.cc.

References abs(), BUTTON_DRAGLOCK_THRESH, ELEM, uiHandleButtonMulti::INIT_SETUP, and uiHandleButtonMulti::INIT_UNSET.

Referenced by ui_numedit_but_NUM(), and ui_numedit_but_SLI().

◆ ui_but_execute_begin()

void ui_but_execute_begin ( bContext * C,
ARegion * region,
uiBut * but,
void ** active_back )

◆ ui_but_execute_end()

void ui_but_execute_end ( bContext * C,
ARegion * region,
uiBut * but,
void * active_back )

◆ ui_but_extra_operator_icon_apply()

◆ ui_but_extra_operator_icon_mouse_over_get()

◆ ui_but_find_open_event()

static uiBut * ui_but_find_open_event ( ARegion * region,
const wmEvent * event )
static

Definition at line 9242 of file interface_handlers.cc.

References wmEvent::customdata, and LISTBASE_FOREACH.

Referenced by ui_handle_button_over().

◆ ui_but_find_select_in_enum()

uiBut * ui_but_find_select_in_enum ( uiBut * but,
int direction )

Finds the pressed button in an aligned row (typically an expanded enum).

Parameters
directionUse when there may be multiple buttons pressed.

Definition at line 614 of file interface_handlers.cc.

References BLI_assert, ELEM, uiBut::flag, uiBut::next, uiBut::prev, ui_but_find_select_in_enum__cmp(), and UI_SELECT.

Referenced by ui_do_but_TOG().

◆ ui_but_find_select_in_enum__cmp()

static bool ui_but_find_select_in_enum__cmp ( const uiBut * but_a,
const uiBut * but_b )
static

◆ ui_but_get_pasted_text_from_clipboard()

static void ui_but_get_pasted_text_from_clipboard ( const bool ensure_utf8,
char ** r_buf_paste,
int * r_buf_len )
static

Definition at line 2489 of file interface_handlers.cc.

References length(), MEM_callocN, and WM_clipboard_text_get_firstline().

Referenced by ui_but_paste().

◆ ui_but_is_drag_toggle()

static bool ui_but_is_drag_toggle ( const uiBut * but)
static

◆ ui_but_is_editing()

bool ui_but_is_editing ( const uiBut * but)

◆ UI_but_is_userdef()

bool UI_but_is_userdef ( const uiBut * but)

◆ ui_but_list_row_text_activate()

static uiBut * ui_but_list_row_text_activate ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
const wmEvent * event,
uiButtonActivateType activate_type )
static

Hack for uiList UI_BTYPE_LISTROW buttons to "give" events to overlaying UI_BTYPE_TEXT buttons (Ctrl-Click rename feature & co).

Definition at line 4493 of file interface_handlers.cc.

References button_activate_exit(), button_activate_init(), uiBut::flag, uiBut::type, UI_BTYPE_TEXT, UI_BUT_DISABLED, ui_but_find_mouse_over_ex(), and wmEvent::xy.

Referenced by ui_do_but_LISTROW(), and ui_do_button().

◆ ui_but_menu_direction()

int ui_but_menu_direction ( uiBut * but)

◆ ui_but_paste()

◆ ui_but_paste_color()

static void ui_but_paste_color ( bContext * C,
uiBut * but,
char * buf_paste )
static

◆ ui_but_paste_colorband()

static void ui_but_paste_colorband ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_but_paste_curvemapping()

◆ ui_but_paste_CurveProfile()

◆ ui_but_paste_normalized_vector()

static void ui_but_paste_normalized_vector ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
char * buf_paste )
static

◆ ui_but_paste_numeric_array()

static void ui_but_paste_numeric_array ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
char * buf_paste )
static

◆ ui_but_paste_numeric_value()

static void ui_but_paste_numeric_value ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
char * buf_paste )
static

◆ ui_but_paste_text()

static void ui_but_paste_text ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
char * buf_paste )
static

◆ ui_but_pie_button_activate()

◆ ui_but_pie_menu_apply()

◆ ui_but_pie_menu_supported_apply()

static bool ui_but_pie_menu_supported_apply ( uiBut * but)
static

Definition at line 11359 of file interface_handlers.cc.

References ELEM, uiBut::type, UI_BTYPE_NUM, and UI_BTYPE_NUM_SLIDER.

Referenced by ui_but_pie_menu_apply().

◆ ui_but_semi_modal_state_free()

void ui_but_semi_modal_state_free ( const bContext * C,
uiBut * but )

◆ ui_but_set_float_array()

◆ ui_but_set_string_interactive()

void ui_but_set_string_interactive ( bContext * C,
uiBut * but,
const char * value )

Use handling code to set a string for the button. Handles the case where the string is set for a search button while the search menu is open, so the results are updated accordingly. This is basically the same as pasting the string into the button.

Definition at line 3030 of file interface_handlers.cc.

References uiBut::active, BLI_assert, button_activate_state(), BUTTON_STATE_EXIT, BUTTON_STATE_TEXT_EDITING, uiBut::changed, uiBut::flag, uiHandleButtonData::searchbox, uiHandleButtonData::text_edit, uiBut::type, UI_BTYPE_SEARCH_MENU, UI_BUT_DISABLED, ui_searchbox_update(), and ui_textedit_string_set().

Referenced by drop_name_invoke(), and ui_but_paste_text().

◆ ui_but_text_password_hide()

◆ ui_but_tooltip_init()

◆ UI_but_tooltip_refresh()

void UI_but_tooltip_refresh ( bContext * C,
uiBut * but )

Recreate tool-tip (use to update dynamic tips)

Definition at line 8436 of file interface_handlers.cc.

References uiBut::active, WM_tooltip_refresh(), and WM_window_get_active_screen().

Referenced by UI_block_update_from_old().

◆ UI_but_tooltip_timer_remove()

void UI_but_tooltip_timer_remove ( bContext * C,
uiBut * but )

Removes tool-tip timer from active but (meaning tool-tip is disabled until it's re-enabled again).

Definition at line 8447 of file interface_handlers.cc.

References uiBut::active, WM_event_timer_remove(), and WM_tooltip_clear().

Referenced by button_activate_state(), blender::ed::outliner::outliner_operation_invoke(), ui_handle_button_event(), ui_handle_menu_event(), ui_popup_block_create(), and ui_region_handler().

◆ ui_but_update_preferences_dirty()

static void ui_but_update_preferences_dirty ( uiBut * but)
static

◆ ui_but_update_view_for_active()

void ui_but_update_view_for_active ( const bContext * C,
const uiBlock * block )

In some cases we may want to update the view (View2D) in-between layout definition and drawing. E.g. to make sure a button is visible while editing.

Definition at line 9220 of file interface_handlers.cc.

References uiBut::active, uiBut::block, uiBut::changed, uiHandleButtonData::region, ui_block_active_but_get(), and UI_but_ensure_in_view().

Referenced by UI_blocklist_update_view_for_buttons().

◆ ui_button_value_default()

◆ ui_color_picker_to_rgb_HSVCUBE_v()

static void ui_color_picker_to_rgb_HSVCUBE_v ( const uiButHSVCube * hsv_but,
const float hsv[3],
float rgb[3] )
static

◆ ui_color_snap_hue()

static void ui_color_snap_hue ( const enum eSnapType snap,
float * r_hue )
static

Definition at line 760 of file interface_handlers.cc.

References BLI_assert, snap(), SNAP_OFF, and SNAP_ON_SMALL.

Referenced by ui_numedit_but_HSVCIRCLE(), and ui_numedit_but_HSVCUBE().

◆ UI_context_active_but_clear()

◆ UI_context_active_but_get()

◆ UI_context_active_but_get_respect_popup()

uiBut * UI_context_active_but_get_respect_popup ( const bContext * C)

Version of #UI_context_active_get() that uses the result of CTX_wm_region_popup() if set. Does not traverse into parent menus, which may be wanted in some cases.

Definition at line 9055 of file interface_handlers.cc.

References CTX_wm_region(), CTX_wm_region_popup(), and ui_context_button_active().

Referenced by button_string_clear_exec(), and UI_context_active_but_prop_handle().

◆ UI_context_active_but_prop_get()

uiBut * UI_context_active_but_prop_get ( const bContext * C,
PointerRNA * r_ptr,
PropertyRNA ** r_prop,
int * r_index )

Version of UI_context_active_but_get that also returns RNA property info. Helper function for insert keyframe, reset to default, etc operators.

Returns
active button, NULL if none found or if it doesn't contain valid RNA data.

Definition at line 9097 of file interface_handlers.cc.

References CTX_wm_region(), CTX_wm_region_popup(), and UI_region_active_but_prop_get().

Referenced by achannel_setting_slider_nla_curve_cb(), add_driver_button_invoke(), add_driver_button_none(), add_driver_button_poll(), add_keyingset_button_exec(), assign_default_button_exec(), assign_default_button_poll(), blender::ui::bonedropper_init(), blender::ui::bonedropper_poll(), clear_key_button_exec(), copy_as_driver_button_exec(), copy_as_driver_button_poll(), copy_data_path_button_exec(), copy_data_path_button_poll(), copy_driver_button_exec(), copy_driver_to_selected_button(), copy_to_selected_button(), datadropper_init(), datadropper_poll(), delete_key_button_exec(), depthdropper_init(), depthdropper_poll(), depthdropper_test(), driver_mapping_type_itemf(), driverdropper_init(), drivers_editor_show_exec(), edit_driver_button_exec(), eyedropper_init(), insert_key_button_exec(), jump_to_target_button(), override_remove_button_exec(), override_remove_button_poll(), override_type_set_button_exec(), override_type_set_button_poll(), paste_driver_button_exec(), remove_driver_button_exec(), remove_keyingset_button_exec(), reset_default_button_exec(), reset_default_button_poll(), screen_ctx_property(), unset_property_button_exec(), and view_curve_in_graph_editor_exec().

◆ UI_context_active_but_prop_handle()

◆ UI_context_active_operator_get()

wmOperator * UI_context_active_operator_get ( const bContext * C)

◆ ui_context_button_active()

static uiBut * ui_context_button_active ( const ARegion * region,
bool(* but_check_cb )(const uiBut *) )
static

◆ UI_context_update_anim_flag()

◆ ui_do_but_ANY_drag_toggle()

◆ ui_do_but_BLOCK()

◆ ui_do_but_BUT()

◆ ui_do_but_COLOR()

static int ui_do_but_COLOR ( bContext * C,
uiBut * but,
uiHandleButtonData * data,
const wmEvent * event )
static

◆ ui_do_but_COLORBAND()

◆ ui_do_but_CURVE()

◆ ui_do_but_CURVEPROFILE()

◆ ui_do_but_EXIT()

◆ ui_do_but_extra_operator_icon()

◆ ui_do_but_extra_operator_icons_mousemove()

static void ui_do_but_extra_operator_icons_mousemove ( uiBut * but,
uiHandleButtonData * data,
const wmEvent * event )
static

◆ ui_do_but_GRIP()

◆ ui_do_but_HISTOGRAM()

◆ ui_do_but_HOTKEYEVT()

◆ ui_do_but_HSVCIRCLE()

◆ ui_do_but_HSVCUBE()

◆ ui_do_but_KEYEVT()

◆ ui_do_but_LISTROW()

◆ ui_do_but_NUM()

◆ ui_do_but_SCROLL()

◆ ui_do_but_SEARCH_UNLINK()

static int ui_do_but_SEARCH_UNLINK ( bContext * C,
uiBlock * block,
uiBut * but,
uiHandleButtonData * data,
const wmEvent * event )
static

◆ ui_do_but_SLI()

◆ ui_do_but_TAB()

◆ ui_do_but_TEX()

◆ ui_do_but_textedit()

static int ui_do_but_textedit ( bContext * C,
uiBlock * block,
uiBut * but,
uiHandleButtonData * data,
const wmEvent * event )
static

Definition at line 3743 of file interface_handlers.cc.

References ATTR_FALLTHROUGH, AUTOCOMPLETE_FULL_MATCH, uiBut::autocomplete_func, AUTOCOMPLETE_NO_MATCH, BLI_assert, BLI_str_cursor_step_bounds_utf8(), BLI_str_utf8_size_or_error(), button_activate_state(), BUTTON_STATE_EXIT, BUTTON_STATE_TEXT_SELECTING, uiBut::changed, CLAMP, CTX_wm_window(), ED_region_tag_redraw(), ED_region_tag_refresh_ui(), uiTextEdit::edit_string, ELEM, EVT_AKEY, EVT_BACKSPACEKEY, EVT_CKEY, EVT_DELKEY, EVT_DOWNARROWKEY, EVT_ENDKEY, EVT_ESCKEY, EVT_HOMEKEY, EVT_LEFTARROWKEY, EVT_PADENTER, EVT_PADPERIOD, EVT_RETKEY, EVT_RIGHTARROWKEY, EVT_TABKEY, EVT_UPARROWKEY, EVT_VKEY, EVT_XKEY, EVT_ZKEY, uiBut::flag, wmWindow::ime_data, wmWindow::ime_data_is_composing, jump(), KM_ALT, KM_CTRL, KM_DBL_CLICK, KM_OSKEY, KM_PRESS, KM_RELEASE, KM_SHIFT, LEFTMOUSE, wmEvent::modifier, MOUSEMOVE, MOUSEPAN, uiBut::pos, RIGHTMOUSE, uiTextEdit::sel_pos_init, uiBut::selend, uiBut::selsta, STRCUR_DIR_NEXT, STRCUR_DIR_PREV, STRCUR_JUMP_ALL, STREQ, uiBut::type, wmEvent::type, ui_apply_but(), UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, ui_but_contains_pt(), UI_BUT_TEXTEDIT_UPDATE, ui_but_update_edited(), ui_do_but_extra_operator_icon(), ui_do_but_extra_operator_icons_mousemove(), ui_mouse_motion_keynav_init(), ui_mouse_motion_keynav_test(), ui_searchbox_event(), ui_searchbox_inside(), ui_searchbox_update(), ui_textedit_autocomplete(), UI_TEXTEDIT_COPY, ui_textedit_copypaste(), UI_TEXTEDIT_CUT, ui_textedit_delete(), ui_textedit_delete_selection(), ui_textedit_insert_buf(), ui_textedit_jump_type_from_event(), ui_textedit_move(), ui_textedit_next_but(), UI_TEXTEDIT_PASTE, ui_textedit_prev_but(), ui_textedit_set_cursor_pos(), ui_textedit_string_set(), ui_textedit_undo(), ui_textedit_undo_push(), ui_window_to_block_fl(), uiTextEdit::undo_stack_text, update(), wmEvent::utf8_buf, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, WM_IME_COMPOSITE_END, WM_IME_COMPOSITE_EVENT, WM_IME_COMPOSITE_START, WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_do_but_NUM(), ui_do_but_SLI(), ui_do_but_TAB(), and ui_do_but_TEX().

◆ ui_do_but_textedit_select()

◆ ui_do_but_TOG()

◆ ui_do_but_TRACKPREVIEW()

◆ ui_do_but_UNITVEC()

◆ ui_do_but_VIEW_ITEM()

◆ ui_do_but_WAVEFORM()

◆ ui_do_button()

static int ui_do_button ( bContext * C,
uiBlock * block,
uiBut * but,
const wmEvent * event )
static

Definition at line 8136 of file interface_handlers.cc.

References abs(), blender::ui::AbstractViewItem::activate(), uiBut::active, uiBlock::aspect, BLI_assert, BUTTON_ACTIVATE_OVER, BUTTON_STATE_HIGHLIGHT, BUTTON_STATE_NUM_EDITING, BUTTON_STATE_TEXT_EDITING, dot_v2v2(), DRAG_MULTINUM_THRESHOLD_DRAG_X, DRAG_MULTINUM_THRESHOLD_DRAG_Y, DRAG_MULTINUM_THRESHOLD_VERTICAL, ED_KEYMAP_VIEW2D, ED_region_tag_redraw(), ELEM, EVT_BUT_OPEN, EVT_CKEY, EVT_PADENTER, EVT_RETKEY, EVT_VKEY, fabsf, uiBut::flag, uiHandleButtonMulti::INIT_DISABLE, uiHandleButtonMulti::INIT_ENABLE, uiHandleButtonMulti::INIT_SETUP, uiHandleButtonMulti::INIT_UNSET, is_disabled, ISMOUSE_MOTION, KM_ALT, KM_CTRL, KM_OSKEY, KM_PRESS, KM_RELEASE, KM_SHIFT, LEFTMOUSE, len_squared_v2(), wmEvent::modifier, NDOF_MOTION, normalize_v2_v2(), uiBut::poin, uiBut::pointype, wmEvent::prev_xy, RIGHTMOUSE, sqrtf, uiBut::type, wmEvent::type, UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU, UI_BTYPE_BUT_TOGGLE, UI_BTYPE_CHECKBOX, UI_BTYPE_CHECKBOX_N, UI_BTYPE_COLOR, UI_BTYPE_COLORBAND, UI_BTYPE_CURVE, UI_BTYPE_CURVEPROFILE, UI_BTYPE_DECORATOR, UI_BTYPE_EXTRA, UI_BTYPE_GRIP, UI_BTYPE_HISTOGRAM, UI_BTYPE_HOTKEY_EVENT, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_IMAGE, UI_BTYPE_KEY_EVENT, UI_BTYPE_LABEL, UI_BTYPE_LISTBOX, UI_BTYPE_LISTROW, UI_BTYPE_MENU, UI_BTYPE_NODE_SOCKET, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_POPOVER, UI_BTYPE_PREVIEW_TILE, UI_BTYPE_PROGRESS, UI_BTYPE_PULLDOWN, UI_BTYPE_ROUNDBOX, UI_BTYPE_ROW, UI_BTYPE_SCROLL, UI_BTYPE_SEARCH_MENU, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER, UI_BTYPE_TAB, UI_BTYPE_TEXT, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_BTYPE_TRACK_PREVIEW, UI_BTYPE_UNITVEC, UI_BTYPE_VECTORSCOPE, UI_BTYPE_VIEW_ITEM, UI_BTYPE_WAVEFORM, ui_but_copy(), UI_BUT_DISABLED, ui_but_list_row_text_activate(), ui_but_paste(), UI_BUT_VALUE_CLEAR, ui_do_but_BLOCK(), ui_do_but_BUT(), ui_do_but_COLOR(), ui_do_but_COLORBAND(), ui_do_but_CURVE(), ui_do_but_CURVEPROFILE(), ui_do_but_EXIT(), ui_do_but_extra_operator_icon(), ui_do_but_GRIP(), ui_do_but_HISTOGRAM(), ui_do_but_HOTKEYEVT(), ui_do_but_HSVCIRCLE(), ui_do_but_HSVCUBE(), ui_do_but_KEYEVT(), ui_do_but_LISTROW(), ui_do_but_NUM(), ui_do_but_SCROLL(), ui_do_but_SEARCH_UNLINK(), ui_do_but_SLI(), ui_do_but_TAB(), ui_do_but_TEX(), ui_do_but_TOG(), ui_do_but_TRACKPREVIEW(), ui_do_but_UNITVEC(), ui_do_but_VIEW_ITEM(), ui_do_but_WAVEFORM(), ui_multibut_states_create(), ui_multibut_states_tag(), ui_popup_context_menu_for_button(), ui_view_item_find_mouse_over(), wmEvent::val, uiButViewItem::view_item, WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_but_activate_event(), ui_handle_button_event(), and ui_handle_button_over().

◆ ui_drag_toggle_but_is_supported()

static bool ui_drag_toggle_but_is_supported ( const uiBut * but)
static

◆ ui_drag_toggle_but_pushed_state()

static int ui_drag_toggle_but_pushed_state ( uiBut * but)
static

◆ ui_drag_toggle_set()

static void ui_drag_toggle_set ( bContext * C,
uiDragToggleHandle * drag_info,
const int xy_input[2] )
static

◆ ui_drag_toggle_set_xy_xy()

◆ ui_event_is_snap()

static bool ui_event_is_snap ( const wmEvent * event)
static

◆ ui_event_to_snap()

static enum eSnapType ui_event_to_snap ( const wmEvent * event)
static

◆ ui_handle_afterfunc_add_operator()

void ui_handle_afterfunc_add_operator ( wmOperatorType * ot,
wmOperatorCallContext opcontext )

Definition at line 820 of file interface_handlers.cc.

References ot, and ui_handle_afterfunc_add_operator_ex().

Referenced by panel_activate_state().

◆ ui_handle_afterfunc_add_operator_ex()

static void ui_handle_afterfunc_add_operator_ex ( wmOperatorType * ot,
PointerRNA ** properties,
wmOperatorCallContext opcontext,
const uiBut * context_but )
static

For executing operators after the button is pressed. (some non operator buttons need to trigger operators), see: #37795.

Parameters
context_butA button from which to get the context from (uiBut.context) for the operator execution.
Note
Ownership over properties is moved here. The uiAfterFunc owns it now.
Can only call while handling buttons.

Definition at line 797 of file interface_handlers.cc.

References uiAfterFunc::context, uiBut::context, uiAfterFunc::drawstr, uiAfterFunc::opcontext, uiAfterFunc::opptr, uiAfterFunc::optype, ot, ui_afterfunc_new(), and ui_but_drawstr_without_sep_char().

Referenced by ui_handle_afterfunc_add_operator(), and ui_list_invoke_item_operator().

◆ ui_handle_button_activate()

◆ ui_handle_button_activate_by_type()

static bool ui_handle_button_activate_by_type ( bContext * C,
ARegion * region,
uiBut * but )
static

Use for key accelerator or default key to activate the button even if its not active.

Definition at line 9355 of file interface_handlers.cc.

References BUTTON_ACTIVATE, BUTTON_ACTIVATE_APPLY, BUTTON_ACTIVATE_OPEN, ELEM, printf, uiBut::type, UI_BTYPE_BLOCK, UI_BTYPE_BUT_MENU, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN, UI_BTYPE_ROW, and ui_handle_button_activate().

Referenced by ui_handle_menu_event().

◆ ui_handle_button_event()

static int ui_handle_button_event ( bContext * C,
const wmEvent * event,
uiBut * but )
static

Definition at line 9479 of file interface_handlers.cc.

References uiBut::active, ATTR_FALLTHROUGH, uiBut::block, button_activate_exit(), button_activate_init(), BUTTON_ACTIVATE_OVER, button_activate_state(), BUTTON_ACTIVATE_TEXT_EDITING, BUTTON_STATE_EXIT, BUTTON_STATE_HIGHLIGHT, BUTTON_STATE_INIT, BUTTON_STATE_MENU_OPEN, BUTTON_STATE_WAIT_DRAG, BUTTON_STATE_WAIT_FLASH, BUTTON_STATE_WAIT_RELEASE, button_tooltip_timer_reset(), wmEvent::customdata, ED_region_tag_redraw_no_rebuild(), ELEM, EVT_BUT_CANCEL, uiBlock::flag, uiBut::flag, uiBlock::handle, uiBut::hold_func, KM_PRESS, KM_RELEASE, l, LEFTMOUSE, len_manhattan_v2v2_int(), MEM_SAFE_FREE, uiPopupBlockHandle::menuretval, MIDDLEMOUSE, MOUSEMOVE, MOUSEPAN, BMLoop::next, wmEvent::prev_xy, PROP_FLOAT, PROP_INT, RIGHTMOUSE, RNA_property_type(), uiBut::rnaprop, state, uiHandleButtonData::state, TIMER, uiBut::type, wmEvent::type, ui_block_is_menu(), ui_block_is_pie_menu(), UI_BLOCK_POPOVER_ONCE, ui_blocks_set_tooltips(), UI_BTYPE_COLOR, ui_but_contains_point_px(), UI_BUT_DISABLED, ui_but_find_mouse_over(), ui_but_is_editable(), ui_but_is_editable_as_text(), ui_but_is_popover_once_compat(), ui_but_range_set_hard(), ui_but_range_set_soft(), UI_but_tooltip_timer_remove(), ui_but_value_set(), ui_button_value_default(), ui_do_but_extra_operator_icons_mousemove(), ui_do_button(), ui_handle_button_activate(), UI_HOVER, ui_region_contains_point_px(), UI_RETURN_CANCEL, UI_SELECT, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, WINDEACTIVATE, WM_EVENT_CURSOR_MOTION_THRESHOLD, WM_event_timer_add(), WM_event_timer_remove(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_handle_menu_button(), ui_handle_region_semi_modal_buttons(), ui_handler_region_menu(), and ui_region_handler().

◆ ui_handle_button_over()

◆ ui_handle_button_return_submenu()

◆ ui_handle_list_event()

◆ ui_handle_menu_button()

◆ ui_handle_menu_event()

static int ui_handle_menu_event ( bContext * C,
const wmEvent * event,
uiPopupBlockHandle * menu,
int level,
const bool is_parent_inside,
const bool is_parent_menu,
const bool is_floating )
static

Definition at line 10616 of file interface_handlers.cc.

References activate(), uiBut::active, add_v2_v2v2_int(), uiPopupBlockCreate::arg, ATTR_FALLTHROUGH, BLI_rctf_isect_pt(), uiBlock::block_event_func, BUTTON_ACTIVATE, BUTTON_ACTIVATE_APPLY, button_activate_exit(), BUTTON_ACTIVATE_OPEN, button_modal_state(), uiBlock::buttons, uiHandleButtonData::cancel, copy_v2_v2_int(), count, CTX_wm_manager(), CTX_wm_window(), wmWindow::cursor, wmEvent::customdata, PointerRNA::data, uiBlock::direction, uiPopupBlockHandle::dotowards, ELEM, uiPopupBlockCreate::event_xy, EVT_AKEY, EVT_BKEY, EVT_CKEY, EVT_DKEY, EVT_DOWNARROWKEY, EVT_EIGHTKEY, EVT_EKEY, EVT_ENDKEY, EVT_ESCKEY, EVT_FIVEKEY, EVT_FKEY, EVT_FOURKEY, EVT_GKEY, EVT_HKEY, EVT_HOMEKEY, EVT_IKEY, EVT_JKEY, EVT_KKEY, EVT_LEFTARROWKEY, EVT_LKEY, EVT_MKEY, EVT_NINEKEY, EVT_NKEY, EVT_OKEY, EVT_ONEKEY, EVT_PAD0, EVT_PAD1, EVT_PAD2, EVT_PAD3, EVT_PAD4, EVT_PAD5, EVT_PAD6, EVT_PAD7, EVT_PAD8, EVT_PAD9, EVT_PADENTER, EVT_PAGEDOWNKEY, EVT_PAGEUPKEY, EVT_PKEY, EVT_QKEY, EVT_RETKEY, EVT_RIGHTARROWKEY, EVT_RKEY, EVT_SEVENKEY, EVT_SIXKEY, EVT_SKEY, EVT_SPACEKEY, EVT_THREEKEY, EVT_TKEY, EVT_TWOKEY, EVT_UKEY, EVT_UPARROWKEY, EVT_VKEY, EVT_WKEY, EVT_XKEY, EVT_YKEY, EVT_ZEROKEY, EVT_ZKEY, ListBase::first, MenuType::flag, uiBlock::flag, uiBut::flag, wmEvent::flag, float, uiPopupBlockHandle::grab_xy_prev, uiPopupBlockHandle::is_grab, uiPopupBlockHandle::keynav_state, KM_ALT, KM_CLICK, KM_CTRL, KM_DBL_CLICK, KM_OSKEY, KM_PRESS, KM_RELEASE, KM_SHIFT, LEFTMOUSE, LISTBASE_FOREACH, uiPopupBlockHandle::menu_idname, MENU_SCROLL_BOTTOM, MENU_SCROLL_DOWN, MENU_SCROLL_INTERVAL, MENU_SCROLL_TOP, MENU_SCROLL_UP, uiPopupBlockHandle::menuretval, MIDDLEMOUSE, wmWindow::modalcursor, wmEvent::modifier, MOUSEMOVE, MOUSEPAN, uiBut::next, uiSafetyRct::next, uiSafetyRct::parent, uiPopupBlockHandle::popup_create_vars, PROP_LAYER, PROP_LAYER_MEMBER, uiBlock::rect, uiPopupBlockHandle::region, RIGHTMOUSE, RNA_property_subtype(), uiBut::rnaindex, uiBut::rnapoin, uiBut::rnaprop, uiBlock::saferct, uiSafetyRct::safety, uiPopupBlockHandle::scrolltimer, SearchOnKeyPress, uiHandleButtonData::state, sub_v2_v2v2_int(), TIMER, uiBut::type, wmEvent::type, UI_BLOCK_CLIPBOTTOM, UI_BLOCK_CLIPTOP, ui_block_is_menu(), UI_BLOCK_LOOP, UI_BLOCK_MOVEMOUSE_QUIT, UI_BLOCK_NUMSELECT, UI_BLOCK_OUT_1, UI_BLOCK_POPOVER, UI_BLOCK_POPOVER_ONCE, UI_BLOCK_POPUP_HOLD, UI_BTYPE_BLOCK, UI_BTYPE_BUT, UI_BTYPE_BUT_MENU, UI_BTYPE_IMAGE, UI_BTYPE_LABEL, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BUT_ACTIVE_DEFAULT, ui_but_contains_point_px(), UI_BUT_DISABLED, UI_but_execute(), ui_but_first(), ui_but_last(), ui_but_next(), ui_but_prev(), UI_but_tooltip_timer_remove(), UI_DIR_UP, ui_handle_button_activate(), ui_handle_button_activate_by_type(), ui_handle_menu_button(), ui_handle_menu_letter_press_search(), UI_HIDDEN, ui_menu_pass_event_to_parent_if_nonactive(), ui_menu_scroll_apply_offset_y(), ui_menu_scroll_step(), ui_menu_scroll_test(), ui_menu_scroll_to_but(), ui_menu_scroll_to_y(), ui_mouse_motion_keynav_init(), ui_mouse_motion_keynav_test(), ui_mouse_motion_towards_check(), ui_mouse_motion_towards_init(), ui_mouse_motion_towards_reinit(), ui_pan_to_scroll(), UI_popover_once_clear(), ui_popup_translate(), ui_region_find_active_but(), ui_region_find_first_but_test_flag(), UI_RETURN_CANCEL, UI_RETURN_OK, UI_RETURN_OUT, UI_RETURN_OUT_PARENT, UI_RETURN_POPUP_OK, UI_RETURN_UPDATE, UI_UNIT_Y, ui_window_to_block(), USER_MENUOPENAUTO, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, WM_CURSOR_DEFAULT, WM_CURSOR_HAND, WM_CURSOR_HAND_CLOSED, WM_CURSOR_MOVE, WM_cursor_set(), WM_event_add_mousemove(), WM_EVENT_IS_REPEAT, WM_event_timer_add(), WM_menutype_find(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, wmEvent::xy, and rctf::ymax.

Referenced by ui_handle_menus_recursive().

◆ ui_handle_menu_letter_press_search()

◆ ui_handle_menu_return_submenu()

◆ ui_handle_menus_recursive()

◆ ui_handle_region_semi_modal_buttons()

static int ui_handle_region_semi_modal_buttons ( bContext * C,
const wmEvent * event,
ARegion * region )
static

◆ ui_handle_view_item_event()

◆ ui_handle_viewlist_items_hover()

◆ ui_handler_region_drag_toggle()

◆ ui_handler_region_drag_toggle_remove()

static void ui_handler_region_drag_toggle_remove ( bContext * ,
void * userdata )
static

◆ ui_handler_region_menu()

◆ ui_list_activate_hovered_row()

static int ui_list_activate_hovered_row ( bContext * C,
ARegion * region,
const uiList * ui_list,
const wmEvent * event,
bool activate_dragging )
static

Activate the underlying list-row button, so the row is highlighted. Early exits if activate_dragging is true, but the custom drag operator fails to execute. Gives the wanted behavior where the item is activated on a click-drag event when the custom drag operator is executed.

Definition at line 9765 of file interface_handlers.cc.

References uiListDyn::custom_activate_optype, uiListDyn::custom_drag_opptr, uiListDyn::custom_drag_optype, uiList::dyn_data, UI_but_execute(), ui_but_find_mouse_over(), ui_list_invoke_item_operator(), ui_list_row_find_mouse_over(), WM_event_drag_start_xy(), WM_UI_HANDLER_BREAK, and WM_UI_HANDLER_CONTINUE.

Referenced by ui_list_handle_click_drag().

◆ ui_list_activate_row_from_index()

static void ui_list_activate_row_from_index ( bContext * C,
ARegion * region,
uiBut * listbox,
uiList * ui_list,
int index )
static

◆ ui_list_get_increment()

static int ui_list_get_increment ( const uiList * ui_list,
const int type,
const int columns )
static

◆ ui_list_handle_click_drag()

static int ui_list_handle_click_drag ( bContext * C,
const uiList * ui_list,
ARegion * region,
const wmEvent * event )
static

◆ ui_list_invoke_item_operator()

static bool ui_list_invoke_item_operator ( bContext * C,
const uiBut * context_but,
wmOperatorType * ot,
PointerRNA ** properties )
static
Note
Ownership of properties is moved here. The uiAfterFunc owns it now.
Parameters
context_butThe button to use context from when calling or polling the operator.
Returns
true if the operator was executed, otherwise false.

Definition at line 1221 of file interface_handlers.cc.

References ot, ui_but_context_poll_operator(), ui_handle_afterfunc_add_operator_ex(), and WM_OP_INVOKE_DEFAULT.

Referenced by ui_apply_but_LISTROW(), and ui_list_activate_hovered_row().

◆ ui_list_is_hovering_draggable_but()

static bool ui_list_is_hovering_draggable_but ( bContext * C,
const uiList * list,
const ARegion * region,
const wmEvent * event )
static

◆ ui_menu_pass_event_to_parent_if_nonactive()

static bool ui_menu_pass_event_to_parent_if_nonactive ( uiPopupBlockHandle * menu,
const uiBut * but,
const int level,
const bool is_parent_menu,
const int retval )
static

Special function to handle nested menus. let the parent menu get the event.

This allows a menu to be open, but send key events to the parent if there's no active buttons.

Without this keyboard navigation from menus won't work.

Definition at line 10487 of file interface_handlers.cc.

References BLI_assert, uiPopupBlockHandle::menuretval, uiPopupBlockHandle::popup, UI_RETURN_OUT, UI_RETURN_OUT_PARENT, and WM_UI_HANDLER_CONTINUE.

Referenced by ui_handle_menu_event().

◆ ui_menu_scroll_apply_offset_y()

◆ ui_menu_scroll_step()

static bool ui_menu_scroll_step ( ARegion * region,
uiBlock * block,
const int scroll_dir )
static

◆ ui_menu_scroll_test()

static char ui_menu_scroll_test ( uiBlock * block,
int my )
static

◆ ui_menu_scroll_to_but()

static bool ui_menu_scroll_to_but ( ARegion * region,
uiBlock * block,
uiBut * but_target )
static

◆ ui_menu_scroll_to_y()

static bool ui_menu_scroll_to_y ( ARegion * region,
uiBlock * block,
int y )
static

Scroll to y location (in block space, see ui_window_to_block).

Definition at line 10425 of file interface_handlers.cc.

References ui_menu_scroll_apply_offset_y(), ui_menu_scroll_test(), and UI_UNIT_Y.

Referenced by ui_handle_menu_event(), and ui_menu_scroll_step().

◆ ui_mouse_motion_keynav_init()

static void ui_mouse_motion_keynav_init ( uiKeyNavLock * keynav,
const wmEvent * event )
static

◆ ui_mouse_motion_keynav_test()

static bool ui_mouse_motion_keynav_test ( uiKeyNavLock * keynav,
const wmEvent * event )
static

Return true if key-input isn't blocking mouse-motion, or if the mouse-motion is enough to disable key-input.

Definition at line 10324 of file interface_handlers.cc.

References BUTTON_KEYNAV_PX_LIMIT, uiKeyNavLock::event_xy, uiKeyNavLock::is_keynav, len_manhattan_v2v2_int(), and wmEvent::xy.

Referenced by ui_do_but_textedit(), and ui_handle_menu_event().

◆ ui_mouse_motion_towards_check()

◆ ui_mouse_motion_towards_init()

static void ui_mouse_motion_towards_init ( uiPopupBlockHandle * menu,
const int xy[2] )
static

Definition at line 10232 of file interface_handlers.cc.

References ui_mouse_motion_towards_init_ex(), and xy.

Referenced by ui_handle_menu_event().

◆ ui_mouse_motion_towards_init_ex()

static void ui_mouse_motion_towards_init_ex ( uiPopupBlockHandle * menu,
const int xy[2],
const bool force )
static

Function used to prevent losing the open menu when using nested pull-downs, when moving mouse towards the pull-down menu over other buttons that could steal the highlight from the current button, only checks:

  • while mouse moves in triangular area defined old mouse position and left/right side of new menu.
  • only for 1 second.

Definition at line 10211 of file interface_handlers.cc.

References BLI_assert, BLI_time_now_seconds(), uiPopupBlockHandle::dotowards, ListBase::first, uiPopupBlockHandle::region, uiPopupBlockHandle::towards_xy, uiPopupBlockHandle::towardstime, UI_BLOCK_MOVEMOUSE_QUIT, UI_BLOCK_POPOVER, ARegion::uiblocks, and xy.

Referenced by ui_mouse_motion_towards_init(), and ui_mouse_motion_towards_reinit().

◆ ui_mouse_motion_towards_reinit()

static void ui_mouse_motion_towards_reinit ( uiPopupBlockHandle * menu,
const int xy[2] )
static

◆ ui_mouse_scale_warp()

static void ui_mouse_scale_warp ( uiHandleButtonData * data,
const float mx,
const float my,
float * r_mx,
float * r_my,
const bool shift )
static

◆ ui_mouse_scale_warp_factor()

static float ui_mouse_scale_warp_factor ( const bool shift)
static

◆ ui_multibut_add()

◆ ui_multibut_free()

static void ui_multibut_free ( uiHandleButtonData * data,
uiBlock * block )
static

◆ ui_multibut_lookup()

static uiButMultiState * ui_multibut_lookup ( uiHandleButtonData * data,
const uiBut * but )
static

Definition at line 1403 of file interface_handlers.cc.

References uiButMultiState::but, l, and BMLoop::next.

Referenced by ui_multibut_restore(), and ui_multibut_states_apply().

◆ ui_multibut_restore()

◆ ui_multibut_states_apply()

◆ ui_multibut_states_create()

◆ ui_multibut_states_tag()

◆ ui_numedit_apply()

◆ ui_numedit_apply_snap()

static float ui_numedit_apply_snap ( int temp,
float softmin,
float softmax,
const enum eSnapType snap )
static

Definition at line 5177 of file interface_handlers.cc.

References ELEM, snap(), SNAP_OFF, SNAP_ON, and SNAP_ON_SMALL.

Referenced by ui_numedit_but_NUM().

◆ ui_numedit_apply_snapf()

◆ ui_numedit_begin()

◆ ui_numedit_begin_set_values()

static void ui_numedit_begin_set_values ( uiBut * but,
uiHandleButtonData * data )
static

Definition at line 4165 of file interface_handlers.cc.

References ui_but_value_get().

Referenced by ui_numedit_begin(), and ui_textedit_begin().

◆ ui_numedit_but_COLORBAND()

static bool ui_numedit_but_COLORBAND ( uiBut * but,
uiHandleButtonData * data,
int mx )
static

◆ ui_numedit_but_CURVE()

◆ ui_numedit_but_CURVEPROFILE()

◆ ui_numedit_but_HISTOGRAM()

static bool ui_numedit_but_HISTOGRAM ( uiBut * but,
uiHandleButtonData * data,
int mx,
int my )
static

Definition at line 7906 of file interface_handlers.cc.

References CLAMP, min_ff(), uiBut::poin, pow2f(), and Histogram::ymax.

Referenced by ui_do_but_HISTOGRAM().

◆ ui_numedit_but_HSVCIRCLE()

◆ ui_numedit_but_HSVCUBE()

◆ ui_numedit_but_NUM()

◆ ui_numedit_but_SLI()

◆ ui_numedit_but_TRACKPREVIEW()

◆ ui_numedit_but_UNITVEC()

static bool ui_numedit_but_UNITVEC ( uiBut * but,
uiHandleButtonData * data,
int mx,
int my,
const enum eSnapType snap )
static

◆ ui_numedit_but_WAVEFORM()

static bool ui_numedit_but_WAVEFORM ( uiBut * but,
uiHandleButtonData * data,
int mx,
int my )
static

Definition at line 7980 of file interface_handlers.cc.

References CLAMP, uiBut::poin, and Scopes::wavefrm_yfac.

Referenced by ui_do_but_WAVEFORM().

◆ ui_numedit_end()

◆ ui_numedit_set_active()

◆ ui_palette_set_active()

static void ui_palette_set_active ( uiButColor * color_but)
static

◆ ui_pan_to_scroll()

void ui_pan_to_scroll ( const wmEvent * event,
int * type,
int * val )

◆ ui_pie_handler()

static int ui_pie_handler ( bContext * C,
const wmEvent * event,
uiPopupBlockHandle * menu )
static

Definition at line 11431 of file interface_handlers.cc.

References uiBut::active, add_v2_v2(), PieMenuData::alphafac, ATTR_FALLTHROUGH, BLI_rctf_recenter(), BLI_rctf_size_x(), BLI_rctf_size_y(), button_modal_state(), uiBlock::buttons, CASE_NUM_TO_DIR, copy_v2_v2(), CTX_wm_manager(), CTX_wm_window(), wmEvent::customdata, PieMenuData::duration_gesture, ED_region_tag_redraw(), ELEM, PieMenuData::event_type, EVT_AKEY, EVT_BKEY, EVT_CKEY, EVT_DKEY, EVT_DROP, EVT_EKEY, EVT_ESCKEY, EVT_FKEY, EVT_GKEY, EVT_HKEY, EVT_IKEY, EVT_JKEY, EVT_KKEY, EVT_LKEY, EVT_MKEY, EVT_NKEY, EVT_OKEY, EVT_PKEY, EVT_QKEY, EVT_RKEY, EVT_SKEY, EVT_TKEY, EVT_UKEY, EVT_VKEY, EVT_WKEY, EVT_XKEY, EVT_YKEY, EVT_ZKEY, PieMenuData::flags, float, KM_CTRL, KM_DBL_CLICK, KM_OSKEY, KM_PRESS, KM_RELEASE, KM_SHIFT, PieMenuData::last_pos, LEFTMOUSE, len_squared_v2v2(), LISTBASE_FOREACH, uiBut::menu_key, uiPopupBlockHandle::menuretval, wmEvent::modifier, MOUSEMOVE, mul_v2_fl(), PieMenuData::pie_center_init, PieMenuData::pie_center_spawned, PIE_CLICK_THRESHOLD_SQ, uiBlock::pie_data, uiBut::pie_dir, PIE_MENU_INTERVAL, uiBut::rect, uiPopupBlockHandle::region, RIGHTMOUSE, uiPopupBlockHandle::scrolltimer, uiHandleButtonData::state, wmTimer::time_duration, TIMER, wmEvent::type, ui_block_calc_pie_segment(), ui_block_pie_dir_activate(), ui_but_pie_button_activate(), ui_but_pie_dir(), ui_but_pie_menu_apply(), ui_handle_menu_button(), UI_PIE_ANIMATION_FINISHED, UI_PIE_CLICK_STYLE, UI_PIE_DRAG_STYLE, UI_PIE_GESTURE_END_WAIT, UI_PIE_INVALID_DIR, UI_RADIAL_E, UI_RADIAL_N, UI_RADIAL_NE, UI_RADIAL_NONE, UI_RADIAL_NW, UI_RADIAL_S, UI_RADIAL_SE, UI_RADIAL_SW, UI_RADIAL_W, ui_region_find_active_but(), UI_RETURN_CANCEL, UI_SCALE_FAC, ui_window_to_block_fl(), wmEvent::val, WM_event_timer_add(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_handle_menus_recursive().

◆ ui_popup_handler()

◆ ui_popup_handler_remove()

◆ UI_popup_handlers_add()

◆ UI_popup_handlers_remove()

◆ UI_popup_handlers_remove_all()

void UI_popup_handlers_remove_all ( bContext * C,
ListBase * handlers )

◆ UI_popup_menu_retval_set()

void UI_popup_menu_retval_set ( const uiBlock * block,
int retval,
bool enable )

Allow setting menu return value from externals. E.g. WM might need to do this for exiting files correctly.

Definition at line 11824 of file interface_handlers.cc.

References uiBlock::handle, and uiPopupBlockHandle::menuretval.

Referenced by dialog_cancel_cb(), dialog_exec_cb(), popup_block_template_close_cb(), and UI_popup_menu_close().

◆ UI_region_active_but_get()

◆ UI_region_active_but_prop_get()

uiBut * UI_region_active_but_prop_get ( const ARegion * region,
PointerRNA * r_ptr,
PropertyRNA ** r_prop,
int * r_index )

As above, but for a specified region.

Returns
active button, NULL if none found or if it doesn't contain valid RNA data.

Definition at line 9076 of file interface_handlers.cc.

References PointerRNA::data, uiBut::rnaindex, uiBut::rnapoin, uiBut::rnaprop, and UI_region_active_but_get().

Referenced by graph_panel_drivers_popover(), and UI_context_active_but_prop_get().

◆ ui_region_auto_open_clear()

static void ui_region_auto_open_clear ( ARegion * region)
static

Definition at line 10471 of file interface_handlers.cc.

References LISTBASE_FOREACH.

Referenced by ui_handle_menu_button().

◆ UI_region_block_find_mouse_over()

uiBlock * UI_region_block_find_mouse_over ( const ARegion * region,
const int xy[2],
bool only_clip )

Definition at line 9071 of file interface_handlers.cc.

References ui_block_find_mouse_over_ex(), and xy.

Referenced by wm_handlers_do_gizmo_handler().

◆ UI_region_but_find_rect_over()

uiBut * UI_region_but_find_rect_over ( const ARegion * region,
const rcti * rect_px )

Definition at line 9066 of file interface_handlers.cc.

References ui_but_find_rect_over().

Referenced by ED_region_contains_xy().

◆ UI_region_free_active_but_all()

void UI_region_free_active_but_all ( bContext * C,
ARegion * region )

◆ ui_region_handler()

◆ ui_region_handler_remove()

static void ui_region_handler_remove ( bContext * C,
void *  )
static

◆ UI_region_handlers_add()

◆ UI_region_searchbox_region_get()

ARegion * UI_region_searchbox_region_get ( const ARegion * button_region)

Try to find a search-box region opened from a button in button_region.

Definition at line 9166 of file interface_handlers.cc.

References uiBut::active, uiHandleButtonData::searchbox, and UI_region_active_but_get().

Referenced by wm_searchbox_tooltip_init().

◆ ui_rgb_to_color_picker_HSVCUBE_compat_v()

static void ui_rgb_to_color_picker_HSVCUBE_compat_v ( const uiButHSVCube * hsv_but,
const float rgb[3],
float hsv[3] )
static

◆ ui_rgb_to_color_picker_HSVCUBE_v()

static void ui_rgb_to_color_picker_HSVCUBE_v ( const uiButHSVCube * hsv_but,
const float rgb[3],
float hsv[3] )
static

◆ ui_rna_is_userdef()

static bool ui_rna_is_userdef ( PointerRNA * ptr,
PropertyRNA * prop )
static

◆ ui_rna_update_preferences_dirty()

static void ui_rna_update_preferences_dirty ( PointerRNA * ptr,
PropertyRNA * prop )
static

◆ UI_screen_free_active_but_highlight()

void UI_screen_free_active_but_highlight ( const bContext * C,
bScreen * screen )

◆ ui_selectcontext_apply()

◆ ui_selectcontext_begin()

◆ ui_selectcontext_end()

static void ui_selectcontext_end ( uiBut * but,
uiSelectContextStore * selctx_data )
static

◆ ui_text_position_from_hidden()

static int ui_text_position_from_hidden ( uiBut * but,
int pos )
static

◆ ui_text_position_to_hidden()

static int ui_text_position_to_hidden ( uiBut * but,
int pos )
static

Definition at line 2979 of file interface_handlers.cc.

References BLI_strnlen_utf8(), uiBut::drawstr, uiBut::editstr, and pos.

Referenced by ui_but_text_password_hide().

◆ UI_textbutton_activate_but()

bool UI_textbutton_activate_but ( const bContext * C,
uiBut * actbut )

◆ UI_textbutton_activate_rna()

◆ ui_textedit_autocomplete()

static int ui_textedit_autocomplete ( bContext * C,
uiBut * but,
uiHandleButtonData * data )
static

◆ ui_textedit_begin()

◆ ui_textedit_copypaste()

◆ ui_textedit_delete()

static bool ui_textedit_delete ( uiBut * but,
uiTextEdit & text_edit,
eStrCursorJumpDirection direction,
eStrCursorJumpType jump )
static

◆ ui_textedit_delete_selection()

static bool ui_textedit_delete_selection ( uiBut * but,
uiTextEdit & text_edit )
static

◆ ui_textedit_end()

◆ ui_textedit_insert_buf()

static bool ui_textedit_insert_buf ( uiBut * but,
uiTextEdit & text_edit,
const char * buf,
int buf_len )
static

◆ ui_textedit_jump_type_from_event()

static eStrCursorJumpType ui_textedit_jump_type_from_event ( const wmEvent * event)
static

Return the jump type used for cursor motion & back-space/delete actions.

Definition at line 3724 of file interface_handlers.cc.

References KM_ALT, KM_CTRL, KM_OSKEY, wmEvent::modifier, STRCUR_JUMP_ALL, STRCUR_JUMP_DELIM, and STRCUR_JUMP_NONE.

Referenced by ui_do_but_textedit().

◆ ui_textedit_move()

static void ui_textedit_move ( uiBut * but,
uiTextEdit & text_edit,
eStrCursorJumpDirection direction,
const bool select,
eStrCursorJumpType jump )
static

◆ ui_textedit_next_but()

◆ ui_textedit_prev_but()

◆ ui_textedit_set_cursor_pos()

◆ ui_textedit_set_cursor_select()

static void ui_textedit_set_cursor_select ( uiBut * but,
uiHandleButtonData * data,
const float x )
static

◆ ui_textedit_string_ensure_max_length()

static void ui_textedit_string_ensure_max_length ( uiBut * but,
uiTextEdit & text_edit,
int str_maxncpy )
static

◆ ui_textedit_string_set()

static void ui_textedit_string_set ( uiBut * but,
uiTextEdit & text_edit,
const char * str )
static

◆ with_but_active_as_semi_modal()

static void with_but_active_as_semi_modal ( bContext * C,
ARegion * region,
uiBut * but,
blender::FunctionRef< void()> fn )
static

Variable Documentation

◆ but_copypaste_coba

ColorBand but_copypaste_coba = {0}
static

Definition at line 558 of file interface_handlers.cc.

Referenced by ui_but_copy_colorband(), and ui_but_paste_colorband().

◆ but_copypaste_curve

CurveMapping but_copypaste_curve = {0}
static

◆ but_copypaste_curve_alive

bool but_copypaste_curve_alive = false
static

Definition at line 560 of file interface_handlers.cc.

Referenced by ui_but_copy_curvemapping(), and ui_but_paste_curvemapping().

◆ but_copypaste_profile

CurveProfile but_copypaste_profile = {0}
static

◆ but_copypaste_profile_alive

bool but_copypaste_profile_alive = false
static

Definition at line 562 of file interface_handlers.cc.

Referenced by ui_but_copy_CurveProfile(), and ui_but_paste_CurveProfile().

◆ UIAfterFuncs

ListBase UIAfterFuncs = {nullptr, nullptr}
static

Definition at line 773 of file interface_handlers.cc.

Referenced by ui_afterfunc_new(), and ui_apply_but_funcs_after().