Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2019-09-09 17:34:16 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-09-09 17:37:47 +0300
commit828905190e12432228d88563e0dcb74054b488a9 (patch)
treef75e765cdbc5b31ca0b88eff0bf5c3b886b29682 /source/blender/editors/interface/interface_intern.h
parent9b6233b27ceda18e6c3f582259b9da6a3207aa2d (diff)
UI: Refactor and improve buttton extra icons
Without this patch there could only be one superimposed icon and the operators were hard coded for the button types. This keeps the previous, sort of predefined extra icons working in a rather generic way, but allows adding specific ones for specific case through `UI_but_extra_operator_icon_set()`. Reviewed by: Campbell Barton Differential Revision: https://developer.blender.org/D5730
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r--source/blender/editors/interface/interface_intern.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 9705f0fa161..5c73b41b778 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -78,14 +78,6 @@ enum {
/* warn: rest of uiBut->flag in UI_interface.h */
};
-/* some buttons display icons only under special conditions
- * (e.g. 'x' icon in search menu) - used with ui_but_icon_extra_get */
-typedef enum uiButExtraIconType {
- UI_BUT_ICONEXTRA_NONE = 1,
- UI_BUT_ICONEXTRA_CLEAR,
- UI_BUT_ICONEXTRA_EYEDROPPER,
-} uiButExtraIconType;
-
/* uiBut->dragflag */
enum {
UI_BUT_DRAGPOIN_FREE = (1 << 0),
@@ -262,6 +254,8 @@ struct uiBut {
short opcontext;
uchar menu_key; /* 'a'-'z', always lower case */
+ ListBase extra_op_icons; /* uiButExtraOpIcon */
+
/* Draggable data, type is WM_DRAG_... */
char dragtype;
short dragflag;
@@ -293,6 +287,16 @@ typedef struct uiButTab {
struct MenuType *menu;
} uiButTab;
+/**
+ * Additional, superimposed icon for a button, invoking an operator.
+ */
+typedef struct uiButExtraOpIcon {
+ struct uiButExtraOpIcon *next, *prev;
+
+ BIFIconID icon;
+ struct wmOperatorCallParams *optype_params;
+} uiButExtraOpIcon;
+
typedef struct ColorPicker {
struct ColorPicker *next, *prev;
/** Color data, may be HSV or HSL. */
@@ -497,14 +501,17 @@ extern bool ui_but_string_set_eval_num(struct bContext *C,
const char *str,
double *value) ATTR_NONNULL();
extern int ui_but_string_get_max_length(uiBut *but);
+/* Clear & exit the active button's string. */
+extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but) ATTR_NONNULL();
extern uiBut *ui_but_drag_multi_edit_get(uiBut *but);
void ui_def_but_icon(uiBut *but, const int icon, const int flag);
void ui_def_but_icon_clear(uiBut *but);
-extern uiButExtraIconType ui_but_icon_extra_get(uiBut *but);
extern void ui_but_default_set(struct bContext *C, const bool all, const bool use_afterfunc);
+void ui_but_extra_operator_icons_free(uiBut *but);
+
extern void ui_but_rna_menu_convert_to_panel_type(struct uiBut *but, const char *panel_type);
extern void ui_but_rna_menu_convert_to_menu_type(struct uiBut *but, const char *menu_type);
extern bool ui_but_menu_draw_as_popover(const uiBut *but);