Blender V4.3
interface_panel.cc File Reference
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_time.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.hh"
#include "BKE_screen.hh"
#include "RNA_access.hh"
#include "BLF_api.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_screen.hh"
#include "UI_interface.hh"
#include "UI_interface_c.hh"
#include "UI_interface_icons.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "GPU_batch_presets.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "interface_intern.hh"

Go to the source code of this file.

Classes

struct  uiHandlePanelData
 
struct  PanelSort
 
struct  uiPanelDragCollapseHandle
 

Functions

Local Functions
static bool panel_active_animation_changed (ListBase *lb, Panel **r_panel_animation, bool *r_no_animation)
 
static bool properties_space_needs_realign (const ScrArea *area, const ARegion *region)
 
static bool panels_need_realign (const ScrArea *area, ARegion *region, Panel **r_panel_animation)
 
Functions for Instanced Panels
static Panelpanel_add_instanced (ListBase *panels, PanelType *panel_type, PointerRNA *custom_data)
 
PanelUI_panel_add_instanced (const bContext *C, ARegion *region, ListBase *panels, const char *panel_idname, PointerRNA *custom_data)
 
void UI_list_panel_unique_str (Panel *panel, char *r_name)
 
static void panel_delete (ARegion *region, ListBase *panels, Panel *panel)
 
void UI_panels_free_instanced (const bContext *C, ARegion *region)
 
bool UI_panel_list_matches_data (ARegion *region, ListBase *data, uiListPanelIDFromDataFunc panel_idname_func)
 
static void reorder_instanced_panel_list (bContext *C, ARegion *region, Panel *drag_panel)
 
static bool panel_set_expand_from_list_data_recursive (Panel *panel, short flag, short *flag_index)
 
static void region_panels_set_expansion_from_list_data (const bContext *C, ARegion *region)
 
static void get_panel_expand_flag (const Panel *panel, short *flag, short *flag_index)
 
static void set_panels_list_data_expand_flag (const bContext *C, const ARegion *region)
 
Panels
static bool panel_custom_pin_to_last_get (const Panel *panel)
 
static void panel_custom_pin_to_last_set (const bContext *C, const Panel *panel, const bool value)
 
static bool panel_custom_data_active_get (const Panel *panel)
 
static void panel_custom_data_active_set (Panel *panel)
 
static void panel_set_flag_recursive (Panel *panel, short flag, bool value)
 
static void panel_set_runtime_flag_recursive (Panel *panel, short flag, bool value)
 
static void panels_collapse_all (ARegion *region, const Panel *from_panel)
 
PanelUI_panel_find_by_type (ListBase *lb, const PanelType *pt)
 
PanelUI_panel_begin (ARegion *region, ListBase *lb, uiBlock *block, PanelType *pt, Panel *panel, bool *r_open)
 
void UI_panel_header_buttons_begin (Panel *panel)
 
void UI_panel_header_buttons_end (Panel *panel)
 
static float panel_region_offset_x_get (const ARegion *region)
 
static void panel_calculate_size_recursive (ARegion *region, Panel *panel)
 
void UI_panel_end (Panel *panel, int width, int height)
 
void UI_panel_drawname_set (Panel *panel, blender::StringRef name)
 
static void ui_offset_panel_block (uiBlock *block)
 
void ui_panel_tag_search_filter_match (Panel *panel)
 
static void panel_matches_search_filter_recursive (const Panel *panel, bool *filter_matches)
 
bool UI_panel_matches_search_filter (const Panel *panel)
 
static void panel_set_expansion_from_search_filter_recursive (const bContext *C, Panel *panel, const bool use_search_closed)
 
static void region_panels_set_expansion_from_search_filter (const bContext *C, ARegion *region, const bool use_search_closed)
 
static void panel_remove_invisible_layouts_recursive (Panel *panel, const Panel *parent_panel)
 
static void region_panels_remove_invisible_layouts (ARegion *region)
 
bool UI_panel_is_closed (const Panel *panel)
 
bool UI_panel_is_active (const Panel *panel)
 
Panel Alignment
static int get_panel_size_y (const Panel *panel)
 
int UI_panel_size_y (const Panel *panel)
 
static int get_panel_real_ofsy (Panel *panel)
 
bool UI_panel_is_dragging (const Panel *panel)
 
static int find_highest_panel (const void *a, const void *b)
 
static void align_sub_panels (Panel *panel)
 
static bool uiAlignPanelStep (ARegion *region, const float factor, const bool drag)
 
static void ui_panels_size (ARegion *region, int *r_x, int *r_y)
 
static void ui_do_animate (bContext *C, Panel *panel)
 
static void panels_layout_begin_clear_flags (ListBase *lb)
 
void UI_panels_begin (const bContext *, ARegion *region)
 
