Blender  V3.3
Classes
interface_panel.c File Reference
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "PIL_time.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "RNA_access.h"
#include "BLF_api.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "GPU_batch_presets.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "interface_intern.h"

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 Panel * panel_add_instanced (ARegion *region, ListBase *panels, PanelType *panel_type, PointerRNA *custom_data)
 
Panel * UI_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 (const bContext *C, 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_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)
 
Panel * UI_panel_find_by_type (ListBase *lb, const PanelType *pt)
 
Panel * UI_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)
 
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 *UNUSED(C), ARegion *region)
 
void UI_panels_end (const bContext *C, ARegion *region, int *r_x, int *r_y)
 
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 }
 
enum  uiHandlePanelState { PANEL_STATE_DRAG , PANEL_STATE_ANIMATION , PANEL_STATE_EXIT }
 
typedef enum uiPanelRuntimeFlag uiPanelRuntimeFlag
 
typedef enum uiPanelMouseState uiPanelMouseState
 
typedef enum uiHandlePanelState uiHandlePanelState
 
typedef struct uiHandlePanelData uiHandlePanelData
 
typedef struct PanelSort PanelSort
 
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, 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)
 
static void panel_draw_aligned_backdrop (const Panel *panel, const rcti *rect, const rcti *header_rect)
 
void ui_draw_aligned_panel (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)
 

Region Level Panel Interaction

typedef struct uiPanelDragCollapseHandle uiPanelDragCollapseHandle
 
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 *UNUSED(C), 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)
 
static void ui_panel_drag_collapse_handler_add (const bContext *C, const bool was_open)
 
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)
 
PanelCategoryDyn * UI_panel_category_find (const ARegion *region, const char *idname)
 
PanelCategoryStack * UI_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_active_set_default (ARegion *region, const char *idname)
 
const char * UI_panel_category_active_get (ARegion *region, bool set_fallback)
 
static PanelCategoryDyn * panel_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)
 
PointerRNA * UI_panel_custom_data_get (const Panel *panel)
 
PointerRNA * UI_region_panel_custom_data_under_cursor (const bContext *C, const wmEvent *event)
 
bool UI_panel_can_be_pinned (const Panel *panel)
 

Macro Definition Documentation

◆ ANIMATION_INTERVAL

#define ANIMATION_INTERVAL   0.02

Definition at line 58 of file interface_panel.c.

◆ ANIMATION_TIME

#define ANIMATION_TIME   0.30

Definition at line 57 of file interface_panel.c.

◆ DRAG_REGION_PAD

#define DRAG_REGION_PAD   (PNL_HEADER * 0.5)

Definition at line 1892 of file interface_panel.c.

◆ PNL_ICON

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

Definition at line 1015 of file interface_panel.c.

◆ TABS_PADDING_BETWEEN_FACTOR

#define TABS_PADDING_BETWEEN_FACTOR   4.0f

Definition at line 1297 of file interface_panel.c.

◆ TABS_PADDING_TEXT_FACTOR

#define TABS_PADDING_TEXT_FACTOR   6.0f

Definition at line 1298 of file interface_panel.c.

Typedef Documentation

◆ PanelSort

typedef struct PanelSort PanelSort

◆ uiHandlePanelData

◆ uiHandlePanelState

◆ uiPanelDragCollapseHandle

◆ uiPanelMouseState

◆ uiPanelRuntimeFlag

Enumeration Type Documentation

◆ uiHandlePanelState

Enumerator
PANEL_STATE_DRAG 
PANEL_STATE_ANIMATION 
PANEL_STATE_EXIT 

Definition at line 90 of file interface_panel.c.

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

Definition at line 84 of file interface_panel.c.

◆ 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.c.

Function Documentation

◆ align_sub_panels()

static void align_sub_panels ( Panel *  panel)
static

◆ compare_panel()

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

Definition at line 1620 of file interface_panel.c.

References Freestyle::a, usdtokens::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 1587 of file interface_panel.c.

References Freestyle::a, usdtokens::b(), PanelType::flag, Panel::ofsy, 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 1566 of file interface_panel.c.

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 1537 of file interface_panel.c.

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

Referenced by align_sub_panels().

◆ panel_activate_state()

static void panel_activate_state ( const bContext *  C,
Panel *  panel,
const uiHandlePanelState  state 
)
static

◆ panel_active_animation_changed()

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

◆ panel_add_instanced()

static Panel* panel_add_instanced ( ARegion *  region,
ListBase *  panels,
PanelType *  panel_type,
PointerRNA *  custom_data 
)
static

◆ 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

◆ panel_custom_data_active_get()

static bool panel_custom_data_active_get ( const Panel *  panel)
static

◆ panel_custom_data_active_set()

static void panel_custom_data_active_set ( Panel *  panel)
static

◆ panel_delete()

