Blender V5.0
interface_panel.cc File Reference
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_string.h"
#include "BLI_string_utf8.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_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

static int ui_panel_category_show_active_tab (ARegion *region, const int mval[2])
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)
static void ui_panel_region_width_set (ARegion *region, const float aspect, int unscaled_size)
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)
void UI_panel_stop_animation (const bContext *C, Panel *panel)

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_border (const Panel *panel, const rcti *rect, const rcti *header_rect, const bool is_active)
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_softshadow (const rctf *box_rect, const int roundboxalign, const float radius, const float shadow_width)
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 61 of file interface_panel.cc.

Referenced by panel_handle_data_ensure().

◆ ANIMATION_TIME

#define ANIMATION_TIME   0.30

Definition at line 60 of file interface_panel.cc.

Referenced by ui_do_animate().

◆ DRAG_REGION_PAD

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)

Definition at line 2059 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 1035 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 1404 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 1405 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 94 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 87 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 63 of file interface_panel.cc.

Function Documentation

◆ align_sub_panels()

◆ compare_panel()

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

Definition at line 1783 of file interface_panel.cc.

References b, and Panel::sortorder.

Referenced by reorder_instanced_panel_list(), and uiAlignPanelStep().

◆ find_highest_panel()

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 1741 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()

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

◆ get_panel_real_ofsy()

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 1720 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()

int get_panel_real_size_y ( const Panel * panel)
static

◆ get_panel_size_y()

int get_panel_size_y ( const Panel * panel)
static

Definition at line 1691 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()

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

◆ panel_add_instanced()

◆ panel_calculate_size_recursive()

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

◆ panel_categories_find_mouse_over()

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

◆ panel_custom_data_active_get()

bool panel_custom_data_active_get ( const Panel * panel)
static

◆ panel_custom_data_active_set()

◆ panel_custom_pin_to_last_get()

bool panel_custom_pin_to_last_get ( const Panel * panel)
static

◆ panel_custom_pin_to_last_set()

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

◆ panel_delete()

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 295 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_border()

◆ panel_draw_softshadow()

void panel_draw_softshadow ( const rctf * box_rect,
const int roundboxalign,
const float radius,
const float shadow_width )
static

◆ panel_handle_data_ensure()

◆ panel_matches_search_filter_recursive()

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

◆ panel_region_offset_x_get()

◆ panel_remove_invisible_layouts_recursive()

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

◆ panel_set_expand_from_list_data_recursive()

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 462 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()

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 480 of file interface_panel.cc.

References BLI_assert, C, 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()

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

◆ panel_set_flag_recursive()

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 619 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()

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 631 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()

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()

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

◆ panels_collapse_all()

◆ panels_layout_begin_clear_flags()

◆ panels_need_realign()

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

◆ properties_space_needs_realign()

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 182 of file interface_panel.cc.

References ListBase::first, SpaceProperties::mainb, SpaceProperties::mainbo, ARegion::regiontype, RGN_TYPE_WINDOW, SPACE_PROPERTIES, ScrArea::spacedata, and ScrArea::spacetype.

Referenced by panels_need_realign(), and UI_panels_end().

◆ region_panels_remove_invisible_layouts()

void region_panels_remove_invisible_layouts ( ARegion * region)
static

◆ region_panels_set_expansion_from_list_data()

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 501 of file interface_panel.cc.

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

Referenced by UI_panels_end().

◆ region_panels_set_expansion_from_search_filter()

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 929 of file interface_panel.cc.

References C, LISTBASE_FOREACH, panel_set_expansion_from_search_filter_recursive(), ARegion::panels, and set_panels_list_data_expand_flag().

Referenced by UI_panels_end().

◆ reorder_instanced_panel_list()

◆ set_panels_list_data_expand_flag()

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 535 of file interface_panel.cc.

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

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

◆ ui_do_animate()

◆ ui_do_drag()

◆ 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()

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()