void UI_panels_end (const bContext *C, ARegion *region, int *r_x, int *r_y)
 
Region Level Panel Interaction
LayoutPanelHeaderui_layout_panel_header_under_mouse (const Panel &panel, const int my)
 
static uiPanelMouseState ui_panel_mouse_state_get (const uiBlock *block, const Panel *panel, const int mx, const int my)
 
static void ui_panel_drag_collapse_handler_remove (bContext *, void *userdata)
 
static void ui_panel_drag_collapse (const bContext *C, const uiPanelDragCollapseHandle *dragcol_data, const int xy_dst[2])
 
static int ui_panel_drag_collapse_handler (bContext *C, const wmEvent *event, void *userdata)
 
void ui_panel_drag_collapse_handler_add (const bContext *C, const bool was_open)
 
bool ui_layout_panel_toggle_open (const bContext *C, LayoutPanelHeader *header)
 
static void ui_handle_layout_panel_header (bContext *C, const uiBlock *block, const int, const int my, const int event_type)
 
static void ui_handle_panel_header (const bContext *C, const uiBlock *block, const int mx, const int event_type, const bool ctrl, const bool shift)
 
bool UI_panel_category_is_visible (const ARegion *region)
 
PanelCategoryDynUI_panel_category_find (const ARegion *region, const char *idname)
 
int UI_panel_category_index_find (ARegion *region, const char *idname)
 
PanelCategoryStackUI_panel_category_active_find (ARegion *region, const char *idname)
 
static void ui_panel_category_active_set (ARegion *region, const char *idname, bool fallback)
 
void UI_panel_category_active_set (ARegion *region, const char *idname)
 
void UI_panel_category_index_active_set (ARegion *region, const int index)
 
void UI_panel_category_active_set_default (ARegion *region, const char *idname)
 
const char * UI_panel_category_active_get (ARegion *region, bool set_fallback)
 
static PanelCategoryDynpanel_categories_find_mouse_over (ARegion *region, const wmEvent *event)
 
void UI_panel_category_add (ARegion *region, const char *name)
 
void UI_panel_category_clear_all (ARegion *region)
 
static int ui_handle_panel_category_cycling (const wmEvent *event, ARegion *region, const uiBut *active_but)
 
int ui_handler_panel_region (bContext *C, const wmEvent *event, ARegion *region, const uiBut *active_but)
 
static void ui_panel_custom_data_set_recursive (Panel *panel, PointerRNA *custom_data)
 
void UI_panel_context_pointer_set (Panel *panel, const char *name, PointerRNA *ptr)
 
void UI_panel_custom_data_set (Panel *panel, PointerRNA *custom_data)
 
PointerRNAUI_panel_custom_data_get (const Panel *panel)
 
PointerRNAUI_region_panel_custom_data_under_cursor (const bContext *C, const wmEvent *event)
 
bool UI_panel_can_be_pinned (const Panel *panel)
 
Window Level Modal Panel Interaction
static int ui_handler_panel (bContext *C, const wmEvent *event, void *userdata)
 
static void ui_handler_remove_panel (bContext *C, void *userdata)
 
static void panel_handle_data_ensure (const bContext *C, wmWindow *win, const ARegion *region, Panel *panel, const uiHandlePanelState state)
 

Defines & Structs

#define ANIMATION_TIME   0.30
 
#define ANIMATION_INTERVAL   0.02
 
enum  uiPanelRuntimeFlag {
  PANEL_LAST_ADDED = (1 << 0) , PANEL_ACTIVE = (1 << 2) , PANEL_WAS_ACTIVE = (1 << 3) , PANEL_ANIM_ALIGN = (1 << 4) ,
  PANEL_NEW_ADDED = (1 << 5) , PANEL_SEARCH_FILTER_MATCH = (1 << 7) , PANEL_USE_CLOSED_FROM_SEARCH = (1 << 8) , PANEL_WAS_CLOSED = (1 << 9) ,
  PANEL_IS_DRAG_DROP = (1 << 10) , PANEL_ACTIVE_BORDER = (1 << 11)
}
 
enum  uiPanelMouseState { PANEL_MOUSE_OUTSIDE , PANEL_MOUSE_INSIDE_CONTENT , PANEL_MOUSE_INSIDE_HEADER , PANEL_MOUSE_INSIDE_LAYOUT_PANEL_HEADER }
 
enum  uiHandlePanelState { PANEL_STATE_DRAG , PANEL_STATE_ANIMATION , PANEL_STATE_EXIT }
 
static void panel_set_expansion_from_list_data (const bContext *C, Panel *panel)
 
static int get_panel_real_size_y (const Panel *panel)
 
static void panel_activate_state (const bContext *C, Panel *panel, const uiHandlePanelState state)
 
static int compare_panel (const void *a, const void *b)
 
static bool panel_type_context_poll (ARegion *region, const PanelType *panel_type, const char *context)
 