static void panel_delete ( const bContext *  C,
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 298 of file interface_panel.c.

References Panel::activedata, BLI_freelistN(), BLI_remlink(), C, Panel::children, LISTBASE_FOREACH_MUTABLE, and MEM_freeN.

Referenced by UI_panels_free_instanced().

◆ panel_draw_aligned_backdrop()

static void panel_draw_aligned_backdrop ( const Panel *  panel,
const rcti *  rect,
const rcti *  header_rect 
)
static

◆ panel_draw_aligned_widgets()

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

◆ panel_draw_highlight_border()

static void panel_draw_highlight_border ( const Panel *  panel,
const rcti *  rect,
const rcti *  header_rect 
)
static

◆ panel_handle_data_ensure()

static void panel_handle_data_ensure ( const bContext *  C,
wmWindow *  win,
const ARegion *  region,
Panel *  panel,
const uiHandlePanelState  state 
)
static

◆ 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 926 of file interface_panel.c.

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

Referenced by 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 463 of file interface_panel.c.

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

Referenced by 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 481 of file interface_panel.c.

References BLI_assert, C, PanelType::flag, PanelType::get_list_data_expand_flag, NULL, 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

Set the flag telling the panel to use its search result status for its expansion.

Definition at line 890 of file interface_panel.c.

References C, Panel::children, PanelType::flag, LISTBASE_FOREACH, NULL, PANEL_TYPE_NO_HEADER, PANEL_USE_CLOSED_FROM_SEARCH, Panel::runtime_flag, SET_FLAG_FROM_TEST, and Panel::type.

Referenced by region_panels_set_expansion_from_search_filter().

◆ 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 596 of file interface_panel.c.

References Panel::children, Panel::flag, LISTBASE_FOREACH, and SET_FLAG_FROM_TEST.

Referenced by panel_activate_state(), 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 608 of file interface_panel.c.

References Panel::children, LISTBASE_FOREACH, Panel::runtime_flag, and SET_FLAG_FROM_TEST.

Referenced by panel_activate_state().

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

static void panels_layout_begin_clear_flags ( ListBase *  lb)
static

◆ 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 178 of file interface_panel.c.

References blender::compositor::area(), SpaceProperties::mainb, SpaceProperties::mainbo, ARegion::regiontype, 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 502 of file interface_panel.c.

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

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 910 of file interface_panel.c.

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

static void reorder_instanced_panel_list ( bContext *  C,
ARegion *  region,
Panel *  drag_panel 
)
static

◆ 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 536 of file interface_panel.c.

References C, PanelType::flag, get_panel_expand_flag(), LISTBASE_FOREACH, NULL, 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()

static void ui_do_animate ( bContext *  C,
Panel *  panel 
)
static

◆ 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 uiStyle *  style,
const uiBlock *  block,
const rcti *  rect,
const bool  show_pin,
const bool  show_background,
const bool  region_search_filter_active 
)

◆ ui_handle_panel_category_cycling()

static int ui_handle_panel_category_cycling ( const wmEvent *  event,
ARegion *  region,
const uiBut *  active_but 
)
static

◆ ui_handle_panel_header()

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

◆ ui_handler_panel()

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

◆ ui_handler_panel_region()

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

◆ ui_handler_remove_panel()

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

Definition at line 2517 of file interface_panel.c.

References C, panel_activate_state(), and PANEL_STATE_EXIT.

Referenced by panel_activate_state(), and panel_handle_data_ensure().

◆ UI_list_panel_unique_str()