int ui_handler_panel_region ( bContext * C,
const wmEvent * event,
ARegion * region,
const uiBut * active_but )

Handle region panel events like opening and closing panels, changing categories, etc.

Note
Could become a modal key-map.

Definition at line 2600 of file interface_panel.cc.

References BLI_rctf_size_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), C, View2D::cur, ED_region_tag_redraw(), ELEM, EVT_AKEY, EVT_PADENTER, EVT_PADPERIOD, EVT_RETKEY, EVT_TABKEY, Panel::flag, PanelType::flag, PanelCategoryDyn::idname, ISMOUSE_MOTION, KM_CTRL, KM_PRESS, KM_SHIFT, Label, LEFTMOUSE, LISTBASE_FOREACH, View2D::mask, wmEvent::modifier, NA_EDITED, NC_SCREEN, panel_categories_find_mouse_over(), PANEL_MOUSE_INSIDE_HEADER, PANEL_MOUSE_INSIDE_LAYOUT_PANEL_HEADER, PANEL_MOUSE_OUTSIDE, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, PNL_CLOSED, RIGHTMOUSE, ARegion::runtime, Panel::runtime_flag, SET_FLAG_FROM_TEST, STREQ, Panel::type, uiBut::type, wmEvent::type, ui_handle_layout_panel_header(), ui_handle_panel_category_cycling(), ui_handle_panel_header(), UI_panel_category_active_get(), UI_panel_category_active_set(), UI_panel_category_is_visible(), UI_PANEL_CATEGORY_MIN_WIDTH, ui_panel_category_show_active_tab(), UI_panel_is_closed(), ui_panel_mouse_state_get(), ui_panel_region_width_set(), ui_popup_context_menu_for_panel(), ui_region_find_active_but(), UI_SCALE_FAC, UI_view2d_mouse_in_scrollers(), UI_view2d_offset(), ui_window_to_block(), ARegion::v2d, wmEvent::val, WHEELDOWNMOUSE, WHEELUPMOUSE, ARegion::winrct, WM_event_add_notifier(), WM_UI_HANDLER_BREAK, WM_UI_HANDLER_CONTINUE, and wmEvent::xy.

Referenced by ui_region_handler().

◆ ui_handler_remove_panel()

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

Definition at line 2832 of file interface_panel.cc.

References C, 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 281 of file interface_panel.cc.

References BLI_snprintf_utf8(), 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 )

◆ 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 )

◆ UI_panel_category_clear_all()

void UI_panel_category_clear_all ( ARegion * region)

Definition at line 2520 of file interface_panel.cc.

References BLI_freelistN(), and ARegion::runtime.

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 1407 of file interface_panel.cc.