Drawing

#define PNL_ICON   UI_UNIT_X /* Could be UI_UNIT_Y too. */
 
void UI_panels_draw (const bContext *C, ARegion *region)
 
void UI_panel_label_offset (const uiBlock *block, int *r_x, int *r_y)
 
static void panel_title_color_get (const Panel *panel, const bool show_background, const bool region_search_filter_active, uchar r_color[4])
 
static void panel_draw_highlight_border (const Panel *panel, const rcti *rect, const rcti *header_rect)
 
static void panel_draw_aligned_widgets (const uiStyle *style, const Panel *panel, const rcti *header_rect, const float aspect, const bool show_pin, const bool show_background, const bool region_search_filter_active)
 
void ui_draw_layout_panels_backdrop (const ARegion *region, const Panel *panel, const float radius, float subpanel_backcolor[4])
 
static void panel_draw_aligned_backdrop (const ARegion *region, const Panel *panel, const rcti *rect, const rcti *header_rect)
 
void ui_draw_aligned_panel (const ARegion *region, const uiStyle *style, const uiBlock *block, const rcti *rect, const bool show_pin, const bool show_background, const bool region_search_filter_active)
 
bool UI_panel_should_show_background (const ARegion *region, const PanelType *panel_type)
 

Category Drawing (Tabs)

#define TABS_PADDING_BETWEEN_FACTOR   4.0f
 
#define TABS_PADDING_TEXT_FACTOR   6.0f
 
void UI_panel_category_draw_all (ARegion *region, const char *category_id_active)
 

Panel Dragging

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)
 
static void ui_do_drag (const bContext *C, const wmEvent *event, Panel *panel)
 

Macro Definition Documentation

◆ ANIMATION_INTERVAL

#define ANIMATION_INTERVAL   0.02

Definition at line 58 of file interface_panel.cc.

Referenced by panel_handle_data_ensure().

◆ ANIMATION_TIME

#define ANIMATION_TIME   0.30

Definition at line 57 of file interface_panel.cc.

Referenced by ui_do_animate().

◆ DRAG_REGION_PAD

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)

Definition at line 1968 of file interface_panel.cc.

Referenced by ui_do_drag().

◆ PNL_ICON

#define PNL_ICON   UI_UNIT_X /* Could be UI_UNIT_Y too. */

Definition at line 1030 of file interface_panel.cc.

Referenced by ui_handle_panel_header().

◆ TABS_PADDING_BETWEEN_FACTOR

#define TABS_PADDING_BETWEEN_FACTOR   4.0f

Definition at line 1366 of file interface_panel.cc.

Referenced by UI_panel_category_draw_all().

◆ TABS_PADDING_TEXT_FACTOR

#define TABS_PADDING_TEXT_FACTOR   6.0f

Definition at line 1367 of file interface_panel.cc.

Referenced by UI_panel_category_draw_all().

Enumeration Type Documentation

◆ uiHandlePanelState

Enumerator
PANEL_STATE_DRAG 
PANEL_STATE_ANIMATION 
PANEL_STATE_EXIT 

Definition at line 91 of file interface_panel.cc.

◆ uiPanelMouseState

Enumerator
PANEL_MOUSE_OUTSIDE 
PANEL_MOUSE_INSIDE_CONTENT 

Mouse is not in the panel.

PANEL_MOUSE_INSIDE_HEADER 

Mouse is in the actual panel content.

PANEL_MOUSE_INSIDE_LAYOUT_PANEL_HEADER 

Mouse is in the panel header. Mouse is in the header of a layout panel.

Definition at line 84 of file interface_panel.cc.

◆ uiPanelRuntimeFlag

Enumerator
PANEL_LAST_ADDED 
PANEL_ACTIVE 
PANEL_WAS_ACTIVE 
PANEL_ANIM_ALIGN 
PANEL_NEW_ADDED 
PANEL_SEARCH_FILTER_MATCH 
PANEL_USE_CLOSED_FROM_SEARCH 

Use the status set by property search (PANEL_SEARCH_FILTER_MATCH) instead of PNL_CLOSED. Set to true on every property search update.

PANEL_WAS_CLOSED 

The Panel was before the start of the current / latest layout pass.

PANEL_IS_DRAG_DROP 

Set when the panel is being dragged and while it animates back to its aligned position. Unlike PANEL_STATE_ANIMATION, this is applied to sub-panels as well.

PANEL_ACTIVE_BORDER 

Draw a border with the active color around the panel.

Definition at line 60 of file interface_panel.cc.

Function Documentation

◆ align_sub_panels()

◆ compare_panel()

static int compare_panel ( const void * a,
const void * b )
static

Definition at line 1691 of file interface_panel.cc.

References b, and Panel::sortorder.

Referenced by reorder_instanced_panel_list(), and uiAlignPanelStep().