void UI_list_panel_unique_str ( struct 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 284 of file interface_panel.c.

References INSTANCED_PANEL_UNIQUE_STR_LEN, snprintf, and Panel::sortorder.

Referenced by ED_region_panels_layout_ex().

◆ ui_offset_panel_block()

static void ui_offset_panel_block ( uiBlock *  block)
static

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

Panel* UI_panel_begin ( struct ARegion *  region,
struct ListBase *  lb,
uiBlock *  block,
struct PanelType *  pt,
struct Panel *  panel,
bool *  r_open 
)

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

const char* UI_panel_category_active_get ( ARegion *  region,
bool  set_fallback 
)

◆ UI_panel_category_active_set()

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

◆ ui_panel_category_active_set()

static void ui_panel_category_active_set ( ARegion *  region,
const char *  idname,
bool  fallback 
)
static

◆ 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 2260 of file interface_panel.c.

References BLI_freelistN(), and ARegion::panels_category.

Referenced by region_panels_collect_categories().

◆ UI_panel_category_draw_all()

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

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

Definition at line 1300 of file interface_panel.c.

References ARegion::alignment, BLF_color3ubv(), BLF_disable(), BLF_draw(), BLF_DRAW_STR_DUMMY_MAX, BLF_enable(), BLF_position(), BLF_rotation(), BLF_ROTATION, BLF_size(), BLF_width(), BLF_width_to_strlen(), BLI_assert, BLI_rcti_size_y(), ListBase::first, float(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_I32, GPU_FETCH_INT_TO_FLOAT, GPU_line_smooth(), GPU_SHADER_2D_UNIFORM_COLOR, GPU_vertformat_attr_add(), IFACE_, immBindBuiltinProgram(), immRecti(), immUnbindProgram(), immUniformColor3fvAlpha(), immUniformColor3ubv(), immUniformColor4fv(), immUniformColor4ubv(), immVertexFormat(), is_left(), LISTBASE_FOREACH, M_PI_2, View2D::mask, NULL, ARegion::overlap, ARegion::panels_category, 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, 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_DPI_FAC, 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_style_get(), ARegion::uiblocks, uiFontStyle::uifont_id, ARegion::v2d, ThemeUI::wcol_tab, uiStyle::widget, rcti::xmax, rcti::xmin, rcti::ymax, 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_is_visible()

bool UI_panel_category_is_visible ( const ARegion *  region)

◆ UI_panel_context_pointer_set()

void UI_panel_context_pointer_set ( struct Panel *  panel,
const char *  name,
struct 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 2429 of file interface_panel.c.

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

Referenced by draw_constraint_header(), gpencil_modifier_panel_get_property_pointers(), gpencil_modifier_panel_header(), modifier_panel_get_property_pointers(), 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()

void UI_panel_custom_data_set ( Panel *  panel,
PointerRNA *  custom_data 
)

◆ ui_panel_custom_data_set_recursive()

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

◆ ui_panel_drag_collapse()

static void ui_panel_drag_collapse ( const bContext *  C,
const uiPanelDragCollapseHandle *  dragcol_data,
const int  xy_dst[2] 
)
static

◆ 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 2006 of file interface_panel.c.

References C, CTX_wm_window(), KM_RELEASE, LEFTMOUSE, wmWindow::modalhandlers, MOUSEMOVE, wmEvent::type, ui_panel_drag_collapse(), 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_add().

◆ ui_panel_drag_collapse_handler_add()

static void ui_panel_drag_collapse_handler_add ( const bContext *  C,
const bool  was_open 
)
static

◆ ui_panel_drag_collapse_handler_remove()

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

Definition at line 1950 of file interface_panel.c.

References MEM_freeN.

Referenced by ui_panel_drag_collapse_handler(), and ui_panel_drag_collapse_handler_add().

◆ UI_panel_end()

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

Definition at line 836 of file interface_panel.c.

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

Referenced by ed_panel_draw().

◆ UI_panel_find_by_type()

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

Definition at line 653 of file interface_panel.c.

References PanelType::idname, LISTBASE_FOREACH, NULL, and STREQLEN.

◆ UI_panel_header_buttons_begin()

void UI_panel_header_buttons_begin ( struct 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 744 of file interface_panel.c.

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

void UI_panel_header_buttons_end ( struct Panel *  panel)

◆ UI_panel_is_active()

bool UI_panel_is_active ( const Panel *  panel)

◆ UI_panel_is_closed()

bool UI_panel_is_closed ( const Panel *  panel)

◆ UI_panel_is_dragging()

bool UI_panel_is_dragging ( const Panel *  panel)

Definition at line 1574 of file interface_panel.c.

References PANEL_IS_DRAG_DROP, and Panel::runtime_flag.

Referenced by ui_do_animate(), and UI_panels_draw().

◆ UI_panel_label_offset()

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

Definition at line 1017 of file interface_panel.c.

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

◆ UI_panel_list_matches_data()

bool UI_panel_list_matches_data ( struct ARegion *  region,
struct 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 334 of file interface_panel.c.

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

Referenced by ANIM_fmodifier_panels(), spreadsheet_row_filters_layout(), uiTemplateConstraints(), uiTemplateGpencilModifiers(), uiTemplateModifiers(), and uiTemplateShaderFx().

◆ UI_panel_matches_search_filter()

bool UI_panel_matches_search_filter ( const Panel *  panel)

◆ ui_panel_mouse_state_get()

static uiPanelMouseState ui_panel_mouse_state_get ( const uiBlock *  block,
const Panel *  panel,
const int  mx,
const int  my 
)
static

◆ 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 1557 of file interface_panel.c.

References get_panel_real_size_y().

◆ ui_panel_tag_search_filter_match()

void ui_panel_tag_search_filter_match ( Panel *  panel)

Definition at line 863 of file interface_panel.c.

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 *  UNUSEDC,
ARegion *  region 
)

Definition at line 1830 of file interface_panel.c.

References ARegion::panels, and panels_layout_begin_clear_flags().

◆ UI_panels_draw()

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

◆ UI_panels_end()

void UI_panels_end ( const bContext *  C,
ARegion *  region,
int *  r_x,
int *  r_y 
)

◆ UI_panels_free_instanced()

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

◆ ui_panels_size()

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

◆ UI_region_panel_custom_data_under_cursor()

PointerRNA* UI_region_panel_custom_data_under_cursor ( const bContext *  C,
const wmEvent *  event 
)

◆ uiAlignPanelStep()

static bool uiAlignPanelStep ( ARegion *  region,
const float  factor,
const bool  drag 
)
static