References ARegion::alignment, BLF_color3ubv(), BLF_disable(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_enable(), BLF_position(), BLF_ROTATION, BLF_rotation(), BLF_SHADOW, BLF_shadow(), BLF_shadow_offset(), BLF_size(), BLF_width(), BLI_assert, BLI_listbase_is_empty(), BLI_rcti_size_x(), BLI_rcti_size_y(), ARegion::category_scroll, clamp_i(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_line_smooth(), GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), IFACE_, immBindBuiltinProgram(), immRectf(), immUnbindProgram(), immUniformColor3fvAlpha(), immUniformColor3ubv(), immUniformColor4fv(), immUniformColor4ubv(), immVertexFormat(), is_left(), LISTBASE_FOREACH, M_PI_2, View2D::mask, max_ii(), ARegion::overlap, uiFontStyle::points, pos, ARegion::regiontype, RGN_ALIGN_ENUM_FROM_MASK, RGN_ALIGN_RIGHT, RGN_TYPE_HAS_CATEGORY_MASK, round_fl_to_int(), roundboxtype, uiWidgetColors::roundness, ARegion::runtime, uiFontStyle::shadow, uiFontStyle::shadowalpha, uiFontStyle::shadowcolor, uiFontStyle::shadx, uiFontStyle::shady, STREQ, TABS_PADDING_BETWEEN_FACTOR, TABS_PADDING_TEXT_FACTOR, TH_BACK, TH_TAB_ACTIVE, TH_TAB_BACK, TH_TAB_INACTIVE, TH_TAB_OUTLINE, TH_TAB_OUTLINE_ACTIVE, TH_TAB_TEXT, TH_TAB_TEXT_HI, bTheme::tui, U, UI_CNR_ALL, 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_fontstyle_set(), UI_GetTheme(), UI_GetThemeColor3ubv(), UI_GetThemeColor4fv(), UI_GetThemeColor4ubv(), UI_panel_category_is_visible(), UI_PANEL_CATEGORY_MARGIN_WIDTH, UI_PANEL_CATEGORY_MIN_WIDTH, UI_SCALE_FAC, UI_style_get(), uiFontStyle::uifont_id, ARegion::v2d, ThemeUI::wcol_tab, uiStyle::widget, ARegion::winrct, 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 2461 of file interface_panel.cc.

References BLI_findlink(), PanelCategoryDyn::idname, ARegion::runtime, 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 2404 of file interface_panel.cc.

References BLI_findstringindex(), offsetof, and ARegion::runtime.

◆ UI_panel_category_is_visible()

◆ ui_panel_category_show_active_tab()

◆ 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 2743 of file interface_panel.cc.

References Panel_Runtime::context, uiLayout::context_ptr_set(), uiLayout::context_store(), Panel::layout, name, ptr, and Panel::runtime.

Referenced by draw_constraint_header(), modifier_panel_get_property_pointers(), blender::seq::modifier_panel_header(), modifier_panel_header(), and shaderfx_panel_get_property_pointers().

◆ UI_panel_custom_data_get()

PointerRNA * UI_panel_custom_data_get ( const Panel * panel)

◆ UI_panel_custom_data_set()

◆ ui_panel_custom_data_set_recursive()

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

◆ ui_panel_drag_collapse()

◆ ui_panel_drag_collapse_handler()

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 2209 of file interface_panel.cc.

References C, 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()

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 857 of file interface_panel.cc.

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

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 849 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 759 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 1037 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 332 of file interface_panel.cc.

References BLI_listbase_count(), data, i, LISTBASE_FOREACH, MAX_NAME, Link::next, PANEL_TYPE_INSTANCED, ARegion::panels, PNL_INSTANCED_LIST_ORDER_CHANGED, and STREQ.

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

◆ 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 899 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_region_width_set()

void ui_panel_region_width_set ( ARegion * region,
const float aspect,
int unscaled_size )
static

◆ UI_panel_should_show_background()

◆ UI_panel_size_y()

int UI_panel_size_y ( const Panel * panel)

Definition at line 1711 of file interface_panel.cc.

References get_panel_real_size_y().

Referenced by ED_region_panels_layout_ex().

◆ UI_panel_stop_animation()

void UI_panel_stop_animation ( const bContext * C,
Panel * panel )

Definition at line 2927 of file interface_panel.cc.

References Panel::activedata, C, panel_activate_state(), and PANEL_STATE_EXIT.

Referenced by ED_region_exit().

◆ ui_panel_tag_search_filter_match()

void ui_panel_tag_search_filter_match ( Panel * panel)

Definition at line 882 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 1993 of file interface_panel.cc.

References ARegion::panels, and 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 1014 of file interface_panel.cc.

References C, LISTBASE_FOREACH_BACKWARD, ARegion::runtime, 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 307 of file interface_panel.cc.

References C, LISTBASE_FOREACH_MUTABLE, panel_activate_state(), panel_delete(), PANEL_STATE_EXIT, PANEL_TYPE_INSTANCED, and ARegion::panels.

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

◆ ui_panels_size()

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

◆ UI_region_panel_custom_data_under_cursor()

◆ uiAlignPanelStep()