◆ find_highest_panel()

static int find_highest_panel ( const void * a,
const void * b )
static
Note
about sorting: The Panel.sortorder has a lower value for new panels being added. however, that only works to insert a single panel, when more new panels get added the coordinates of existing panels and the previously stored to-be-inserted panels do not match for sorting.

Definition at line 1649 of file interface_panel.cc.

References b, PanelType::flag, Panel::ofsy, panel_custom_pin_to_last_get(), PANEL_TYPE_NO_HEADER, Panel::sizey, Panel::sortorder, and Panel::type.

Referenced by uiAlignPanelStep().

◆ get_panel_expand_flag()

static void get_panel_expand_flag ( const Panel * panel,
short * flag,
short * flag_index )
static

◆ get_panel_real_ofsy()

static int get_panel_real_ofsy ( Panel * panel)
static

This function is needed because uiBlock and Panel itself don't change Panel.sizey or location when closed.

Definition at line 1628 of file interface_panel.cc.

References Panel::ofsy, Panel::sizey, and UI_panel_is_closed().

Referenced by ui_panels_size().

◆ get_panel_real_size_y()

static int get_panel_real_size_y ( const Panel * panel)
static

◆ get_panel_size_y()

static int get_panel_size_y ( const Panel * panel)
static

Definition at line 1599 of file interface_panel.cc.

References PanelType::flag, PANEL_TYPE_NO_HEADER, PNL_HEADER, Panel::sizey, and Panel::type.

Referenced by align_sub_panels().

◆ panel_activate_state()

◆ panel_active_animation_changed()

static bool panel_active_animation_changed ( ListBase * lb,
Panel ** r_panel_animation,
bool * r_no_animation )
static

◆ panel_add_instanced()

◆ panel_calculate_size_recursive()

static void panel_calculate_size_recursive ( ARegion * region,
Panel * panel )
static

◆ panel_categories_find_mouse_over()

static PanelCategoryDyn * panel_categories_find_mouse_over ( ARegion * region,
const wmEvent * event )
static

Definition at line 2405 of file interface_panel.cc.

References BLI_rcti_isect_pt(), LISTBASE_FOREACH, and wmEvent::mval.

Referenced by ui_handler_panel_region().

◆ panel_custom_data_active_get()

static bool panel_custom_data_active_get ( const Panel * panel)
static

◆ panel_custom_data_active_set()

◆ panel_custom_pin_to_last_get()

static bool panel_custom_pin_to_last_get ( const Panel * panel)
static

◆ panel_custom_pin_to_last_set()

static void panel_custom_pin_to_last_set ( const bContext * C,
const Panel * panel,
const bool value )
static

◆ panel_delete()

static void panel_delete ( ARegion * region,
ListBase * panels,
Panel * panel )
static

Free a panel and its children. Custom data is shared by the panel and its children and is freed by UI_panels_free_instanced.

Note
The only panels that should need to be deleted at runtime are panels with the PANEL_TYPE_INSTANCED flag set.

Definition at line 294 of file interface_panel.cc.

References BKE_panel_free(), BLI_freelistN(), BLI_remlink(), Panel::children, LISTBASE_FOREACH_MUTABLE, and panel_delete().

Referenced by panel_delete(), and UI_panels_free_instanced().

◆ panel_draw_aligned_backdrop()

◆ panel_draw_aligned_widgets()

◆ panel_draw_highlight_border()

◆ panel_handle_data_ensure()

◆ panel_matches_search_filter_recursive()

static void panel_matches_search_filter_recursive ( const Panel * panel,
bool * filter_matches )
static

◆ panel_region_offset_x_get()

static float panel_region_offset_x_get ( const ARegion * region)
static

◆ panel_remove_invisible_layouts_recursive()

static void panel_remove_invisible_layouts_recursive ( Panel * panel,
const Panel * parent_panel )
static

Hide buttons in invisible layouts, which are created because buttons must be added for all panels in order to search, even panels that will end up closed.

Definition at line 940 of file interface_panel.cc.

References uiBlock::active, BLI_assert, Panel_Runtime::block, uiBlock::button_groups, uiBlock::buttons, Panel::children, LISTBASE_FOREACH, PANEL_ACTIVE, panel_remove_invisible_layouts_recursive(), Panel::runtime, UI_block_set_search_only(), UI_BUTTON_GROUP_PANEL_HEADER, UI_HIDDEN, and UI_panel_is_closed().

Referenced by panel_remove_invisible_layouts_recursive(), and region_panels_remove_invisible_layouts().

◆ panel_set_expand_from_list_data_recursive()

static bool panel_set_expand_from_list_data_recursive ( Panel * panel,
short flag,
short * flag_index )
static

Recursive implementation for panel_set_expansion_from_list_data.

