Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/include/UI_interface.h
| Show First 20 Lines • Show All 445 Lines • ▼ Show 20 Lines | |||||
| #if 0 /* unused */ | #if 0 /* unused */ | ||||
| int UI_draw_roundbox_corner_get(void); | int UI_draw_roundbox_corner_get(void); | ||||
| #endif | #endif | ||||
| void UI_draw_box_shadow(const struct rctf *rect, unsigned char alpha); | void UI_draw_box_shadow(const struct rctf *rect, unsigned char alpha); | ||||
| void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]); | void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]); | ||||
| /** | |||||
| * Draw title and text safe areas. | |||||
| * | |||||
| * \note This function is to be used with the 2D dashed shader enabled. | |||||
| * | |||||
| * \param pos: is a #PRIM_FLOAT, 2, #GPU_FETCH_FLOAT vertex attribute. | |||||
| * \param x1, x2, y1, y2: The offsets for the view, not the zones. | |||||
| */ | |||||
| void UI_draw_safe_areas(uint pos, | void UI_draw_safe_areas(uint pos, | ||||
| const struct rctf *rect, | const struct rctf *rect, | ||||
| const float title_aspect[2], | const float title_aspect[2], | ||||
| const float action_aspect[2]); | const float action_aspect[2]); | ||||
| /** State for scrolldrawing. */ | /** State for scrolldrawing. */ | ||||
| enum { | enum { | ||||
| UI_SCROLL_PRESSED = 1 << 0, | UI_SCROLL_PRESSED = 1 << 0, | ||||
| UI_SCROLL_ARROWS = 1 << 1, | UI_SCROLL_ARROWS = 1 << 1, | ||||
| UI_SCROLL_NO_OUTLINE = 1 << 2, | UI_SCROLL_NO_OUTLINE = 1 << 2, | ||||
| }; | }; | ||||
| /** | |||||
| * Function in use for buttons and for view2d sliders. | |||||
| */ | |||||
| void UI_draw_widget_scroll(struct uiWidgetColors *wcol, | void UI_draw_widget_scroll(struct uiWidgetColors *wcol, | ||||
| const struct rcti *rect, | const struct rcti *rect, | ||||
| const struct rcti *slider, | const struct rcti *slider, | ||||
| int state); | int state); | ||||
| /* Shortening string helper. */ | /** | ||||
| * Shortening string helper. | |||||
| * | |||||
| * Cut off the middle of the text to fit into the given width. | |||||
| * | |||||
| * \note in case this middle clipping would just remove a few chars, | |||||
| * it rather clips right, which is more readable. | |||||
| * | |||||
| * If rpart_sep is not Null, the part of str starting to first occurrence of rpart_sep | |||||
| * is preserved at all cost. | |||||
| * Useful for strings with shortcuts | |||||
| * (like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O'). | |||||
| */ | |||||
| float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, | float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, | ||||
| char *str, | char *str, | ||||
| float okwidth, | float okwidth, | ||||
| const float minwidth, | const float minwidth, | ||||
| const size_t max_len, | const size_t max_len, | ||||
| const char rpart_sep); | const char rpart_sep); | ||||
| /** | /** | ||||
| Show All 19 Lines | |||||
| typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); | typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); | ||||
| typedef void (*uiButHandleHoldFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); | typedef void (*uiButHandleHoldFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); | ||||
| typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); | typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); | ||||
| /* Search types. */ | /* Search types. */ | ||||
| typedef struct ARegion *(*uiButSearchCreateFn)(struct bContext *C, | typedef struct ARegion *(*uiButSearchCreateFn)(struct bContext *C, | ||||
| struct ARegion *butregion, | struct ARegion *butregion, | ||||
| struct uiButSearch *search_but); | struct uiButSearch *search_but); | ||||
| /* `is_first` is typically used to ignore search filtering when the menu is first opened in order | /** | ||||
| * `is_first` is typically used to ignore search filtering when the menu is first opened in order | |||||
| * to display the full list of options. The value will be false after the button's text is edited | * to display the full list of options. The value will be false after the button's text is edited | ||||
| * (for every call except the first). */ | * (for every call except the first). | ||||
| */ | |||||
| typedef void (*uiButSearchUpdateFn)(const struct bContext *C, | typedef void (*uiButSearchUpdateFn)(const struct bContext *C, | ||||
| void *arg, | void *arg, | ||||
| const char *str, | const char *str, | ||||
| uiSearchItems *items, | uiSearchItems *items, | ||||
| const bool is_first); | const bool is_first); | ||||
| typedef bool (*uiButSearchContextMenuFn)(struct bContext *C, | typedef bool (*uiButSearchContextMenuFn)(struct bContext *C, | ||||
| void *arg, | void *arg, | ||||
| void *active, | void *active, | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1); | typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1); | ||||
| typedef void (*uiFreeArgFunc)(void *arg); | typedef void (*uiFreeArgFunc)(void *arg); | ||||
| /* interface_query.c */ | /* interface_query.c */ | ||||
| bool UI_but_has_tooltip_label(const uiBut *but); | bool UI_but_has_tooltip_label(const uiBut *but); | ||||
| bool UI_but_is_tool(const uiBut *but); | bool UI_but_is_tool(const uiBut *but); | ||||
| /* file selectors are exempt from utf-8 checks */ | |||||
| bool UI_but_is_utf8(const uiBut *but); | bool UI_but_is_utf8(const uiBut *but); | ||||
| #define UI_but_is_decorator(but) ((but)->type == UI_BTYPE_DECORATOR) | #define UI_but_is_decorator(but) ((but)->type == UI_BTYPE_DECORATOR) | ||||
| bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title); | bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title); | ||||
| bool UI_block_is_empty(const uiBlock *block); | bool UI_block_is_empty(const uiBlock *block); | ||||
| bool UI_block_can_add_separator(const uiBlock *block); | bool UI_block_can_add_separator(const uiBlock *block); | ||||
| struct uiList *UI_list_find_mouse_over(const struct ARegion *region, const struct wmEvent *event); | struct uiList *UI_list_find_mouse_over(const struct ARegion *region, const struct wmEvent *event); | ||||
| /* interface_region_menu_popup.c */ | /* interface_region_menu_popup.c */ | ||||
| /** | /** | ||||
| * Popup Menus | * Popup Menus | ||||
| * | * | ||||
| * Functions used to create popup menus. For more extended menus the | * Functions used to create popup menus. For more extended menus the | ||||
| * UI_popup_menu_begin/End functions can be used to define own items with | * UI_popup_menu_begin/End functions can be used to define own items with | ||||
| * the uiItem functions in between. If it is a simple confirmation menu | * the uiItem functions in between. If it is a simple confirmation menu | ||||
| * or similar, popups can be created with a single function call. | * or similar, popups can be created with a single function call. | ||||
| */ | */ | ||||
| typedef struct uiPopupMenu uiPopupMenu; | typedef struct uiPopupMenu uiPopupMenu; | ||||
| uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); | uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); | ||||
| /** | |||||
| * Only return handler, and set optional title. | |||||
| * \param block_name: Assigned to uiBlock.name (useful info for debugging). | |||||
| */ | |||||
| uiPopupMenu *UI_popup_menu_begin_ex(struct bContext *C, | uiPopupMenu *UI_popup_menu_begin_ex(struct bContext *C, | ||||
| const char *title, | const char *title, | ||||
| const char *block_name, | const char *block_name, | ||||
| int icon) ATTR_NONNULL(); | int icon) ATTR_NONNULL(); | ||||
| /** | |||||
| * Set the whole structure to work. | |||||
| */ | |||||
| void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup); | void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup); | ||||
| bool UI_popup_menu_end_or_cancel(struct bContext *C, struct uiPopupMenu *head); | bool UI_popup_menu_end_or_cancel(struct bContext *C, struct uiPopupMenu *head); | ||||
| struct uiLayout *UI_popup_menu_layout(uiPopupMenu *pup); | struct uiLayout *UI_popup_menu_layout(uiPopupMenu *pup); | ||||
| void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL(); | void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL(); | ||||
| int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) | int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) | ||||
| ATTR_NONNULL(1, 2); | ATTR_NONNULL(1, 2); | ||||
| /** | |||||
| * Allow setting menu return value from externals. | |||||
| * E.g. WM might need to do this for exiting files correctly. | |||||
| */ | |||||
| void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); | void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); | ||||
| /** | |||||
| * Setting the button makes the popup open from the button instead of the cursor. | |||||
| */ | |||||
| void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but); | void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but); | ||||
| /* interface_region_popover.c */ | /* interface_region_popover.c */ | ||||
| typedef struct uiPopover uiPopover; | typedef struct uiPopover uiPopover; | ||||
| int UI_popover_panel_invoke(struct bContext *C, | int UI_popover_panel_invoke(struct bContext *C, | ||||
| const char *idname, | const char *idname, | ||||
| bool keep_open, | bool keep_open, | ||||
| struct ReportList *reports); | struct ReportList *reports); | ||||
| /** | |||||
| * Only return handler, and set optional title. | |||||
| * | |||||
| * \param from_active_button: Use the active button for positioning, | |||||
| * use when the popover is activated from an operator instead of directly from the button. | |||||
| */ | |||||
| uiPopover *UI_popover_begin(struct bContext *C, int menu_width, bool from_active_button) | uiPopover *UI_popover_begin(struct bContext *C, int menu_width, bool from_active_button) | ||||
| ATTR_NONNULL(1); | ATTR_NONNULL(1); | ||||
| /** | |||||
| * Set the whole structure to work. | |||||
| */ | |||||
| void UI_popover_end(struct bContext *C, struct uiPopover *pup, struct wmKeyMap *keymap); | void UI_popover_end(struct bContext *C, struct uiPopover *pup, struct wmKeyMap *keymap); | ||||
| struct uiLayout *UI_popover_layout(uiPopover *pup); | struct uiLayout *UI_popover_layout(uiPopover *pup); | ||||
| void UI_popover_once_clear(uiPopover *pup); | void UI_popover_once_clear(uiPopover *pup); | ||||
| /* interface_region_menu_pie.c */ | /* interface_region_menu_pie.c */ | ||||
| /* Pie menus */ | /* Pie menus */ | ||||
| typedef struct uiPieMenu uiPieMenu; | typedef struct uiPieMenu uiPieMenu; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| uiBlock *UI_block_begin(const struct bContext *C, | uiBlock *UI_block_begin(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| const char *name, | const char *name, | ||||
| eUIEmbossType emboss); | eUIEmbossType emboss); | ||||
| void UI_block_end_ex(const struct bContext *C, uiBlock *block, const int xy[2], int r_xy[2]); | void UI_block_end_ex(const struct bContext *C, uiBlock *block, const int xy[2], int r_xy[2]); | ||||
| void UI_block_end(const struct bContext *C, uiBlock *block); | void UI_block_end(const struct bContext *C, uiBlock *block); | ||||
| /** | |||||
| * Uses local copy of style, to scale things down, and allow widgets to change stuff. | |||||
| */ | |||||
| void UI_block_draw(const struct bContext *C, struct uiBlock *block); | void UI_block_draw(const struct bContext *C, struct uiBlock *block); | ||||
| void UI_blocklist_update_window_matrix(const struct bContext *C, const struct ListBase *lb); | void UI_blocklist_update_window_matrix(const struct bContext *C, const struct ListBase *lb); | ||||
| void UI_blocklist_update_view_for_buttons(const struct bContext *C, const struct ListBase *lb); | void UI_blocklist_update_view_for_buttons(const struct bContext *C, const struct ListBase *lb); | ||||
| void UI_blocklist_draw(const struct bContext *C, const struct ListBase *lb); | void UI_blocklist_draw(const struct bContext *C, const struct ListBase *lb); | ||||
| void UI_block_update_from_old(const struct bContext *C, struct uiBlock *block); | void UI_block_update_from_old(const struct bContext *C, struct uiBlock *block); | ||||
| enum { | enum { | ||||
| UI_BLOCK_THEME_STYLE_REGULAR = 0, | UI_BLOCK_THEME_STYLE_REGULAR = 0, | ||||
| UI_BLOCK_THEME_STYLE_POPUP = 1, | UI_BLOCK_THEME_STYLE_POPUP = 1, | ||||
| }; | }; | ||||
| void UI_block_theme_style_set(uiBlock *block, char theme_style); | void UI_block_theme_style_set(uiBlock *block, char theme_style); | ||||
| eUIEmbossType UI_block_emboss_get(uiBlock *block); | eUIEmbossType UI_block_emboss_get(uiBlock *block); | ||||
| void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss); | void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss); | ||||
| bool UI_block_is_search_only(const uiBlock *block); | bool UI_block_is_search_only(const uiBlock *block); | ||||
| /** | |||||
| * Use when a block must be searched to give accurate results | |||||
| * for the whole region but shouldn't be displayed. | |||||
| */ | |||||
| void UI_block_set_search_only(uiBlock *block, bool search_only); | void UI_block_set_search_only(uiBlock *block, bool search_only); | ||||
| /** | |||||
| * Can be called with C==NULL. | |||||
| */ | |||||
| void UI_block_free(const struct bContext *C, uiBlock *block); | void UI_block_free(const struct bContext *C, uiBlock *block); | ||||
| /** | |||||
| * Can be called with C==NULL. | |||||
| */ | |||||
| void UI_blocklist_free(const struct bContext *C, struct ARegion *region); | void UI_blocklist_free(const struct bContext *C, struct ARegion *region); | ||||
| void UI_blocklist_free_inactive(const struct bContext *C, struct ARegion *region); | void UI_blocklist_free_inactive(const struct bContext *C, struct ARegion *region); | ||||
| /** | |||||
| * Is called by notifier. | |||||
| */ | |||||
| void UI_screen_free_active_but_highlight(const struct bContext *C, struct bScreen *screen); | void UI_screen_free_active_but_highlight(const struct bContext *C, struct bScreen *screen); | ||||
| void UI_region_free_active_but_all(struct bContext *context, struct ARegion *region); | void UI_region_free_active_but_all(struct bContext *context, struct ARegion *region); | ||||
| void UI_block_region_set(uiBlock *block, struct ARegion *region); | void UI_block_region_set(uiBlock *block, struct ARegion *region); | ||||
| void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr); | void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr); | ||||
| void UI_block_lock_clear(uiBlock *block); | void UI_block_lock_clear(uiBlock *block); | ||||
| /* Automatic aligning, horizontal or vertical. */ | /** | ||||
| * Automatic aligning, horizontal or vertical. | |||||
| */ | |||||
| void UI_block_align_begin(uiBlock *block); | void UI_block_align_begin(uiBlock *block); | ||||
| void UI_block_align_end(uiBlock *block); | void UI_block_align_end(uiBlock *block); | ||||
| /* block bounds/position calculation */ | /* block bounds/position calculation */ | ||||
| typedef enum { | typedef enum { | ||||
| UI_BLOCK_BOUNDS_NONE = 0, | UI_BLOCK_BOUNDS_NONE = 0, | ||||
| UI_BLOCK_BOUNDS = 1, | UI_BLOCK_BOUNDS = 1, | ||||
| UI_BLOCK_BOUNDS_TEXT, | UI_BLOCK_BOUNDS_TEXT, | ||||
| UI_BLOCK_BOUNDS_POPUP_MOUSE, | UI_BLOCK_BOUNDS_POPUP_MOUSE, | ||||
| UI_BLOCK_BOUNDS_POPUP_MENU, | UI_BLOCK_BOUNDS_POPUP_MENU, | ||||
| UI_BLOCK_BOUNDS_POPUP_CENTER, | UI_BLOCK_BOUNDS_POPUP_CENTER, | ||||
| UI_BLOCK_BOUNDS_PIE_CENTER, | UI_BLOCK_BOUNDS_PIE_CENTER, | ||||
| } eBlockBoundsCalc; | } eBlockBoundsCalc; | ||||
| /** | |||||
| * Used for various cases. | |||||
| */ | |||||
| void UI_block_bounds_set_normal(struct uiBlock *block, int addval); | void UI_block_bounds_set_normal(struct uiBlock *block, int addval); | ||||
| /** | |||||
| * Used for pull-downs. | |||||
| */ | |||||
| void UI_block_bounds_set_text(uiBlock *block, int addval); | void UI_block_bounds_set_text(uiBlock *block, int addval); | ||||
| /** | |||||
| * Used for block popups. | |||||
| */ | |||||
| void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]); | void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]); | ||||
| /** | |||||
| * Used for menu popups. | |||||
| */ | |||||
| void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]); | void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]); | ||||
| /** | |||||
| * Used for centered popups, i.e. splash. | |||||
| */ | |||||
| void UI_block_bounds_set_centered(uiBlock *block, int addval); | void UI_block_bounds_set_centered(uiBlock *block, int addval); | ||||
| void UI_block_bounds_set_explicit(uiBlock *block, int minx, int miny, int maxx, int maxy); | void UI_block_bounds_set_explicit(uiBlock *block, int minx, int miny, int maxx, int maxy); | ||||
| int UI_blocklist_min_y_get(struct ListBase *lb); | int UI_blocklist_min_y_get(struct ListBase *lb); | ||||
| void UI_block_direction_set(uiBlock *block, char direction); | void UI_block_direction_set(uiBlock *block, char direction); | ||||
| /** | |||||
| * This call escapes if there's alignment flags. | |||||
| */ | |||||
| void UI_block_order_flip(uiBlock *block); | void UI_block_order_flip(uiBlock *block); | ||||
| void UI_block_flag_enable(uiBlock *block, int flag); | void UI_block_flag_enable(uiBlock *block, int flag); | ||||
| void UI_block_flag_disable(uiBlock *block, int flag); | void UI_block_flag_disable(uiBlock *block, int flag); | ||||
| void UI_block_translate(uiBlock *block, int x, int y); | void UI_block_translate(uiBlock *block, int x, int y); | ||||
| int UI_but_return_value_get(uiBut *but); | int UI_but_return_value_get(uiBut *but); | ||||
| void UI_but_drag_set_id(uiBut *but, struct ID *id); | void UI_but_drag_set_id(uiBut *but, struct ID *id); | ||||
| /** | |||||
| * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`). | |||||
| * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image. | |||||
| */ | |||||
| void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale); | void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale); | ||||
| /** | |||||
| * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. | |||||
| */ | |||||
| void UI_but_drag_set_asset(uiBut *but, | void UI_but_drag_set_asset(uiBut *but, | ||||
| const struct AssetHandle *asset, | const struct AssetHandle *asset, | ||||
| const char *path, | const char *path, | ||||
| struct AssetMetaData *metadata, | struct AssetMetaData *metadata, | ||||
| int import_type, /* eFileAssetImportType */ | int import_type, /* eFileAssetImportType */ | ||||
| int icon, | int icon, | ||||
| struct ImBuf *imb, | struct ImBuf *imb, | ||||
| float scale); | float scale); | ||||
| void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); | void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); | ||||
| void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); | void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); | ||||
| void UI_but_drag_set_name(uiBut *but, const char *name); | void UI_but_drag_set_name(uiBut *but, const char *name); | ||||
| /** | |||||
| * Value from button itself. | |||||
| */ | |||||
| void UI_but_drag_set_value(uiBut *but); | void UI_but_drag_set_value(uiBut *but); | ||||
| void UI_but_drag_set_image( | void UI_but_drag_set_image( | ||||
| uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, const bool use_free); | uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, const bool use_free); | ||||
| uiBut *UI_but_active_drop_name_button(const struct bContext *C); | uiBut *UI_but_active_drop_name_button(const struct bContext *C); | ||||
| /** | |||||
| * Returns true if highlighted button allows drop of names. | |||||
| * called in region context. | |||||
| */ | |||||
| bool UI_but_active_drop_name(const struct bContext *C); | bool UI_but_active_drop_name(const struct bContext *C); | ||||
| bool UI_but_active_drop_color(struct bContext *C); | bool UI_but_active_drop_color(struct bContext *C); | ||||
| void UI_but_flag_enable(uiBut *but, int flag); | void UI_but_flag_enable(uiBut *but, int flag); | ||||
| void UI_but_flag_disable(uiBut *but, int flag); | void UI_but_flag_disable(uiBut *but, int flag); | ||||
| bool UI_but_flag_is_set(uiBut *but, int flag); | bool UI_but_flag_is_set(uiBut *but, int flag); | ||||
| void UI_but_drawflag_enable(uiBut *but, int flag); | void UI_but_drawflag_enable(uiBut *but, int flag); | ||||
| void UI_but_drawflag_disable(uiBut *but, int flag); | void UI_but_drawflag_disable(uiBut *but, int flag); | ||||
| void UI_but_disable(uiBut *but, const char *disabled_hint); | void UI_but_disable(uiBut *but, const char *disabled_hint); | ||||
| void UI_but_type_set_menu_from_pulldown(uiBut *but); | void UI_but_type_set_menu_from_pulldown(uiBut *but); | ||||
| /* special button case, only draw it when used actively, for outliner etc */ | /** | ||||
| * Special button case, only draw it when used actively, for outliner etc. | |||||
| * | |||||
| * Needed for temporarily rename buttons, such as in outliner or file-select, | |||||
| * they should keep calling #uiDefBut to keep them alive. | |||||
| * \return false when button removed. | |||||
| */ | |||||
| bool UI_but_active_only_ex(const struct bContext *C, | bool UI_but_active_only_ex(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| uiBlock *block, | uiBlock *block, | ||||
| uiBut *but, | uiBut *but, | ||||
| const bool remove_on_failure); | const bool remove_on_failure); | ||||
| bool UI_but_active_only(const struct bContext *C, | bool UI_but_active_only(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| uiBlock *block, | uiBlock *block, | ||||
| uiBut *but); | uiBut *but); | ||||
| /** | |||||
| * \warning This must run after other handlers have been added, | |||||
| * otherwise the handler won't be removed, see: T71112. | |||||
| */ | |||||
| bool UI_block_active_only_flagged_buttons(const struct bContext *C, | bool UI_block_active_only_flagged_buttons(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| struct uiBlock *block); | struct uiBlock *block); | ||||
| /** | |||||
| * Simulate button click. | |||||
| */ | |||||
| void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but); | void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but); | ||||
| bool UI_but_online_manual_id(const uiBut *but, | bool UI_but_online_manual_id(const uiBut *but, | ||||
| char *r_str, | char *r_str, | ||||
| size_t maxlength) ATTR_WARN_UNUSED_RESULT; | size_t maxlength) ATTR_WARN_UNUSED_RESULT; | ||||
| bool UI_but_online_manual_id_from_active(const struct bContext *C, | bool UI_but_online_manual_id_from_active(const struct bContext *C, | ||||
| char *r_str, | char *r_str, | ||||
| size_t maxlength) ATTR_WARN_UNUSED_RESULT; | size_t maxlength) ATTR_WARN_UNUSED_RESULT; | ||||
| ▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | uiBut *uiDefButO_ptr(uiBlock *block, | ||||
| wmOperatorCallContext opcontext, | wmOperatorCallContext opcontext, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * If a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0). | |||||
| */ | |||||
| uiBut *uiDefIconBut(uiBlock *block, | uiBut *uiDefIconBut(uiBlock *block, | ||||
| int type, | int type, | ||||
| int retval, | int retval, | ||||
| int icon, | int icon, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| ▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | uiBut *uiDefIconButO_ptr(uiBlock *block, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| const char *tip); | const char *tip); | ||||
| uiBut *uiDefButImage( | uiBut *uiDefButImage( | ||||
| uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4]); | uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4]); | ||||
| uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height); | uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height); | ||||
| /* Button containing both string label and icon */ | |||||
| uiBut *uiDefIconTextBut(uiBlock *block, | uiBut *uiDefIconTextBut(uiBlock *block, | ||||
| int type, | int type, | ||||
| int retval, | int retval, | ||||
| int icon, | int icon, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| ▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | |||||
| * Ways to limit what is displayed in ID-search popup. | * Ways to limit what is displayed in ID-search popup. | ||||
| * \note We may want to add LOCAL, LIBRARY ... as needed. | * \note We may want to add LOCAL, LIBRARY ... as needed. | ||||
| */ | */ | ||||
| enum { | enum { | ||||
| UI_TEMPLATE_ID_FILTER_ALL = 0, | UI_TEMPLATE_ID_FILTER_ALL = 0, | ||||
| UI_TEMPLATE_ID_FILTER_AVAILABLE = 1, | UI_TEMPLATE_ID_FILTER_AVAILABLE = 1, | ||||
| }; | }; | ||||
| /***************************** ID Utilities *******************************/ | |||||
| int UI_icon_from_id(const struct ID *id); | int UI_icon_from_id(const struct ID *id); | ||||
| /** See: #BKE_report_type_str */ | |||||
| int UI_icon_from_report_type(int type); | int UI_icon_from_report_type(int type); | ||||
| int UI_icon_colorid_from_report_type(int type); | int UI_icon_colorid_from_report_type(int type); | ||||
| int UI_text_colorid_from_report_type(int type); | int UI_text_colorid_from_report_type(int type); | ||||
| int UI_icon_from_event_type(short event_type, short event_value); | int UI_icon_from_event_type(short event_type, short event_value); | ||||
| int UI_icon_from_keymap_item(const struct wmKeyMapItem *kmi, int r_icon_mod[4]); | int UI_icon_from_keymap_item(const struct wmKeyMapItem *kmi, int r_icon_mod[4]); | ||||
| uiBut *uiDefPulldownBut(uiBlock *block, | uiBut *uiDefPulldownBut(uiBlock *block, | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | uiBut *uiDefBlockButN(uiBlock *block, | ||||
| void *argN, | void *argN, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * Block button containing icon. | |||||
| */ | |||||
| uiBut *uiDefIconBlockBut(uiBlock *block, | uiBut *uiDefIconBlockBut(uiBlock *block, | ||||
| uiBlockCreateFunc func, | uiBlockCreateFunc func, | ||||
| void *arg, | void *arg, | ||||
| int retval, | int retval, | ||||
| int icon, | int icon, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * Block button containing both string label and icon. | |||||
| */ | |||||
| uiBut *uiDefIconTextBlockBut(uiBlock *block, | uiBut *uiDefIconTextBlockBut(uiBlock *block, | ||||
| uiBlockCreateFunc func, | uiBlockCreateFunc func, | ||||
| void *arg, | void *arg, | ||||
| int icon, | int icon, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| const char *tip); | const char *tip); | ||||
| uiBut *uiDefKeyevtButS(uiBlock *block, | uiBut *uiDefKeyevtButS(uiBlock *block, | ||||
| int retval, | int retval, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| short *spoin, | short *spoin, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * Short pointers hard-coded. | |||||
| * \param modkeypoin: will be set to #KM_SHIFT, #KM_ALT, #KM_CTRL, #KM_OSKEY bits. | |||||
| */ | |||||
| uiBut *uiDefHotKeyevtButS(uiBlock *block, | uiBut *uiDefHotKeyevtButS(uiBlock *block, | ||||
| int retval, | int retval, | ||||
| const char *str, | const char *str, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| short *keypoin, | short *keypoin, | ||||
| const short *modkeypoin, | const short *modkeypoin, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * \param arg is pointer to string/name, use UI_but_func_search_set() below to make this work. | |||||
| * here a1 and a2, if set, control thumbnail preview rows/cols. | |||||
| */ | |||||
| uiBut *uiDefSearchBut(uiBlock *block, | uiBut *uiDefSearchBut(uiBlock *block, | ||||
| void *arg, | void *arg, | ||||
| int retval, | int retval, | ||||
| int icon, | int icon, | ||||
| int maxlen, | int maxlen, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| short width, | short width, | ||||
| short height, | short height, | ||||
| float a1, | float a1, | ||||
| float a2, | float a2, | ||||
| const char *tip); | const char *tip); | ||||
| /** | |||||
| * Same parameters as for #uiDefSearchBut, with additional operator type and properties, | |||||
| * used by callback to call again the right op with the right options (properties values). | |||||
| */ | |||||
| uiBut *uiDefSearchButO_ptr(uiBlock *block, | uiBut *uiDefSearchButO_ptr(uiBlock *block, | ||||
| struct wmOperatorType *ot, | struct wmOperatorType *ot, | ||||
| struct IDProperty *properties, | struct IDProperty *properties, | ||||
| void *arg, | void *arg, | ||||
| int retval, | int retval, | ||||
| int icon, | int icon, | ||||
| int maxlen, | int maxlen, | ||||
| int x, | int x, | ||||
| Show All 27 Lines | uiBut *uiDefAutoButR(uiBlock *block, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| int index, | int index, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| int width, | int width, | ||||
| int height); | int height); | ||||
| /** | |||||
| * \a check_prop callback filters functions to avoid drawing certain properties, | |||||
| * in cases where PROP_HIDDEN flag can't be used for a property. | |||||
| * | |||||
| * \param prop_activate_init: Property to activate on initial popup (#UI_BUT_ACTIVATE_ON_INIT). | |||||
| */ | |||||
| eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, | eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| bool (*check_prop)(struct PointerRNA *ptr, | bool (*check_prop)(struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| void *user_data), | void *user_data), | ||||
| void *user_data, | void *user_data, | ||||
| struct PropertyRNA *prop_activate_init, | struct PropertyRNA *prop_activate_init, | ||||
| eButLabelAlign label_align, | eButLabelAlign label_align, | ||||
| const bool compact); | const bool compact); | ||||
| /* use inside searchfunc to add items */ | /** | ||||
| * Public function exported for functions that use #UI_BTYPE_SEARCH_MENU. | |||||
| * | |||||
| * Use inside searchfunc to add items. | |||||
| * | |||||
| * \param items: Stores the items. | |||||
| * \param name: Text to display for the item. | |||||
| * \param poin: Opaque pointer (for use by the caller). | |||||
| * \param iconid: The icon, #ICON_NONE for no icon. | |||||
| * \param state: The buttons state flag, compatible with #uiBut.flag, | |||||
| * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE. | |||||
| * \return false if there is nothing to add. | |||||
| */ | |||||
| bool UI_search_item_add(uiSearchItems *items, | bool UI_search_item_add(uiSearchItems *items, | ||||
| const char *name, | const char *name, | ||||
| void *poin, | void *poin, | ||||
| int iconid, | int iconid, | ||||
| int state, | int state, | ||||
| const uint8_t name_prefix_offset); | const uint8_t name_prefix_offset); | ||||
| /** | |||||
| * \note The item-pointer (referred to below) is a per search item user pointer | |||||
| * passed to #UI_search_item_add (stored in #uiSearchItems.pointers). | |||||
| * | |||||
| * \param search_create_fn: Function to create the menu. | |||||
| * \param search_update_fn: Function to refresh search content after the search text has changed. | |||||
| * \param arg: user value. | |||||
| * \param free_arg: Set to true if the argument is newly allocated memory for every redraw and | |||||
| * should be freed when the button is destroyed. | |||||
| * \param search_arg_free_fn: When non-null, use this function to free \a arg. | |||||
| * \param search_exec_fn: Function that executes the action, gets \a arg as the first argument. | |||||
| * The second argument as the active item-pointer | |||||
| * \param active: When non-null, this item-pointer item will be visible and selected, | |||||
| * otherwise the first item will be selected. | |||||
| */ | |||||
| void UI_but_func_search_set(uiBut *but, | void UI_but_func_search_set(uiBut *but, | ||||
| uiButSearchCreateFn search_create_fn, | uiButSearchCreateFn search_create_fn, | ||||
| uiButSearchUpdateFn search_update_fn, | uiButSearchUpdateFn search_update_fn, | ||||
| void *arg, | void *arg, | ||||
| const bool free_arg, | const bool free_arg, | ||||
| uiFreeArgFunc search_arg_free_fn, | uiFreeArgFunc search_arg_free_fn, | ||||
| uiButHandleFunc search_exec_fn, | uiButHandleFunc search_exec_fn, | ||||
| void *active); | void *active); | ||||
| void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn context_menu_fn); | void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn context_menu_fn); | ||||
| void UI_but_func_search_set_tooltip(uiBut *but, uiButSearchTooltipFn tooltip_fn); | void UI_but_func_search_set_tooltip(uiBut *but, uiButSearchTooltipFn tooltip_fn); | ||||
| /** | |||||
| * \param search_sep_string: when not NULL, this string is used as a separator, | |||||
| * showing the icon and highlighted text after the last instance of this string. | |||||
| */ | |||||
| void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string); | void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string); | ||||
| void UI_but_func_search_set_results_are_suggestions(uiBut *but, const bool value); | void UI_but_func_search_set_results_are_suggestions(uiBut *but, const bool value); | ||||
| /* height in pixels, it's using hardcoded values still */ | /** | ||||
| * Height in pixels, it's using hard-coded values still. | |||||
| */ | |||||
| int UI_searchbox_size_y(void); | int UI_searchbox_size_y(void); | ||||
| int UI_searchbox_size_x(void); | int UI_searchbox_size_x(void); | ||||
| /* check if a string is in an existing search box */ | /** | ||||
| * Check if a string is in an existing search box. | |||||
| */ | |||||
| int UI_search_items_find_index(uiSearchItems *items, const char *name); | int UI_search_items_find_index(uiSearchItems *items, const char *name); | ||||
| /** | |||||
| * Adds a hint to the button which draws right aligned, grayed out and never clipped. | |||||
| */ | |||||
| void UI_but_hint_drawstr_set(uiBut *but, const char *string); | void UI_but_hint_drawstr_set(uiBut *but, const char *string); | ||||
| void UI_but_treerow_indentation_set(uiBut *but, int indentation); | void UI_but_treerow_indentation_set(uiBut *but, int indentation); | ||||
| void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4]); | void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4]); | ||||
| void UI_but_number_step_size_set(uiBut *but, float step_size); | void UI_but_number_step_size_set(uiBut *but, float step_size); | ||||
| void UI_but_number_precision_set(uiBut *but, float precision); | void UI_but_number_precision_set(uiBut *but, float precision); | ||||
| Show All 13 Lines | void UI_but_func_drawextra_set( | ||||
| uiBlock *block, | uiBlock *block, | ||||
| void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), | void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), | ||||
| void *arg1, | void *arg1, | ||||
| void *arg2); | void *arg2); | ||||
| void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func); | void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func); | ||||
| void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg); | void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg); | ||||
| /** | |||||
| * Recreate tool-tip (use to update dynamic tips) | |||||
| */ | |||||
| void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); | void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); | ||||
| /** | |||||
| * Removes tool-tip timer from active but | |||||
| * (meaning tool-tip is disabled until it's re-enabled again). | |||||
| */ | |||||
| void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); | void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); | ||||
| bool UI_textbutton_activate_rna(const struct bContext *C, | bool UI_textbutton_activate_rna(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| const void *rna_poin_data, | const void *rna_poin_data, | ||||
| const char *rna_prop_id); | const char *rna_prop_id); | ||||
| bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); | bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); | ||||
| /** | |||||
| * push a new event onto event queue to activate the given button | |||||
| * (usually a text-field) upon entering a popup | |||||
| */ | |||||
| void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); | void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); | ||||
| void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN); | void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN); | ||||
| void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg); | void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg); | ||||
| struct PointerRNA *UI_but_extra_operator_icon_add(uiBut *but, | struct PointerRNA *UI_but_extra_operator_icon_add(uiBut *but, | ||||
| const char *opname, | const char *opname, | ||||
| Show All 21 Lines | |||||
| /* Panels | /* Panels | ||||
| * | * | ||||
| * Functions for creating, freeing and drawing panels. The API here | * Functions for creating, freeing and drawing panels. The API here | ||||
| * could use a good cleanup, though how they will function in 2.5 is | * could use a good cleanup, though how they will function in 2.5 is | ||||
| * not clear yet so we postpone that. */ | * not clear yet so we postpone that. */ | ||||
| void UI_panels_begin(const struct bContext *C, struct ARegion *region); | void UI_panels_begin(const struct bContext *C, struct ARegion *region); | ||||
| void UI_panels_end(const struct bContext *C, struct ARegion *region, int *r_x, int *r_y); | void UI_panels_end(const struct bContext *C, struct ARegion *region, int *r_x, int *r_y); | ||||
| /** | |||||
| * Draw panels, selected (panels currently being dragged) on top. | |||||
| */ | |||||
| void UI_panels_draw(const struct bContext *C, struct ARegion *region); | void UI_panels_draw(const struct bContext *C, struct ARegion *region); | ||||
| struct Panel *UI_panel_find_by_type(struct ListBase *lb, const struct PanelType *pt); | struct Panel *UI_panel_find_by_type(struct ListBase *lb, const struct PanelType *pt); | ||||
| /** | |||||
| * \note \a panel should be return value from #UI_panel_find_by_type and can be NULL. | |||||
| */ | |||||
| struct Panel *UI_panel_begin(struct ARegion *region, | struct Panel *UI_panel_begin(struct ARegion *region, | ||||
| struct ListBase *lb, | struct ListBase *lb, | ||||
| uiBlock *block, | uiBlock *block, | ||||
| struct PanelType *pt, | struct PanelType *pt, | ||||
| struct Panel *panel, | struct Panel *panel, | ||||
| bool *r_open); | bool *r_open); | ||||
| /** | |||||
| * 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. | |||||
| */ | |||||
| void UI_panel_header_buttons_begin(struct Panel *panel); | void UI_panel_header_buttons_begin(struct Panel *panel); | ||||
| /** | |||||
| * Finish the button group for the panel header to avoid putting panel body buttons in it. | |||||
| */ | |||||
| void UI_panel_header_buttons_end(struct Panel *panel); | void UI_panel_header_buttons_end(struct Panel *panel); | ||||
| void UI_panel_end(struct Panel *panel, int width, int height); | void UI_panel_end(struct Panel *panel, int width, int height); | ||||
| /** | |||||
| * 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. | |||||
| */ | |||||
| void UI_panel_context_pointer_set(struct Panel *panel, const char *name, struct PointerRNA *ptr); | void UI_panel_context_pointer_set(struct Panel *panel, const char *name, struct PointerRNA *ptr); | ||||
| /** | |||||
| * Get the panel's expansion state, taking into account | |||||
| * expansion set from property search if it applies. | |||||
| */ | |||||
| bool UI_panel_is_closed(const struct Panel *panel); | bool UI_panel_is_closed(const struct Panel *panel); | ||||
| bool UI_panel_is_active(const struct Panel *panel); | bool UI_panel_is_active(const struct Panel *panel); | ||||
| /** | |||||
| * For button layout next to label. | |||||
| */ | |||||
| void UI_panel_label_offset(const struct uiBlock *block, int *r_x, int *r_y); | void UI_panel_label_offset(const struct uiBlock *block, int *r_x, int *r_y); | ||||
| bool UI_panel_should_show_background(const struct ARegion *region, | bool UI_panel_should_show_background(const struct ARegion *region, | ||||
| const struct PanelType *panel_type); | const struct PanelType *panel_type); | ||||
| int UI_panel_size_y(const struct Panel *panel); | int UI_panel_size_y(const struct Panel *panel); | ||||
| bool UI_panel_is_dragging(const struct Panel *panel); | bool UI_panel_is_dragging(const struct 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. | |||||
| */ | |||||
| bool UI_panel_matches_search_filter(const struct Panel *panel); | bool UI_panel_matches_search_filter(const struct Panel *panel); | ||||
| bool UI_panel_can_be_pinned(const struct Panel *panel); | bool UI_panel_can_be_pinned(const struct Panel *panel); | ||||
| bool UI_panel_category_is_visible(const struct ARegion *region); | bool UI_panel_category_is_visible(const struct ARegion *region); | ||||
| void UI_panel_category_add(struct ARegion *region, const char *name); | void UI_panel_category_add(struct ARegion *region, const char *name); | ||||
| struct PanelCategoryDyn *UI_panel_category_find(const struct ARegion *region, const char *idname); | struct PanelCategoryDyn *UI_panel_category_find(const struct ARegion *region, const char *idname); | ||||
| struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region, | struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region, | ||||
| const char *idname); | const char *idname); | ||||
| const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback); | const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback); | ||||
| void UI_panel_category_active_set(struct ARegion *region, const char *idname); | void UI_panel_category_active_set(struct ARegion *region, const char *idname); | ||||
| void UI_panel_category_active_set_default(struct ARegion *region, const char *idname); | void UI_panel_category_active_set_default(struct ARegion *region, const char *idname); | ||||
| void UI_panel_category_clear_all(struct ARegion *region); | void UI_panel_category_clear_all(struct ARegion *region); | ||||
| /** | |||||
| * Draw vertical tabs on the left side of the region, one tab per category. | |||||
| */ | |||||
| void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active); | void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active); | ||||
| /* Panel custom data. */ | /* Panel custom data. */ | ||||
| struct PointerRNA *UI_panel_custom_data_get(const struct Panel *panel); | struct PointerRNA *UI_panel_custom_data_get(const struct Panel *panel); | ||||
| struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContext *C, | struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContext *C, | ||||
| const struct wmEvent *event); | const struct wmEvent *event); | ||||
| void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_data); | void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_data); | ||||
| /* Polyinstantiated panels for representing a list of data. */ | /* Polyinstantiated panels for representing a list of data. */ | ||||
| /** | |||||
| * Called in situations where panels need to be added dynamically rather than | |||||
| * having only one panel corresponding to each #PanelType. | |||||
| */ | |||||
| struct Panel *UI_panel_add_instanced(const struct bContext *C, | struct Panel *UI_panel_add_instanced(const struct bContext *C, | ||||
| struct ARegion *region, | struct ARegion *region, | ||||
| struct ListBase *panels, | struct ListBase *panels, | ||||
| const char *panel_idname, | const char *panel_idname, | ||||
| struct PointerRNA *custom_data); | struct PointerRNA *custom_data); | ||||
| /** | |||||
| * Remove instanced panels from the region's panel list. | |||||
| * | |||||
| * \note Can be called with NULL \a C, but it should be avoided because | |||||
| * handlers might not be removed. | |||||
| */ | |||||
| void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region); | void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region); | ||||
| #define INSTANCED_PANEL_UNIQUE_STR_LEN 16 | #define INSTANCED_PANEL_UNIQUE_STR_LEN 16 | ||||
| /** | |||||
| * 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. | |||||
| */ | |||||
| void UI_list_panel_unique_str(struct Panel *panel, char *r_name); | void UI_list_panel_unique_str(struct Panel *panel, char *r_name); | ||||
| typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname); | typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname); | ||||
| /** | |||||
| * 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. | |||||
| * | |||||
| * \param data: The list of data to check against the instanced panels. | |||||
| * \param panel_idname_func: Function 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. | |||||
| */ | |||||
| bool UI_panel_list_matches_data(struct ARegion *region, | bool UI_panel_list_matches_data(struct ARegion *region, | ||||
| struct ListBase *data, | struct ListBase *data, | ||||
| uiListPanelIDFromDataFunc panel_idname_func); | uiListPanelIDFromDataFunc panel_idname_func); | ||||
| /* Handlers | /* Handlers | ||||
| * | * | ||||
| * Handlers that can be registered in regions, areas and windows for | * Handlers that can be registered in regions, areas and windows for | ||||
| * handling WM events. Mostly this is done automatic by modules such | * handling WM events. Mostly this is done automatic by modules such | ||||
| * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */ | * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */ | ||||
| void UI_region_handlers_add(struct ListBase *handlers); | void UI_region_handlers_add(struct ListBase *handlers); | ||||
| void UI_popup_handlers_add(struct bContext *C, | void UI_popup_handlers_add(struct bContext *C, | ||||
| struct ListBase *handlers, | struct ListBase *handlers, | ||||
| uiPopupBlockHandle *popup, | uiPopupBlockHandle *popup, | ||||
| const char flag); | const char flag); | ||||
| void UI_popup_handlers_remove(struct ListBase *handlers, uiPopupBlockHandle *popup); | void UI_popup_handlers_remove(struct ListBase *handlers, uiPopupBlockHandle *popup); | ||||
| void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers); | void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers); | ||||
| /* Module | /* Module | ||||
| * | * | ||||
| * init and exit should be called before using this module. init_userdef must | * init and exit should be called before using this module. init_userdef must | ||||
| * be used to reinitialize some internal state if user preferences change. */ | * be used to reinitialize some internal state if user preferences change. */ | ||||
| void UI_init(void); | void UI_init(void); | ||||
| /* after reading userdef file */ | |||||
| void UI_init_userdef(void); | void UI_init_userdef(void); | ||||
| void UI_reinit_font(void); | void UI_reinit_font(void); | ||||
| void UI_exit(void); | void UI_exit(void); | ||||
| /* Layout | /* Layout | ||||
| * | * | ||||
| * More automated layout of buttons. Has three levels: | * More automated layout of buttons. Has three levels: | ||||
| * - Layout: contains a number templates, within a bounded width or height. | * - Layout: contains a number templates, within a bounded width or height. | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | uiLayout *UI_block_layout(uiBlock *block, | ||||
| int x, | int x, | ||||
| int y, | int y, | ||||
| int size, | int size, | ||||
| int em, | int em, | ||||
| int padding, | int padding, | ||||
| const struct uiStyle *style); | const struct uiStyle *style); | ||||
| void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); | void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); | ||||
| void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y); | void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y); | ||||
| /** | |||||
| * Used for property search when the layout process needs to be cancelled in order to avoid | |||||
| * computing the locations for buttons, but the layout items created while adding the buttons | |||||
| * must still be freed. | |||||
| */ | |||||
| void UI_block_layout_free(uiBlock *block); | void UI_block_layout_free(uiBlock *block); | ||||
| /** | |||||
| * Apply property search behavior, setting panel flags and deactivating buttons that don't match. | |||||
| * | |||||
| * \note Must not be run after #UI_block_layout_resolve. | |||||
| */ | |||||
| bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter); | bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter); | ||||
| void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus); | void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus); | ||||
| uiBlock *uiLayoutGetBlock(uiLayout *layout); | uiBlock *uiLayoutGetBlock(uiLayout *layout); | ||||
| void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); | void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); | ||||
| void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr); | void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr); | ||||
| struct bContextStore *uiLayoutGetContextStore(uiLayout *layout); | struct bContextStore *uiLayoutGetContextStore(uiLayout *layout); | ||||
| void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context); | void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context); | ||||
| /** | |||||
| * This is a bit of a hack but best keep it in one place at least. | |||||
| */ | |||||
| struct wmOperatorType *UI_but_operatortype_get_from_enum_menu(struct uiBut *but, | struct wmOperatorType *UI_but_operatortype_get_from_enum_menu(struct uiBut *but, | ||||
| struct PropertyRNA **r_prop); | struct PropertyRNA **r_prop); | ||||
| /** | |||||
| * This is a bit of a hack but best keep it in one place at least. | |||||
| */ | |||||
| struct MenuType *UI_but_menutype_get(uiBut *but); | struct MenuType *UI_but_menutype_get(uiBut *but); | ||||
| /** | |||||
| * This is a bit of a hack but best keep it in one place at least. | |||||
| */ | |||||
| struct PanelType *UI_but_paneltype_get(uiBut *but); | struct PanelType *UI_but_paneltype_get(uiBut *but); | ||||
| void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout *layout); | void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout *layout); | ||||
| /** | |||||
| * Used for popup panels only. | |||||
| */ | |||||
| void UI_paneltype_draw(struct bContext *C, struct PanelType *pt, struct uiLayout *layout); | void UI_paneltype_draw(struct bContext *C, struct PanelType *pt, struct uiLayout *layout); | ||||
| /* Only for convenience. */ | /* Only for convenience. */ | ||||
| void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but); | void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but); | ||||
| void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext); | void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext); | ||||
| void uiLayoutSetActive(uiLayout *layout, bool active); | void uiLayoutSetActive(uiLayout *layout, bool active); | ||||
| void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default); | void uiLayoutSetActiveDefault(uiLayout *layout, bool active_default); | ||||
| Show All 25 Lines | |||||
| float uiLayoutGetScaleX(uiLayout *layout); | float uiLayoutGetScaleX(uiLayout *layout); | ||||
| float uiLayoutGetScaleY(uiLayout *layout); | float uiLayoutGetScaleY(uiLayout *layout); | ||||
| float uiLayoutGetUnitsX(uiLayout *layout); | float uiLayoutGetUnitsX(uiLayout *layout); | ||||
| float uiLayoutGetUnitsY(uiLayout *layout); | float uiLayoutGetUnitsY(uiLayout *layout); | ||||
| eUIEmbossType uiLayoutGetEmboss(uiLayout *layout); | eUIEmbossType uiLayoutGetEmboss(uiLayout *layout); | ||||
| bool uiLayoutGetPropSep(uiLayout *layout); | bool uiLayoutGetPropSep(uiLayout *layout); | ||||
| bool uiLayoutGetPropDecorate(uiLayout *layout); | bool uiLayoutGetPropDecorate(uiLayout *layout); | ||||
| /* layout specifiers */ | /* Layout create functions. */ | ||||
| uiLayout *uiLayoutRow(uiLayout *layout, bool align); | uiLayout *uiLayoutRow(uiLayout *layout, bool align); | ||||
| /** | |||||
| * See #uiLayoutColumnWithHeading(). | |||||
| */ | |||||
| uiLayout *uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading); | uiLayout *uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading); | ||||
| uiLayout *uiLayoutColumn(uiLayout *layout, bool align); | uiLayout *uiLayoutColumn(uiLayout *layout, bool align); | ||||
| /** | |||||
| * Variant of #uiLayoutColumn() that sets a heading label for the layout if the first item is | |||||
| * added through #uiItemFullR(). If split layout is used and the item has no string to add to the | |||||
| * first split-column, the heading is added there instead. Otherwise the heading inserted with a | |||||
| * new row. | |||||
| */ | |||||
| uiLayout *uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading); | uiLayout *uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading); | ||||
| uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); | uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); | ||||
| uiLayout *uiLayoutGridFlow(uiLayout *layout, | uiLayout *uiLayoutGridFlow(uiLayout *layout, | ||||
| bool row_major, | bool row_major, | ||||
| int columns_len, | int columns_len, | ||||
| bool even_columns, | bool even_columns, | ||||
| bool even_rows, | bool even_rows, | ||||
| bool align); | bool align); | ||||
| Show All 35 Lines | void uiTemplateIDPreview(uiLayout *layout, | ||||
| const char *propname, | const char *propname, | ||||
| const char *newop, | const char *newop, | ||||
| const char *openop, | const char *openop, | ||||
| const char *unlinkop, | const char *unlinkop, | ||||
| int rows, | int rows, | ||||
| int cols, | int cols, | ||||
| int filter, | int filter, | ||||
| const bool hide_buttons); | const bool hide_buttons); | ||||
| /** | |||||
| * Version of #uiTemplateID using tabs. | |||||
| */ | |||||
| void uiTemplateIDTabs(uiLayout *layout, | void uiTemplateIDTabs(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| const char *newop, | const char *newop, | ||||
| const char *menu, | const char *menu, | ||||
| int filter); | int filter); | ||||
| /** | |||||
| * This is for selecting the type of ID-block to use, | |||||
| * and then from the relevant type choosing the block to use. | |||||
| * | |||||
| * \param propname: property identifier for property that ID-pointer gets stored to. | |||||
| * \param proptypename: property identifier for property | |||||
| * used to determine the type of ID-pointer that can be used. | |||||
| */ | |||||
| void uiTemplateAnyID(uiLayout *layout, | void uiTemplateAnyID(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| const char *proptypename, | const char *proptypename, | ||||
| const char *text); | const char *text); | ||||
| /** | |||||
| * Search menu to pick an item from a collection. | |||||
| * A version of uiTemplateID that works for non-ID types. | |||||
| */ | |||||
| void uiTemplateSearch(uiLayout *layout, | void uiTemplateSearch(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| struct PointerRNA *searchptr, | struct PointerRNA *searchptr, | ||||
| const char *searchpropname, | const char *searchpropname, | ||||
| const char *newop, | const char *newop, | ||||
| const char *unlinkop); | const char *unlinkop); | ||||
| void uiTemplateSearchPreview(uiLayout *layout, | void uiTemplateSearchPreview(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| struct PointerRNA *searchptr, | struct PointerRNA *searchptr, | ||||
| const char *searchpropname, | const char *searchpropname, | ||||
| const char *newop, | const char *newop, | ||||
| const char *unlinkop, | const char *unlinkop, | ||||
| const int rows, | const int rows, | ||||
| const int cols); | const int cols); | ||||
| /** | |||||
| * This is creating/editing RNA-Paths | |||||
| * | |||||
| * - ptr: struct which holds the path property | |||||
| * - propname: property identifier for property that path gets stored to | |||||
| * - root_ptr: struct that path gets built from | |||||
| */ | |||||
| void uiTemplatePathBuilder(uiLayout *layout, | void uiTemplatePathBuilder(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| struct PointerRNA *root_ptr, | struct PointerRNA *root_ptr, | ||||
| const char *text); | const char *text); | ||||
| void uiTemplateModifiers(uiLayout *layout, struct bContext *C); | void uiTemplateModifiers(uiLayout *layout, struct bContext *C); | ||||
| void uiTemplateGpencilModifiers(uiLayout *layout, struct bContext *C); | void uiTemplateGpencilModifiers(uiLayout *layout, struct bContext *C); | ||||
| /** | |||||
| * Check if the shader effect panels don't match the data and rebuild the panels if so. | |||||
| */ | |||||
| void uiTemplateShaderFx(uiLayout *layout, struct bContext *C); | void uiTemplateShaderFx(uiLayout *layout, struct bContext *C); | ||||
| /** | |||||
| * Check if the constraint panels don't match the data and rebuild the panels if so. | |||||
| */ | |||||
| void uiTemplateConstraints(uiLayout *layout, struct bContext *C, bool use_bone_constraints); | void uiTemplateConstraints(uiLayout *layout, struct bContext *C, bool use_bone_constraints); | ||||
| uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); | uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); | ||||
| void uiTemplateGpencilColorPreview(uiLayout *layout, | void uiTemplateGpencilColorPreview(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| int rows, | int rows, | ||||
| Show All 10 Lines | void uiTemplatePreview(uiLayout *layout, | ||||
| bool show_buttons, | bool show_buttons, | ||||
| struct ID *parent, | struct ID *parent, | ||||
| struct MTex *slot, | struct MTex *slot, | ||||
| const char *preview_id); | const char *preview_id); | ||||
| void uiTemplateColorRamp(uiLayout *layout, | void uiTemplateColorRamp(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| bool expand); | bool expand); | ||||
| /** | |||||
| * \param icon_scale: Scale of the icon, 1x == button height. | |||||
| */ | |||||
| void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); | void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); | ||||
| /** | |||||
| * \param icon_scale: Scale of the icon, 1x == button height. | |||||
| */ | |||||
| void uiTemplateIconView(uiLayout *layout, | void uiTemplateIconView(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| bool show_labels, | bool show_labels, | ||||
| float icon_scale, | float icon_scale, | ||||
| float icon_scale_popup); | float icon_scale_popup); | ||||
| void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | ||||
| void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | ||||
| void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | ||||
| void uiTemplateCurveMapping(uiLayout *layout, | void uiTemplateCurveMapping(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| int type, | int type, | ||||
| bool levels, | bool levels, | ||||
| bool brush, | bool brush, | ||||
| bool neg_slope, | bool neg_slope, | ||||
| bool tone); | bool tone); | ||||
| /** | |||||
| * Template for a path creation widget intended for custom bevel profiles. | |||||
| * This section is quite similar to #uiTemplateCurveMapping, but with reduced complexity. | |||||
| */ | |||||
| void uiTemplateCurveProfile(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | void uiTemplateCurveProfile(uiLayout *layout, struct PointerRNA *ptr, const char *propname); | ||||
| /** | |||||
| * This template now follows User Preference for type - name is not correct anymore. | |||||
| */ | |||||
| void uiTemplateColorPicker(uiLayout *layout, | void uiTemplateColorPicker(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| bool value_slider, | bool value_slider, | ||||
| bool lock, | bool lock, | ||||
| bool lock_luminosity, | bool lock_luminosity, | ||||
| bool cubic); | bool cubic); | ||||
| void uiTemplatePalette(uiLayout *layout, | void uiTemplatePalette(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| bool colors); | bool colors); | ||||
| void uiTemplateCryptoPicker(uiLayout *layout, | void uiTemplateCryptoPicker(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| int icon); | int icon); | ||||
| /** | |||||
| * \todo for now, grouping of layers is determined by dividing up the length of | |||||
| * the array of layer bitflags | |||||
| */ | |||||
| void uiTemplateLayers(uiLayout *layout, | void uiTemplateLayers(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| const char *propname, | const char *propname, | ||||
| struct PointerRNA *used_ptr, | struct PointerRNA *used_ptr, | ||||
| const char *used_propname, | const char *used_propname, | ||||
| int active_layer); | int active_layer); | ||||
| void uiTemplateImage(uiLayout *layout, | void uiTemplateImage(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| Show All 18 Lines | void uiTemplateImageInfo(uiLayout *layout, | ||||
| struct ImageUser *iuser); | struct ImageUser *iuser); | ||||
| void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); | void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); | ||||
| void UI_but_func_operator_search(uiBut *but); | void UI_but_func_operator_search(uiBut *but); | ||||
| void uiTemplateOperatorSearch(uiLayout *layout); | void uiTemplateOperatorSearch(uiLayout *layout); | ||||
| void UI_but_func_menu_search(uiBut *but); | void UI_but_func_menu_search(uiBut *but); | ||||
| void uiTemplateMenuSearch(uiLayout *layout); | void uiTemplateMenuSearch(uiLayout *layout); | ||||
| /** | |||||
| * Draw Operator property buttons for redoing execution with different settings. | |||||
| * This function does not initialize the layout, | |||||
| * functions can be called on the layout before and after. | |||||
| */ | |||||
| void uiTemplateOperatorPropertyButs(const struct bContext *C, | void uiTemplateOperatorPropertyButs(const struct bContext *C, | ||||
| uiLayout *layout, | uiLayout *layout, | ||||
| struct wmOperator *op, | struct wmOperator *op, | ||||
| eButLabelAlign label_align, | eButLabelAlign label_align, | ||||
| short flag); | short flag); | ||||
| void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C); | void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C); | ||||
| void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); | void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); | ||||
| void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C); | void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C); | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | void uiTemplateNodeLink(uiLayout *layout, | ||||
| struct bNode *node, | struct bNode *node, | ||||
| struct bNodeSocket *input); | struct bNodeSocket *input); | ||||
| void uiTemplateNodeView(uiLayout *layout, | void uiTemplateNodeView(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct bNodeTree *ntree, | struct bNodeTree *ntree, | ||||
| struct bNode *node, | struct bNode *node, | ||||
| struct bNodeSocket *input); | struct bNodeSocket *input); | ||||
| void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); | void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); | ||||
| /** | |||||
| * Button to quickly show texture in Properties Editor texture tab. | |||||
| */ | |||||
| void uiTemplateTextureShow(uiLayout *layout, | void uiTemplateTextureShow(uiLayout *layout, | ||||
| const struct bContext *C, | const struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop); | struct PropertyRNA *prop); | ||||
| void uiTemplateMovieClip(struct uiLayout *layout, | void uiTemplateMovieClip(struct uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| Show All 40 Lines | void uiTemplateAssetView(struct uiLayout *layout, | ||||
| const char *active_propname, | const char *active_propname, | ||||
| const struct AssetFilterSettings *filter_settings, | const struct AssetFilterSettings *filter_settings, | ||||
| const int display_flags, | const int display_flags, | ||||
| const char *activate_opname, | const char *activate_opname, | ||||
| struct PointerRNA *r_activate_op_properties, | struct PointerRNA *r_activate_op_properties, | ||||
| const char *drag_opname, | const char *drag_opname, | ||||
| struct PointerRNA *r_drag_op_properties); | struct PointerRNA *r_drag_op_properties); | ||||
| /** | |||||
| * \return: A RNA pointer for the operator properties. | |||||
| */ | |||||
| struct PointerRNA *UI_list_custom_activate_operator_set(struct uiList *ui_list, | struct PointerRNA *UI_list_custom_activate_operator_set(struct uiList *ui_list, | ||||
| const char *opname, | const char *opname, | ||||
| bool create_properties); | bool create_properties); | ||||
| /** | |||||
| * \return: A RNA pointer for the operator properties. | |||||
| */ | |||||
| struct PointerRNA *UI_list_custom_drag_operator_set(struct uiList *ui_list, | struct PointerRNA *UI_list_custom_drag_operator_set(struct uiList *ui_list, | ||||
| const char *opname, | const char *opname, | ||||
| bool create_properties); | bool create_properties); | ||||
| /* items */ | /* items */ | ||||
| void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname); | void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname); | ||||
| void uiItemEnumO_ptr(uiLayout *layout, | void uiItemEnumO_ptr(uiLayout *layout, | ||||
| struct wmOperatorType *ot, | struct wmOperatorType *ot, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| const char *propname, | const char *propname, | ||||
| int value); | int value); | ||||
| void uiItemEnumO(uiLayout *layout, | void uiItemEnumO(uiLayout *layout, | ||||
| const char *opname, | const char *opname, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| const char *propname, | const char *propname, | ||||
| int value); | int value); | ||||
| /** | |||||
| * For use in cases where we have. | |||||
| */ | |||||
| void uiItemEnumO_value(uiLayout *layout, | void uiItemEnumO_value(uiLayout *layout, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| const char *opname, | const char *opname, | ||||
| const char *propname, | const char *propname, | ||||
| int value); | int value); | ||||
| void uiItemEnumO_string(uiLayout *layout, | void uiItemEnumO_string(uiLayout *layout, | ||||
| const char *name, | const char *name, | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
| void uiItemFullR(uiLayout *layout, | void uiItemFullR(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| int index, | int index, | ||||
| int value, | int value, | ||||
| int flag, | int flag, | ||||
| const char *name, | const char *name, | ||||
| int icon); | int icon); | ||||
| /** | |||||
| * Use a wrapper function since re-implementing all the logic in this function would be messy. | |||||
| */ | |||||
| void uiItemFullR_with_popover(uiLayout *layout, | void uiItemFullR_with_popover(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| int index, | int index, | ||||
| int value, | int value, | ||||
| int flag, | int flag, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | void uiItemPointerR(uiLayout *layout, | ||||
| const char *name, | const char *name, | ||||
| int icon); | int icon); | ||||
| void uiItemsFullEnumO(uiLayout *layout, | void uiItemsFullEnumO(uiLayout *layout, | ||||
| const char *opname, | const char *opname, | ||||
| const char *propname, | const char *propname, | ||||
| struct IDProperty *properties, | struct IDProperty *properties, | ||||
| wmOperatorCallContext context, | wmOperatorCallContext context, | ||||
| int flag); | int flag); | ||||
| /** | |||||
| * Create UI items for enum items in \a item_array. | |||||
| * | |||||
| * A version of #uiItemsFullEnumO that takes pre-calculated item array. | |||||
| */ | |||||
| void uiItemsFullEnumO_items(uiLayout *layout, | void uiItemsFullEnumO_items(uiLayout *layout, | ||||
| struct wmOperatorType *ot, | struct wmOperatorType *ot, | ||||
| struct PointerRNA ptr, | struct PointerRNA ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| struct IDProperty *properties, | struct IDProperty *properties, | ||||
| wmOperatorCallContext context, | wmOperatorCallContext context, | ||||
| int flag, | int flag, | ||||
| const struct EnumPropertyItem *item_array, | const struct EnumPropertyItem *item_array, | ||||
| int totitem); | int totitem); | ||||
| typedef struct uiPropertySplitWrapper { | typedef struct uiPropertySplitWrapper { | ||||
| uiLayout *label_column; | uiLayout *label_column; | ||||
| uiLayout *property_row; | uiLayout *property_row; | ||||
| uiLayout *decorate_column; | uiLayout *decorate_column; | ||||
| } uiPropertySplitWrapper; | } uiPropertySplitWrapper; | ||||
| /** | |||||
| * Normally, we handle the split layout in #uiItemFullR(), but there are other cases where the | |||||
| * logic is needed. Ideally, #uiItemFullR() could just call this, but it currently has too many | |||||
| * special needs. | |||||
| */ | |||||
| uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout); | uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout); | ||||
| void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ | void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ | ||||
| void uiItemL_ex( | void uiItemL_ex( | ||||
| uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert); | uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert); | ||||
| /** | |||||
| * Helper to add a label and creates a property split layout if needed. | |||||
| */ | |||||
| uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon); | uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon); | ||||
| /* label icon for dragging */ | /** | ||||
| * Label icon for dragging. | |||||
| */ | |||||
| void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); | void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); | ||||
| /* menu */ | /** | ||||
| * Menu. | |||||
| */ | |||||
| void uiItemM_ptr(uiLayout *layout, struct MenuType *mt, const char *name, int icon); | void uiItemM_ptr(uiLayout *layout, struct MenuType *mt, const char *name, int icon); | ||||
| void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); | void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); | ||||
| /* menu contents */ | /** | ||||
| * Menu contents. | |||||
| */ | |||||
| void uiItemMContents(uiLayout *layout, const char *menuname); | void uiItemMContents(uiLayout *layout, const char *menuname); | ||||
| /* Decorators */ | |||||
| /* Decorators. */ | |||||
| /** | |||||
| * Insert a decorator item for a button with the same property as \a prop. | |||||
| * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a prop. | |||||
| */ | |||||
| void uiItemDecoratorR_prop(uiLayout *layout, | void uiItemDecoratorR_prop(uiLayout *layout, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| int index); | int index); | ||||
| /** | |||||
| * Insert a decorator item for a button with the same property as \a prop. | |||||
| * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a propname. | |||||
| */ | |||||
| void uiItemDecoratorR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int index); | void uiItemDecoratorR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int index); | ||||
| /* value */ | /** Value item */ | ||||
| void uiItemV(uiLayout *layout, const char *name, int icon, int argval); | void uiItemV(uiLayout *layout, const char *name, int icon, int argval); | ||||
| /* separator */ | /** Separator item */ | ||||
| void uiItemS(uiLayout *layout); | void uiItemS(uiLayout *layout); | ||||
| /** Separator item */ | |||||
| void uiItemS_ex(uiLayout *layout, float factor); | void uiItemS_ex(uiLayout *layout, float factor); | ||||
| /* Special separator. */ | /** Flexible spacing. */ | ||||
| void uiItemSpacer(uiLayout *layout); | void uiItemSpacer(uiLayout *layout); | ||||
| /* popover */ | |||||
| void uiItemPopoverPanel_ptr( | void uiItemPopoverPanel_ptr( | ||||
| uiLayout *layout, const struct bContext *C, struct PanelType *pt, const char *name, int icon); | uiLayout *layout, const struct bContext *C, struct PanelType *pt, const char *name, int icon); | ||||
| void uiItemPopoverPanel(uiLayout *layout, | void uiItemPopoverPanel(uiLayout *layout, | ||||
| const struct bContext *C, | const struct bContext *C, | ||||
| const char *panel_type, | const char *panel_type, | ||||
| const char *name, | const char *name, | ||||
| int icon); | int icon); | ||||
| void uiItemPopoverPanelFromGroup(uiLayout *layout, | void uiItemPopoverPanelFromGroup(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| int space_id, | int space_id, | ||||
| int region_id, | int region_id, | ||||
| const char *context, | const char *context, | ||||
| const char *category); | const char *category); | ||||
| /** | |||||
| * Level items. | |||||
| */ | |||||
| void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg); | void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg); | ||||
| /** | |||||
| * Version of #uiItemMenuF that free's `argN`. | |||||
| */ | |||||
| void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN); | void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN); | ||||
| void uiItemMenuEnumFullO_ptr(uiLayout *layout, | void uiItemMenuEnumFullO_ptr(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct wmOperatorType *ot, | struct wmOperatorType *ot, | ||||
| const char *propname, | const char *propname, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| struct PointerRNA *r_opptr); | struct PointerRNA *r_opptr); | ||||
| Show All 21 Lines | void uiItemTabsEnumR_prop(uiLayout *layout, | ||||
| struct bContext *C, | struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| struct PointerRNA *ptr_highlight, | struct PointerRNA *ptr_highlight, | ||||
| struct PropertyRNA *prop_highlight, | struct PropertyRNA *prop_highlight, | ||||
| bool icon_only); | bool icon_only); | ||||
| /* Only for testing, inspecting layouts. */ | /* Only for testing, inspecting layouts. */ | ||||
| /** | |||||
| * Evaluate layout items as a Python dictionary. | |||||
| */ | |||||
| const char *UI_layout_introspect(uiLayout *layout); | const char *UI_layout_introspect(uiLayout *layout); | ||||
| /* Helper to add a big icon and create a split layout for alert boxes. */ | /** | ||||
| * Helper to add a big icon and create a split layout for alert popups. | |||||
| * Returns the layout to place further items into the alert box. | |||||
| */ | |||||
| uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon); | uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon); | ||||
| /* UI Operators */ | /* UI Operators */ | ||||
| typedef struct uiDragColorHandle { | typedef struct uiDragColorHandle { | ||||
| float color[3]; | float color[3]; | ||||
| bool gamma_corrected; | bool gamma_corrected; | ||||
| } uiDragColorHandle; | } uiDragColorHandle; | ||||
| void ED_operatortypes_ui(void); | void ED_operatortypes_ui(void); | ||||
| /** | |||||
| * \brief User Interface Keymap | |||||
| */ | |||||
| void ED_keymap_ui(struct wmKeyConfig *keyconf); | void ED_keymap_ui(struct wmKeyConfig *keyconf); | ||||
| void ED_dropboxes_ui(void); | void ED_dropboxes_ui(void); | ||||
| void ED_uilisttypes_ui(void); | void ED_uilisttypes_ui(void); | ||||
| void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); | void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); | ||||
| bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); | bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); | ||||
| bool UI_context_copy_to_selected_list(struct bContext *C, | bool UI_context_copy_to_selected_list(struct bContext *C, | ||||
| struct PointerRNA *ptr, | struct PointerRNA *ptr, | ||||
| struct PropertyRNA *prop, | struct PropertyRNA *prop, | ||||
| struct ListBase *r_lb, | struct ListBase *r_lb, | ||||
| bool *r_use_path_from_id, | bool *r_use_path_from_id, | ||||
| char **r_path); | char **r_path); | ||||
| /* Helpers for Operators */ | /* Helpers for Operators */ | ||||
| uiBut *UI_context_active_but_get(const struct bContext *C); | uiBut *UI_context_active_but_get(const struct bContext *C); | ||||
| /** | |||||
| * Version of #UI_context_active_get() that uses the result of #CTX_wm_menu() | |||||
| * if set. Does not traverse into parent menus, which may be wanted in some | |||||
| * cases. | |||||
| */ | |||||
| uiBut *UI_context_active_but_get_respect_menu(const struct bContext *C); | uiBut *UI_context_active_but_get_respect_menu(const struct bContext *C); | ||||
| /** | |||||
| * Version of #UI_context_active_but_get that also returns RNA property info. | |||||
| * Helper function for insert keyframe, reset to default, etc operators. | |||||
| * | |||||
| * \return active button, NULL if none found or if it doesn't contain valid RNA data. | |||||
| */ | |||||
| uiBut *UI_context_active_but_prop_get(const struct bContext *C, | uiBut *UI_context_active_but_prop_get(const struct bContext *C, | ||||
| struct PointerRNA *r_ptr, | struct PointerRNA *r_ptr, | ||||
| struct PropertyRNA **r_prop, | struct PropertyRNA **r_prop, | ||||
| int *r_index); | int *r_index); | ||||
| void UI_context_active_but_prop_handle(struct bContext *C); | void UI_context_active_but_prop_handle(struct bContext *C); | ||||
| void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region); | void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region); | ||||
| struct wmOperator *UI_context_active_operator_get(const struct bContext *C); | struct wmOperator *UI_context_active_operator_get(const struct bContext *C); | ||||
| /** | |||||
| * Helper function for insert keyframe, reset to default, etc operators. | |||||
| */ | |||||
| void UI_context_update_anim_flag(const struct bContext *C); | void UI_context_update_anim_flag(const struct bContext *C); | ||||
| void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, | void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, | ||||
| struct PointerRNA *r_ptr, | struct PointerRNA *r_ptr, | ||||
| struct PropertyRNA **r_prop, | struct PropertyRNA **r_prop, | ||||
| bool *r_is_undo, | bool *r_is_undo, | ||||
| bool *r_is_userdef); | bool *r_is_userdef); | ||||
| /** | |||||
| * For new/open operators. | |||||
| */ | |||||
| void UI_context_active_but_prop_get_templateID(struct bContext *C, | void UI_context_active_but_prop_get_templateID(struct bContext *C, | ||||
| struct PointerRNA *r_ptr, | struct PointerRNA *r_ptr, | ||||
| struct PropertyRNA **r_prop); | struct PropertyRNA **r_prop); | ||||
| struct ID *UI_context_active_but_get_tab_ID(struct bContext *C); | struct ID *UI_context_active_but_get_tab_ID(struct bContext *C); | ||||
| uiBut *UI_region_active_but_get(const struct ARegion *region); | uiBut *UI_region_active_but_get(const struct ARegion *region); | ||||
| uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct rcti *rect_px); | uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct rcti *rect_px); | ||||
| uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region, | uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region, | ||||
| const int xy[2], | const int xy[2], | ||||
| bool only_clip); | bool only_clip); | ||||
| /** | |||||
| * Try to find a search-box region opened from a button in \a button_region. | |||||
| */ | |||||
| struct ARegion *UI_region_searchbox_region_get(const struct ARegion *button_region); | struct ARegion *UI_region_searchbox_region_get(const struct ARegion *button_region); | ||||
| /* uiFontStyle.align */ | /* uiFontStyle.align */ | ||||
| typedef enum eFontStyle_Align { | typedef enum eFontStyle_Align { | ||||
| UI_STYLE_TEXT_LEFT = 0, | UI_STYLE_TEXT_LEFT = 0, | ||||
| UI_STYLE_TEXT_CENTER = 1, | UI_STYLE_TEXT_CENTER = 1, | ||||
| UI_STYLE_TEXT_RIGHT = 2, | UI_STYLE_TEXT_RIGHT = 2, | ||||
| } eFontStyle_Align; | } eFontStyle_Align; | ||||
| Show All 14 Lines | void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, | ||||
| int *r_xofs, | int *r_xofs, | ||||
| int *r_yofs, | int *r_yofs, | ||||
| struct ResultBLF *r_info); | struct ResultBLF *r_info); | ||||
| void UI_fontstyle_draw(const struct uiFontStyle *fs, | void UI_fontstyle_draw(const struct uiFontStyle *fs, | ||||
| const struct rcti *rect, | const struct rcti *rect, | ||||
| const char *str, | const char *str, | ||||
| const uchar col[4], | const uchar col[4], | ||||
| const struct uiFontStyleDraw_Params *fs_params); | const struct uiFontStyleDraw_Params *fs_params); | ||||
| /** | |||||
| * Drawn same as above, but at 90 degree angle. | |||||
| */ | |||||
| void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, | void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, | ||||
| const struct rcti *rect, | const struct rcti *rect, | ||||
| const char *str, | const char *str, | ||||
| const uchar col[4]); | const uchar col[4]); | ||||
| /** | |||||
| * Similar to #UI_fontstyle_draw | |||||
| * but ignore alignment, shadow & no clipping rect. | |||||
| * | |||||
| * For drawing on-screen labels. | |||||
| */ | |||||
| void UI_fontstyle_draw_simple( | void UI_fontstyle_draw_simple( | ||||
| const struct uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]); | const struct uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]); | ||||
| /** | |||||
| * Same as #UI_fontstyle_draw but draw a colored backdrop. | |||||
| */ | |||||
| void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, | void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, | ||||
| float x, | float x, | ||||
| float y, | float y, | ||||
| const char *str, | const char *str, | ||||
| const float col_fg[4], | const float col_fg[4], | ||||
| const float col_bg[4]); | const float col_bg[4]); | ||||
| int UI_fontstyle_string_width(const struct uiFontStyle *fs, | int UI_fontstyle_string_width(const struct uiFontStyle *fs, | ||||
| const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); | const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); | ||||
| /** | |||||
| * Return the width of `str` with the spacing & kerning of `fs` with `aspect` | |||||
| * (representing #uiBlock.aspect) applied. | |||||
| * | |||||
| * When calculating text width, the UI layout logic calculate widths without scale, | |||||
| * only applying scale when drawing. This causes problems for fonts since kerning at | |||||
| * smaller sizes often makes them wider than a scaled down version of the larger text. | |||||
| * Resolve this by calculating the text at the on-screen size, | |||||
| * returning the result scaled back to 1:1. See T92361. | |||||
| */ | |||||
| int UI_fontstyle_string_width_with_block_aspect(const struct uiFontStyle *fs, | int UI_fontstyle_string_width_with_block_aspect(const struct uiFontStyle *fs, | ||||
| const char *str, | const char *str, | ||||
| const float aspect) ATTR_WARN_UNUSED_RESULT | const float aspect) ATTR_WARN_UNUSED_RESULT | ||||
| ATTR_NONNULL(1, 2); | ATTR_NONNULL(1, 2); | ||||
| int UI_fontstyle_height_max(const struct uiFontStyle *fs); | int UI_fontstyle_height_max(const struct uiFontStyle *fs); | ||||
| /** | |||||
| * Triangle 'icon' for panel header and other cases. | |||||
| */ | |||||
| void UI_draw_icon_tri(float x, float y, char dir, const float[4]); | void UI_draw_icon_tri(float x, float y, char dir, const float[4]); | ||||
| /* XXX: read a style configure */ | |||||
| const struct uiStyle *UI_style_get(void); /* use for fonts etc */ | const struct uiStyle *UI_style_get(void); /* use for fonts etc */ | ||||
| /* for drawing, scaled with DPI setting */ | |||||
| const struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ | const struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ | ||||
| /* linker workaround ack! */ | /* linker workaround ack! */ | ||||
| void UI_template_fix_linking(void); | void UI_template_fix_linking(void); | ||||
| /* UI_OT_editsource helpers */ | /* UI_OT_editsource helpers */ | ||||
| bool UI_editsource_enable_check(void); | bool UI_editsource_enable_check(void); | ||||
| void UI_editsource_active_but_test(uiBut *but); | void UI_editsource_active_but_test(uiBut *but); | ||||
| /** | |||||
| * Remove the editsource data for \a old_but and reinsert it for \a new_but. Use when the button | |||||
| * was reallocated, e.g. to have a new type (#ui_but_change_type()). | |||||
| */ | |||||
| void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but); | void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but); | ||||
| /** | |||||
| * Adjust the view so the rectangle of \a but is in view, with some extra margin. | |||||
| * | |||||
| * It's important that this is only executed after buttons received their final #uiBut.rect. E.g. | |||||
| * #UI_panels_end() modifies them, so if that is executed, this function must not be called before | |||||
| * it. | |||||
| * | |||||
| * \param region: The region the button is placed in. Make sure this is actually the one the button | |||||
| * is placed in, not just the context region. | |||||
| */ | |||||
| void UI_but_ensure_in_view(const struct bContext *C, struct ARegion *region, const uiBut *but); | void UI_but_ensure_in_view(const struct bContext *C, struct ARegion *region, const uiBut *but); | ||||
| /* UI_butstore_ helpers */ | /* UI_butstore_ helpers */ | ||||
| typedef struct uiButStore uiButStore; | typedef struct uiButStore uiButStore; | ||||
| typedef struct uiButStoreElem uiButStoreElem; | typedef struct uiButStoreElem uiButStoreElem; | ||||
| /** | |||||
| * Create a new button store, the caller must manage and run #UI_butstore_free | |||||
| */ | |||||
| uiButStore *UI_butstore_create(uiBlock *block); | uiButStore *UI_butstore_create(uiBlock *block); | ||||
| /** | |||||
| * NULL all pointers, don't free since the owner needs to be able to inspect. | |||||
| */ | |||||
| void UI_butstore_clear(uiBlock *block); | void UI_butstore_clear(uiBlock *block); | ||||
| /** | |||||
| * Map freed buttons from the old block and update pointers. | |||||
| */ | |||||
| void UI_butstore_update(uiBlock *block); | void UI_butstore_update(uiBlock *block); | ||||
| void UI_butstore_free(uiBlock *block, uiButStore *bs); | void UI_butstore_free(uiBlock *block, uiButStore *bs); | ||||
| bool UI_butstore_is_valid(uiButStore *bs); | bool UI_butstore_is_valid(uiButStore *bs); | ||||
| bool UI_butstore_is_registered(uiBlock *block, uiBut *but); | bool UI_butstore_is_registered(uiBlock *block, uiBut *but); | ||||
| void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p); | void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p); | ||||
| /** | |||||
| * Update the pointer for a registered button. | |||||
| */ | |||||
| bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src); | bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src); | ||||
| void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); | void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); | ||||
| /* ui_interface_region_tooltip.c */ | /* ui_interface_region_tooltip.c */ | ||||
| /** | |||||
| * \param is_label: When true, show a small tip that only shows the name, otherwise show the full | |||||
| * tooltip. | |||||
| */ | |||||
| struct ARegion *UI_tooltip_create_from_button(struct bContext *C, | struct ARegion *UI_tooltip_create_from_button(struct bContext *C, | ||||
| struct ARegion *butregion, | struct ARegion *butregion, | ||||
| uiBut *but, | uiBut *but, | ||||
| bool is_label); | bool is_label); | ||||
| struct ARegion *UI_tooltip_create_from_button_or_extra_icon(struct bContext *C, | struct ARegion *UI_tooltip_create_from_button_or_extra_icon(struct bContext *C, | ||||
| struct ARegion *butregion, | struct ARegion *butregion, | ||||
| uiBut *but, | uiBut *but, | ||||
| uiButExtraOpIcon *extra_icon, | uiButExtraOpIcon *extra_icon, | ||||
| bool is_label); | bool is_label); | ||||
| struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz); | struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz); | ||||
| void UI_tooltip_free(struct bContext *C, struct bScreen *screen, struct ARegion *region); | void UI_tooltip_free(struct bContext *C, struct bScreen *screen, struct ARegion *region); | ||||
| typedef struct { | typedef struct { | ||||
| /** A description for the item, e.g. what happens when selecting it. */ | /** A description for the item, e.g. what happens when selecting it. */ | ||||
| char description[UI_MAX_DRAW_STR]; | char description[UI_MAX_DRAW_STR]; | ||||
| /* The full name of the item, without prefixes or suffixes (e.g. hint with UI_SEP_CHARP). */ | /* The full name of the item, without prefixes or suffixes (e.g. hint with UI_SEP_CHARP). */ | ||||
| const char *name; | const char *name; | ||||
| /** Additional info about the item (e.g. library name of a linked data-block). */ | /** Additional info about the item (e.g. library name of a linked data-block). */ | ||||
| char hint[UI_MAX_DRAW_STR]; | char hint[UI_MAX_DRAW_STR]; | ||||
| } uiSearchItemTooltipData; | } uiSearchItemTooltipData; | ||||
| /** | |||||
| * Create a tooltip from search-item tooltip data \a item_tooltip data. | |||||
| * To be called from a callback set with #UI_but_func_search_set_tooltip(). | |||||
| * | |||||
| * \param item_rect: Rectangle of the search item in search region space (#ui_searchbox_butrect()) | |||||
| * which is passed to the tooltip callback. | |||||
| */ | |||||
| struct ARegion *UI_tooltip_create_from_search_item_generic( | struct ARegion *UI_tooltip_create_from_search_item_generic( | ||||
| struct bContext *C, | struct bContext *C, | ||||
| const struct ARegion *searchbox_region, | const struct ARegion *searchbox_region, | ||||
| const struct rcti *item_rect, | const struct rcti *item_rect, | ||||
| const uiSearchItemTooltipData *item_tooltip_data); | const uiSearchItemTooltipData *item_tooltip_data); | ||||
| /* How long before a tool-tip shows. */ | /* How long before a tool-tip shows. */ | ||||
| #define UI_TOOLTIP_DELAY 0.5 | #define UI_TOOLTIP_DELAY 0.5 | ||||
| #define UI_TOOLTIP_DELAY_LABEL 0.2 | #define UI_TOOLTIP_DELAY_LABEL 0.2 | ||||
| /* Float precision helpers */ | /* Float precision helpers */ | ||||
| #define UI_PRECISION_FLOAT_MAX 6 | #define UI_PRECISION_FLOAT_MAX 6 | ||||
| /* For float buttons the 'step' (or a1), is scaled */ | /* For float buttons the 'step' (or a1), is scaled */ | ||||
| #define UI_PRECISION_FLOAT_SCALE 0.01f | #define UI_PRECISION_FLOAT_SCALE 0.01f | ||||
| /* Typical UI text */ | /* Typical UI text */ | ||||
| #define UI_FSTYLE_WIDGET (const uiFontStyle *)&(UI_style_get()->widget) | #define UI_FSTYLE_WIDGET (const uiFontStyle *)&(UI_style_get()->widget) | ||||
| /** | |||||
| * Returns the best "UI" precision for given floating value, | |||||
| * so that e.g. 10.000001 rather gets drawn as '10'... | |||||
| */ | |||||
| int UI_calc_float_precision(int prec, double value); | int UI_calc_float_precision(int prec, double value); | ||||
| /* widget batched drawing */ | /* widget batched drawing */ | ||||
| void UI_widgetbase_draw_cache_begin(void); | void UI_widgetbase_draw_cache_begin(void); | ||||
| void UI_widgetbase_draw_cache_flush(void); | void UI_widgetbase_draw_cache_flush(void); | ||||
| void UI_widgetbase_draw_cache_end(void); | void UI_widgetbase_draw_cache_end(void); | ||||
| /* Use for resetting the theme. */ | /* Use for resetting the theme. */ | ||||
| /** | |||||
| * Initialize default theme. | |||||
| * | |||||
| * \note When you add new colors, created & saved themes need initialized | |||||
| * use function below, #init_userdef_do_versions. | |||||
| */ | |||||
| void UI_theme_init_default(void); | void UI_theme_init_default(void); | ||||
| void UI_style_init_default(void); | void UI_style_init_default(void); | ||||
| void UI_interface_tag_script_reload(void); | void UI_interface_tag_script_reload(void); | ||||
| /* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */ | /* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */ | ||||
| #define USE_UI_TOOLBAR_HACK | #define USE_UI_TOOLBAR_HACK | ||||
| /* Support click-drag motion which presses the button and closes a popover (like a menu). */ | /* Support click-drag motion which presses the button and closes a popover (like a menu). */ | ||||
| #define USE_UI_POPOVER_ONCE | #define USE_UI_POPOVER_ONCE | ||||
| bool UI_tree_view_item_is_active(const uiTreeViewItemHandle *item); | bool UI_tree_view_item_is_active(const uiTreeViewItemHandle *item); | ||||
| bool UI_tree_view_item_matches(const uiTreeViewItemHandle *a, const uiTreeViewItemHandle *b); | bool UI_tree_view_item_matches(const uiTreeViewItemHandle *a, const uiTreeViewItemHandle *b); | ||||
| /** | |||||
| * Attempt to start dragging the tree-item \a item_. This will not work if the tree item doesn't | |||||
| * support dragging, i.e. it won't create a drag-controller upon request. | |||||
| * \return True if dragging started successfully, otherwise false. | |||||
| */ | |||||
| bool UI_tree_view_item_drag_start(struct bContext *C, uiTreeViewItemHandle *item_); | bool UI_tree_view_item_drag_start(struct bContext *C, uiTreeViewItemHandle *item_); | ||||
| bool UI_tree_view_item_can_drop(const uiTreeViewItemHandle *item_, | bool UI_tree_view_item_can_drop(const uiTreeViewItemHandle *item_, | ||||
| const struct wmDrag *drag, | const struct wmDrag *drag, | ||||
| const char **r_disabled_hint); | const char **r_disabled_hint); | ||||
| char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item, const struct wmDrag *drag); | char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item, const struct wmDrag *drag); | ||||
| /** | |||||
| * Let a tree-view item handle a drop event. | |||||
| * \return True if the drop was handled by the tree-view item. | |||||
| */ | |||||
| bool UI_tree_view_item_drop_handle(struct bContext *C, | bool UI_tree_view_item_drop_handle(struct bContext *C, | ||||
| uiTreeViewItemHandle *item_, | const uiTreeViewItemHandle *item_, | ||||
| const struct ListBase *drags); | const struct ListBase *drags); | ||||
| /** | |||||
| * Can \a item_handle be renamed right now? Not that this isn't just a mere wrapper around | |||||
| * #AbstractTreeViewItem::can_rename(). This also checks if there is another item being renamed, | |||||
| * and returns false if so. | |||||
| */ | |||||
| bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle); | bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle); | ||||
| void UI_tree_view_item_begin_rename(uiTreeViewItemHandle *item_handle); | void UI_tree_view_item_begin_rename(uiTreeViewItemHandle *item_handle); | ||||
| void UI_tree_view_item_context_menu_build(struct bContext *C, | void UI_tree_view_item_context_menu_build(struct bContext *C, | ||||
| const uiTreeViewItemHandle *item, | const uiTreeViewItemHandle *item, | ||||
| uiLayout *column); | uiLayout *column); | ||||
| /** | |||||
| * \param x, y: Coordinate to find a tree-row item at, in window space. | |||||
| */ | |||||
| uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const struct ARegion *region, | uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const struct ARegion *region, | ||||
| const int xy[2]) ATTR_NONNULL(1, 2); | const int xy[2]) ATTR_NONNULL(1, 2); | ||||
| uiTreeViewItemHandle *UI_block_tree_view_find_active_item(const struct ARegion *region); | uiTreeViewItemHandle *UI_block_tree_view_find_active_item(const struct ARegion *region); | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||