Returns
Whether the closed flag for the panel or any sub-panels changed.

Definition at line 457 of file interface_panel.cc.

References Panel::children, flag, Panel::flag, LISTBASE_FOREACH, panel_set_expand_from_list_data_recursive(), PNL_CLOSED, SET_FLAG_FROM_TEST, and UI_panel_is_closed().

Referenced by panel_set_expand_from_list_data_recursive(), and panel_set_expansion_from_list_data().

◆ panel_set_expansion_from_list_data()

static void panel_set_expansion_from_list_data ( const bContext * C,
Panel * panel )
static

Set the expansion of the panel and its sub-panels from the flag stored in the corresponding list data. The flag has expansion stored in each bit in depth first order.

Definition at line 475 of file interface_panel.cc.

References BLI_assert, PanelType::flag, PanelType::get_list_data_expand_flag, panel_activate_state(), panel_set_expand_from_list_data_recursive(), PANEL_STATE_ANIMATION, PANEL_TYPE_INSTANCED, and Panel::type.

Referenced by region_panels_set_expansion_from_list_data(), and UI_panel_add_instanced().

◆ panel_set_expansion_from_search_filter_recursive()

static void panel_set_expansion_from_search_filter_recursive ( const bContext * C,
Panel * panel,
const bool use_search_closed )
static

◆ panel_set_flag_recursive()

static void panel_set_flag_recursive ( Panel * panel,
short flag,
bool value )
static

Set flag state for a panel and its sub-panels.

Definition at line 614 of file interface_panel.cc.

References Panel::children, flag, Panel::flag, LISTBASE_FOREACH, panel_set_flag_recursive(), and SET_FLAG_FROM_TEST.

Referenced by panel_activate_state(), panel_set_flag_recursive(), and ui_handle_panel_header().

◆ panel_set_runtime_flag_recursive()

static void panel_set_runtime_flag_recursive ( Panel * panel,
short flag,
bool value )
static

Set runtime flag state for a panel and its sub-panels.

Definition at line 626 of file interface_panel.cc.

References Panel::children, flag, LISTBASE_FOREACH, panel_set_runtime_flag_recursive(), Panel::runtime_flag, and SET_FLAG_FROM_TEST.

Referenced by panel_activate_state(), and panel_set_runtime_flag_recursive().

◆ panel_title_color_get()

static void panel_title_color_get ( const Panel * panel,
const bool show_background,
const bool region_search_filter_active,
uchar r_color[4] )
static

◆ panel_type_context_poll()

static bool panel_type_context_poll ( ARegion * region,
const PanelType * panel_type,
const char * context )
static

◆ panels_collapse_all()

static void panels_collapse_all ( ARegion * region,
const Panel * from_panel )
static

◆ panels_layout_begin_clear_flags()

◆ panels_need_realign()

static bool panels_need_realign ( const ScrArea * area,
ARegion * region,
Panel ** r_panel_animation )
static

◆ properties_space_needs_realign()

static bool properties_space_needs_realign ( const ScrArea * area,
const ARegion * region )
static
Returns
True if the properties editor switch tabs since the last layout pass.

Definition at line 179 of file interface_panel.cc.

References SpaceProperties::mainb, SpaceProperties::mainbo, RGN_TYPE_WINDOW, and SPACE_PROPERTIES.

Referenced by panels_need_realign(), and UI_panels_end().

◆ region_panels_remove_invisible_layouts()

static void region_panels_remove_invisible_layouts ( ARegion * region)
static

◆ region_panels_set_expansion_from_list_data()

static void region_panels_set_expansion_from_list_data ( const bContext * C,
ARegion * region )
static

Set expansion based on the data for instanced panels.

Definition at line 496 of file interface_panel.cc.

References PanelType::flag, LISTBASE_FOREACH, PANEL_ACTIVE, panel_set_expansion_from_list_data(), and PANEL_TYPE_INSTANCED.

Referenced by UI_panels_end().

◆ region_panels_set_expansion_from_search_filter()

static void region_panels_set_expansion_from_search_filter ( const bContext * C,
ARegion * region,
const bool use_search_closed )
static

Set the flag telling every panel to override its expansion with its search result status.

Definition at line 924 of file interface_panel.cc.

References LISTBASE_FOREACH, panel_set_expansion_from_search_filter_recursive(), and set_panels_list_data_expand_flag().

Referenced by UI_panels_end().

◆ reorder_instanced_panel_list()

◆ set_panels_list_data_expand_flag()

static void set_panels_list_data_expand_flag ( const bContext * C,
const ARegion * region )
static

Call the callback to store the panel and sub-panel expansion settings in the list item that corresponds to each instanced panel.

Note
This needs to iterate through all of the region's panels because the panel with changed expansion might have been the sub-panel of an instanced panel, meaning it might not know which list item it corresponds to.

Definition at line 530 of file interface_panel.cc.

References PanelType::flag, get_panel_expand_flag(), LISTBASE_FOREACH, PANEL_ACTIVE, and PANEL_TYPE_INSTANCED.

Referenced by region_panels_set_expansion_from_search_filter(), ui_handle_panel_header(), and ui_panel_drag_collapse().

◆ ui_do_animate()

◆ ui_do_drag()

static void ui_do_drag ( const bContext * C,
const wmEvent * event,
Panel * panel )
static

◆ ui_draw_aligned_panel()

void ui_draw_aligned_panel ( const ARegion * region,
const uiStyle * style,
const uiBlock * block,
const rcti * rect,
bool show_pin,
bool show_background,
bool region_search_filter_active )

◆ ui_draw_layout_panels_backdrop()

◆ ui_handle_layout_panel_header()

static void ui_handle_layout_panel_header ( bContext * C,
const uiBlock * block,
const int ,
const int my,
const int event_type )
static

◆ ui_handle_panel_category_cycling()

◆ ui_handle_panel_header()

◆ ui_handler_panel()

◆ ui_handler_panel_region()

◆ ui_handler_remove_panel()

static void ui_handler_remove_panel ( bContext * C,
void * userdata )
static

Definition at line 2696 of file interface_panel.cc.

References panel_activate_state(), and PANEL_STATE_EXIT.

Referenced by panel_activate_state(), and panel_handle_data_ensure().

◆ ui_layout_panel_header_under_mouse()

◆ ui_layout_panel_toggle_open()

bool ui_layout_panel_toggle_open ( const bContext * C,
LayoutPanelHeader * header )

◆ UI_list_panel_unique_str()

void UI_list_panel_unique_str ( Panel * panel,
char * r_name )

Find a unique key to append to the PanelType.idname for the lookup to the panel's uiBlock. Needed for instanced panels, where there can be multiple with the same type and identifier.

Definition at line 280 of file interface_panel.cc.

References BLI_snprintf(), INSTANCED_PANEL_UNIQUE_STR_SIZE, and Panel::sortorder.

Referenced by ED_region_panels_layout_ex().

◆ ui_offset_panel_block()

◆ UI_panel_add_instanced()

Panel * UI_panel_add_instanced ( const bContext * C,
ARegion * region,
ListBase * panels,
const char * panel_idname,
PointerRNA * custom_data )

Called in situations where panels need to be added dynamically rather than having only one panel corresponding to each PanelType.

Definition at line 256 of file interface_panel.cc.

References BLI_findstring(), offsetof, panel_add_instanced(), panel_set_expansion_from_list_data(), ARegionType::paneltypes, and printf.

Referenced by ANIM_fmodifier_panels(), blender::ed::spreadsheet::spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateModifiers(), and uiTemplateShaderFx().

◆ UI_panel_begin()

◆ UI_panel_can_be_pinned()

bool UI_panel_can_be_pinned ( const Panel * panel)

◆ UI_panel_category_active_find()

PanelCategoryStack * UI_panel_category_active_find ( ARegion * region,
const char * idname )

◆ UI_panel_category_active_get()

◆ UI_panel_category_active_set()

void UI_panel_category_active_set ( ARegion * region,
const char * idname )

◆ ui_panel_category_active_set()

◆ UI_panel_category_active_set_default()

void UI_panel_category_active_set_default ( ARegion * region,
const char * idname )

◆ UI_panel_category_add()

void UI_panel_category_add ( ARegion * region,
const char * name )

Definition at line 2416 of file interface_panel.cc.

References BLI_addtail(), PanelCategoryDyn::idname, and STRNCPY.

Referenced by region_panels_collect_categories().

◆ UI_panel_category_clear_all()

void UI_panel_category_clear_all ( ARegion * region)

Definition at line 2426 of file interface_panel.cc.

References BLI_freelistN().

Referenced by region_panels_collect_categories().

◆ UI_panel_category_draw_all()

void UI_panel_category_draw_all ( ARegion * region,
const char * category_id_active )

Draw vertical tabs on the left side of the region, one tab per category.

Definition at line 1369 of file interface_panel.cc.

References BLF_color3ubv(), BLF_disable(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_enable(), BLF_position(), BLF_ROTATION, BLF_rotation(), BLF_size(), BLF_width(), BLI_assert, BLI_listbase_is_empty(), BLI_rcti_size_y(), clamp_i(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_I32, GPU_FETCH_INT_TO_FLOAT, GPU_line_smooth(), GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), IFACE_, immBindBuiltinProgram(), immRecti(), immUnbindProgram(), immUniformColor3fvAlpha(), immUniformColor3ubv(), immUniformColor4fv(), immUniformColor4ubv(), immVertexFormat(), int, is_left(), LISTBASE_FOREACH, M_PI_2, View2D::mask, max_ii(), uiFontStyle::points, pos, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_RIGHT, RGN_TYPE_HAS_CATEGORY_MASK, round_fl_to_int(), roundboxtype, uiWidgetColors::roundness, STREQ, TABS_PADDING_BETWEEN_FACTOR, TABS_PADDING_TEXT_FACTOR, TH_BACK, TH_TAB_ACTIVE, TH_TAB_BACK, TH_TAB_INACTIVE, TH_TAB_OUTLINE, TH_TEXT, TH_TEXT_HI, bTheme::tui, UI_CNR_BOTTOM_LEFT, UI_CNR_BOTTOM_RIGHT, UI_CNR_TOP_LEFT, UI_CNR_TOP_RIGHT, UI_draw_roundbox_4fv(), UI_draw_roundbox_corner_set(), ui_fontscale(), UI_GetTheme(), UI_GetThemeColor3ubv(), UI_GetThemeColor4fv(), UI_GetThemeColor4ubv(), UI_panel_category_is_visible(), UI_PANEL_CATEGORY_MARGIN_WIDTH, UI_SCALE_FAC, UI_style_get(), uiFontStyle::uifont_id, ThemeUI::wcol_tab, uiStyle::widget, rctf::xmax, rcti::xmax, rctf::xmin, rcti::xmin, rctf::ymax, rcti::ymax, rctf::ymin, and rcti::ymin.

Referenced by ED_region_panels_draw().

◆ UI_panel_category_find()

PanelCategoryDyn * UI_panel_category_find ( const ARegion * region,
const char * idname )

◆ UI_panel_category_index_active_set()

void UI_panel_category_index_active_set ( ARegion * region,
const int index )
Parameters
indexindex of item in ARegion.panels_category list.

Definition at line 2368 of file interface_panel.cc.

References BLI_findlink(), PanelCategoryDyn::idname, and ui_panel_category_active_set().

◆ UI_panel_category_index_find()

int UI_panel_category_index_find ( ARegion * region,
const char * idname )

Definition at line 2312 of file interface_panel.cc.

References BLI_findstringindex(), and offsetof.

◆ UI_panel_category_is_visible()

◆ UI_panel_context_pointer_set()

void UI_panel_context_pointer_set ( Panel * panel,
const char * name,
PointerRNA * ptr )

Set a context for this entire panel and its current layout. This should be used whenever panel callbacks that are called outside of regular drawing might require context. Currently it affects the PanelType.reorder callback only.

Definition at line 2607 of file interface_panel.cc.

References Panel_Runtime::context, Panel::layout, ptr, Panel::runtime, uiLayoutGetContextStore(), and uiLayoutSetContextPointer().

Referenced by draw_constraint_header(), modifier_panel_get_property_pointers(), modifier_panel_header(), and shaderfx_panel_get_property_pointers().

◆ UI_panel_custom_data_get()

◆ UI_panel_custom_data_set()

◆ ui_panel_custom_data_set_recursive()

static void ui_panel_custom_data_set_recursive ( Panel * panel,
PointerRNA * custom_data )
static

◆ ui_panel_drag_collapse()

◆ ui_panel_drag_collapse_handler()

static int ui_panel_drag_collapse_handler ( bContext * C,
const wmEvent * event,
void * userdata )
static

Panel drag-collapse (modal handler). Clicking and dragging over panels toggles their collapse state based on the panel that was first dragged over. If it was open all affected panels including the initial one are closed and vice versa.

Definition at line 2118 of file interface_panel.cc.

References CTX_wm_window(), KM_RELEASE, LEFTMOUSE, wmWindow::modalhandlers, MOUSEMOVE, wmEvent::type, ui_panel_drag_collapse(), ui_panel_drag_collapse_handler(), ui_panel_drag_collapse_handler_remove(), wmEvent::val, WM_event_remove_ui_handler(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_panel_drag_collapse_handler(), and ui_panel_drag_collapse_handler_add().

◆ ui_panel_drag_collapse_handler_add()

◆ ui_panel_drag_collapse_handler_remove()

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

◆ UI_panel_drawname_set()

void UI_panel_drawname_set ( Panel * panel,
blender::StringRef name )

Set the name that should be drawn in the UI. Should be a translated string.

Definition at line 852 of file interface_panel.cc.

References BLI_strdupn(), Panel::drawname, and MEM_SAFE_FREE.

Referenced by file_panel_operator_header(), hud_panel_operator_redo_draw_header(), and UI_panel_begin().

◆ UI_panel_end()

void UI_panel_end ( Panel * panel,
int width,
int height )

Definition at line 844 of file interface_panel.cc.

References Panel::blocksizex, and Panel::blocksizey.

Referenced by ed_panel_draw().

◆ UI_panel_find_by_type()

Panel * UI_panel_find_by_type ( ListBase * lb,
const PanelType * pt )

◆ UI_panel_header_buttons_begin()

void UI_panel_header_buttons_begin ( Panel * panel)

Create the panel header button group, used to mark which buttons are part of panel headers for the panel search process that happens later. This Should be called before adding buttons for the panel's header layout.

Definition at line 754 of file interface_panel.cc.

References Panel_Runtime::block, Panel::runtime, ui_block_new_button_group(), UI_BUTTON_GROUP_LOCK, and UI_BUTTON_GROUP_PANEL_HEADER.

Referenced by ed_panel_draw().

◆ UI_panel_header_buttons_end()

◆ UI_panel_is_active()

◆ UI_panel_is_closed()

◆ UI_panel_is_dragging()

bool UI_panel_is_dragging ( const Panel * panel)

◆ UI_panel_label_offset()

void UI_panel_label_offset ( const uiBlock * block,
int * r_x,
int * r_y )

For button layout next to label.

Definition at line 1032 of file interface_panel.cc.

References uiBlock::panel, PanelType::parent, Panel::type, UI_UNIT_X, and UI_UNIT_Y.

Referenced by ed_panel_draw().

◆ UI_panel_list_matches_data()

bool UI_panel_list_matches_data ( ARegion * region,
ListBase * data,
uiListPanelIDFromDataFunc panel_idname_func )

Check if the instanced panels in the region's panels correspond to the list of data the panels represent. Returns false if the panels have been reordered or if the types from the list data don't match in any way.

Parameters
dataThe list of data to check against the instanced panels.
panel_idname_funcFunction to find the PanelType.idname for each item in the data list. For a readability and generality, this lookup happens separately for each type of panel list.

Definition at line 327 of file interface_panel.cc.

References BLI_listbase_count(), LISTBASE_FOREACH, MAX_NAME, Link::next, PANEL_TYPE_INSTANCED, PNL_INSTANCED_LIST_ORDER_CHANGED, and STREQ.

Referenced by ANIM_fmodifier_panels(), blender::ed::spreadsheet::spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateModifiers(), and uiTemplateShaderFx().

◆ UI_panel_matches_search_filter()

bool UI_panel_matches_search_filter ( const Panel * panel)

Find whether a panel or any of its sub-panels contain a property that matches the search filter, depending on the search process running in UI_block_apply_search_filter earlier.

Definition at line 894 of file interface_panel.cc.

References panel_matches_search_filter_recursive().

Referenced by buttons_main_region_property_search(), panel_draw_aligned_backdrop(), panel_title_color_get(), and UI_panel_is_closed().

◆ ui_panel_mouse_state_get()

◆ UI_panel_should_show_background()

bool UI_panel_should_show_background ( const ARegion * region,
const PanelType * panel_type )

◆ UI_panel_size_y()

int UI_panel_size_y ( const Panel * panel)

Definition at line 1619 of file interface_panel.cc.

References get_panel_real_size_y().

Referenced by ED_region_panels_layout_ex().

◆ ui_panel_tag_search_filter_match()

void ui_panel_tag_search_filter_match ( Panel * panel)

Definition at line 877 of file interface_panel.cc.

References PANEL_SEARCH_FILTER_MATCH, and Panel::runtime_flag.

Referenced by UI_block_apply_search_filter().

◆ UI_panels_begin()

void UI_panels_begin ( const bContext * C,
ARegion * region )

Definition at line 1902 of file interface_panel.cc.

References panels_layout_begin_clear_flags().

Referenced by ED_region_panels_layout_ex().

◆ UI_panels_draw()

void UI_panels_draw ( const bContext * C,
ARegion * region )

Draw panels, selected (panels currently being dragged) on top.

Definition at line 1009 of file interface_panel.cc.

References LISTBASE_FOREACH_BACKWARD, UI_block_draw(), UI_block_is_search_only(), and UI_panel_is_dragging().

Referenced by ED_region_panels_draw().

◆ UI_panels_end()

◆ UI_panels_free_instanced()

void UI_panels_free_instanced ( const bContext * C,
ARegion * region )

Remove instanced panels from the region's panel list.

Note
Can be called with NULL C, but it should be avoided because handlers might not be removed.

Definition at line 306 of file interface_panel.cc.

References LISTBASE_FOREACH_MUTABLE, panel_activate_state(), panel_delete(), PANEL_STATE_EXIT, and PANEL_TYPE_INSTANCED.

Referenced by ANIM_fmodifier_panels(), ED_region_property_search(), blender::ed::spreadsheet::spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateModifiers(), and uiTemplateShaderFx().

◆ ui_panels_size()

static void ui_panels_size ( ARegion * region,
int * r_x,
int * r_y )
static

◆ UI_region_panel_custom_data_under_cursor()

◆ uiAlignPanelStep()