Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_intern.hh
| Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| #define PIE_CLICK_THRESHOLD_SQ 50.0f | #define PIE_CLICK_THRESHOLD_SQ 50.0f | ||||
| /** The maximum number of items a radial menu (pie menu) can contain. */ | /** The maximum number of items a radial menu (pie menu) can contain. */ | ||||
| #define PIE_MAX_ITEMS 8 | #define PIE_MAX_ITEMS 8 | ||||
| struct uiBut { | struct uiBut { | ||||
| uiBut *next, *prev; | uiBut *next = nullptr, *prev = nullptr; | ||||
| /** Pointer back to the layout item holding this button. */ | /** Pointer back to the layout item holding this button. */ | ||||
| uiLayout *layout; | uiLayout *layout = nullptr; | ||||
| int flag, drawflag; | int flag = 0; | ||||
| eButType type; | int drawflag = 0; | ||||
| eButPointerType pointype; | eButType type = eButType(0); | ||||
| short bit, bitnr, retval, strwidth, alignnr; | eButPointerType pointype = UI_BUT_POIN_NONE; | ||||
| short ofs, pos, selsta, selend; | short bit = 0, bitnr = 0, retval = 0, strwidth = 0, alignnr = 0; | ||||
| short ofs = 0, pos = 0, selsta = 0, selend = 0; | |||||
| char *str; | |||||
| char strdata[UI_MAX_NAME_STR]; | char *str = nullptr; | ||||
| char drawstr[UI_MAX_DRAW_STR]; | char strdata[UI_MAX_NAME_STR] = ""; | ||||
| char drawstr[UI_MAX_DRAW_STR] = ""; | |||||
| rctf rect; /* block relative coords */ | rctf rect = {}; /* block relative coords */ | ||||
| char *poin; | char *poin = nullptr; | ||||
| float hardmin, hardmax, softmin, softmax; | float hardmin = 0, hardmax = 0, softmin = 0, softmax = 0; | ||||
| /* both these values use depends on the button type | /* both these values use depends on the button type | ||||
| * (polymorphic struct or union would be nicer for this stuff) */ | * (polymorphic struct or union would be nicer for this stuff) */ | ||||
| /** | /** | ||||
| * For #uiBut.type: | * For #uiBut.type: | ||||
| * - UI_BTYPE_LABEL: Use `(a1 == 1.0f)` to use a2 as a blending factor (imaginative!). | * - UI_BTYPE_LABEL: Use `(a1 == 1.0f)` to use a2 as a blending factor (imaginative!). | ||||
| * - UI_BTYPE_SCROLL: Use as scroll size. | * - UI_BTYPE_SCROLL: Use as scroll size. | ||||
| * - UI_BTYPE_SEARCH_MENU: Use as number or rows. | * - UI_BTYPE_SEARCH_MENU: Use as number or rows. | ||||
| */ | */ | ||||
| float a1; | float a1 = 0; | ||||
| /** | /** | ||||
| * For #uiBut.type: | * For #uiBut.type: | ||||
| * - UI_BTYPE_HSVCIRCLE: Use to store the luminosity. | * - UI_BTYPE_HSVCIRCLE: Use to store the luminosity. | ||||
| * - UI_BTYPE_LABEL: If `(a1 == 1.0f)` use a2 as a blending factor. | * - UI_BTYPE_LABEL: If `(a1 == 1.0f)` use a2 as a blending factor. | ||||
| * - UI_BTYPE_SEARCH_MENU: Use as number or columns. | * - UI_BTYPE_SEARCH_MENU: Use as number or columns. | ||||
| */ | */ | ||||
| float a2; | float a2 = 0; | ||||
| uchar col[4]; | uchar col[4] = {0}; | ||||
| /** See \ref UI_but_func_identity_compare_set(). */ | /** See \ref UI_but_func_identity_compare_set(). */ | ||||
| uiButIdentityCompareFunc identity_cmp_func; | uiButIdentityCompareFunc identity_cmp_func = nullptr; | ||||
| uiButHandleFunc func; | uiButHandleFunc func = nullptr; | ||||
| void *func_arg1; | void *func_arg1 = nullptr; | ||||
| void *func_arg2; | void *func_arg2 = nullptr; | ||||
| uiButHandleNFunc funcN; | uiButHandleNFunc funcN = nullptr; | ||||
| void *func_argN; | void *func_argN = nullptr; | ||||
| bContextStore *context; | bContextStore *context = nullptr; | ||||
| uiButCompleteFunc autocomplete_func; | uiButCompleteFunc autocomplete_func = nullptr; | ||||
| void *autofunc_arg; | void *autofunc_arg = nullptr; | ||||
| uiButHandleRenameFunc rename_func; | uiButHandleRenameFunc rename_func = nullptr; | ||||
| void *rename_arg1; | void *rename_arg1 = nullptr; | ||||
| void *rename_orig; | void *rename_orig = nullptr; | ||||
| /** Run an action when holding the button down. */ | /** Run an action when holding the button down. */ | ||||
| uiButHandleHoldFunc hold_func; | uiButHandleHoldFunc hold_func = nullptr; | ||||
| void *hold_argN; | void *hold_argN = nullptr; | ||||
| const char *tip; | const char *tip = nullptr; | ||||
| uiButToolTipFunc tip_func; | uiButToolTipFunc tip_func = nullptr; | ||||
| void *tip_arg; | void *tip_arg = nullptr; | ||||
| uiFreeArgFunc tip_arg_free; | uiFreeArgFunc tip_arg_free = nullptr; | ||||
| /** info on why button is disabled, displayed in tooltip */ | /** info on why button is disabled, displayed in tooltip */ | ||||
| const char *disabled_info; | const char *disabled_info = nullptr; | ||||
| BIFIconID icon; | BIFIconID icon = ICON_NONE; | ||||
| /** Copied from the #uiBlock.emboss */ | /** Copied from the #uiBlock.emboss */ | ||||
| eUIEmbossType emboss; | eUIEmbossType emboss = UI_EMBOSS; | ||||
| /** direction in a pie menu, used for collision detection. */ | /** direction in a pie menu, used for collision detection. */ | ||||
| RadialDirection pie_dir; | RadialDirection pie_dir = UI_RADIAL_NONE; | ||||
| /** could be made into a single flag */ | /** could be made into a single flag */ | ||||
| bool changed; | bool changed = false; | ||||
| /** so buttons can support unit systems which are not RNA */ | /** so buttons can support unit systems which are not RNA */ | ||||
| uchar unit_type; | uchar unit_type = 0; | ||||
| short iconadd; | short iconadd = 0; | ||||
| /** #UI_BTYPE_BLOCK data */ | /** #UI_BTYPE_BLOCK data */ | ||||
| uiBlockCreateFunc block_create_func; | uiBlockCreateFunc block_create_func = nullptr; | ||||
| /** #UI_BTYPE_PULLDOWN / #UI_BTYPE_MENU data */ | /** #UI_BTYPE_PULLDOWN / #UI_BTYPE_MENU data */ | ||||
| uiMenuCreateFunc menu_create_func; | uiMenuCreateFunc menu_create_func = nullptr; | ||||
| uiMenuStepFunc menu_step_func; | uiMenuStepFunc menu_step_func = nullptr; | ||||
| /* RNA data */ | /* RNA data */ | ||||
| PointerRNA rnapoin; | PointerRNA rnapoin = {}; | ||||
| PropertyRNA *rnaprop; | PropertyRNA *rnaprop = nullptr; | ||||
| int rnaindex; | int rnaindex = 0; | ||||
| /* Operator data */ | /* Operator data */ | ||||
| wmOperatorType *optype; | wmOperatorType *optype = nullptr; | ||||
| PointerRNA *opptr; | PointerRNA *opptr = nullptr; | ||||
| wmOperatorCallContext opcontext; | wmOperatorCallContext opcontext = WM_OP_INVOKE_DEFAULT; | ||||
| /** When non-zero, this is the key used to activate a menu items (`a-z` always lower case). */ | /** When non-zero, this is the key used to activate a menu items (`a-z` always lower case). */ | ||||
| uchar menu_key; | uchar menu_key = 0; | ||||
| ListBase extra_op_icons; /** #uiButExtraOpIcon */ | ListBase extra_op_icons = {nullptr, nullptr}; /** #uiButExtraOpIcon */ | ||||
| /* Drag-able data, type is WM_DRAG_... */ | /* Drag-able data, type is WM_DRAG_... */ | ||||
| char dragtype; | char dragtype = WM_DRAG_ID; | ||||
| short dragflag; | short dragflag = 0; | ||||
| void *dragpoin; | void *dragpoin = nullptr; | ||||
| ImBuf *imb; | ImBuf *imb = nullptr; | ||||
| float imb_scale; | float imb_scale = 0; | ||||
| /** Active button data (set when the user is hovering or interacting with a button). */ | /** Active button data (set when the user is hovering or interacting with a button). */ | ||||
| uiHandleButtonData *active; | uiHandleButtonData *active = nullptr; | ||||
| /** Custom button data (borrowed, not owned). */ | /** Custom button data (borrowed, not owned). */ | ||||
| void *custom_data; | void *custom_data = nullptr; | ||||
| char *editstr; | char *editstr = nullptr; | ||||
| double *editval; | double *editval = nullptr; | ||||
| float *editvec; | float *editvec = nullptr; | ||||
| uiButPushedStateFunc pushed_state_func; | uiButPushedStateFunc pushed_state_func = nullptr; | ||||
| const void *pushed_state_arg; | const void *pushed_state_arg = nullptr; | ||||
| /** Little indicator (e.g., counter) displayed on top of some icons. */ | /** Little indicator (e.g., counter) displayed on top of some icons. */ | ||||
| IconTextOverlay icon_overlay_text; | IconTextOverlay icon_overlay_text = {}; | ||||
| /* pointer back */ | /* pointer back */ | ||||
| uiBlock *block; | uiBlock *block = nullptr; | ||||
| uiBut() = default; | |||||
| /** Performs a mostly shallow copy for now. Only contained C++ types are deep copied. */ | |||||
| uiBut(const uiBut &other) = default; | |||||
| /** Mostly shallow copy, just like copy constructor above. */ | |||||
| uiBut &operator=(const uiBut &other) = default; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_NUM */ | /** Derived struct for #UI_BTYPE_NUM */ | ||||
| struct uiButNumber { | struct uiButNumber : public uiBut { | ||||
| uiBut but; | float step_size = 0; | ||||
| float precision = 0; | |||||
| float step_size; | |||||
| float precision; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_COLOR */ | /** Derived struct for #UI_BTYPE_COLOR */ | ||||
| struct uiButColor { | struct uiButColor : public uiBut { | ||||
| uiBut but; | bool is_pallete_color = false; | ||||
| int palette_color_index = -1; | |||||
| bool is_pallete_color; | |||||
| int palette_color_index; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_TAB */ | /** Derived struct for #UI_BTYPE_TAB */ | ||||
| struct uiButTab { | struct uiButTab : public uiBut { | ||||
| uiBut but; | struct MenuType *menu = nullptr; | ||||
| struct MenuType *menu; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_SEARCH_MENU */ | /** Derived struct for #UI_BTYPE_SEARCH_MENU */ | ||||
| struct uiButSearch { | struct uiButSearch : public uiBut { | ||||
| uiBut but; | uiButSearchCreateFn popup_create_fn = nullptr; | ||||
| uiButSearchUpdateFn items_update_fn = nullptr; | |||||
| uiButSearchListenFn listen_fn = nullptr; | |||||
| uiButSearchCreateFn popup_create_fn; | void *item_active = nullptr; | ||||
| uiButSearchUpdateFn items_update_fn; | |||||
| uiButSearchListenFn listen_fn; | |||||
| void *item_active; | void *arg = nullptr; | ||||
| uiFreeArgFunc arg_free_fn = nullptr; | |||||
| void *arg; | uiButSearchContextMenuFn item_context_menu_fn = nullptr; | ||||
| uiFreeArgFunc arg_free_fn; | uiButSearchTooltipFn item_tooltip_fn = nullptr; | ||||
| uiButSearchContextMenuFn item_context_menu_fn; | |||||
| uiButSearchTooltipFn item_tooltip_fn; | |||||
| const char *item_sep_string; | const char *item_sep_string = nullptr; | ||||
| PointerRNA rnasearchpoin; | PointerRNA rnasearchpoin = {}; | ||||
| PropertyRNA *rnasearchprop; | PropertyRNA *rnasearchprop = nullptr; | ||||
| /** | /** | ||||
| * The search box only provides suggestions, it does not force | * The search box only provides suggestions, it does not force | ||||
| * the string to match one of the search items when applying. | * the string to match one of the search items when applying. | ||||
| */ | */ | ||||
| bool results_are_suggestions; | bool results_are_suggestions = false; | ||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_DECORATOR */ | /** Derived struct for #UI_BTYPE_DECORATOR */ | ||||
| struct uiButDecorator { | struct uiButDecorator : public uiBut { | ||||
| uiBut but; | struct PointerRNA rnapoin = {}; | ||||
| struct PropertyRNA *rnaprop = nullptr; | |||||
| struct PointerRNA rnapoin; | int rnaindex = -1; | ||||
| struct PropertyRNA *rnaprop; | |||||
| int rnaindex; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_PROGRESS_BAR. */ | /** Derived struct for #UI_BTYPE_PROGRESS_BAR. */ | ||||
| struct uiButProgressbar { | struct uiButProgressbar : public uiBut { | ||||
| uiBut but; | |||||
| /* 0..1 range */ | /* 0..1 range */ | ||||
| float progress; | float progress = 0; | ||||
| }; | }; | ||||
| struct uiButViewItem { | struct uiButViewItem : public uiBut { | ||||
| uiBut but; | |||||
| /* C-Handle to the view item this button was created for. */ | /* C-Handle to the view item this button was created for. */ | ||||
| uiViewItemHandle *view_item; | uiViewItemHandle *view_item = nullptr; | ||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_HSVCUBE. */ | /** Derived struct for #UI_BTYPE_HSVCUBE. */ | ||||
| struct uiButHSVCube { | struct uiButHSVCube : public uiBut { | ||||
| uiBut but; | eButGradientType gradient_type = UI_GRAD_SV; | ||||
| eButGradientType gradient_type; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_COLORBAND. */ | /** Derived struct for #UI_BTYPE_COLORBAND. */ | ||||
| struct uiButColorBand { | struct uiButColorBand : public uiBut { | ||||
| uiBut but; | ColorBand *edit_coba = nullptr; | ||||
| ColorBand *edit_coba; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_CURVEPROFILE. */ | /** Derived struct for #UI_BTYPE_CURVEPROFILE. */ | ||||
| struct uiButCurveProfile { | struct uiButCurveProfile : public uiBut { | ||||
| uiBut but; | struct CurveProfile *edit_profile = nullptr; | ||||
| struct CurveProfile *edit_profile; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_CURVE. */ | /** Derived struct for #UI_BTYPE_CURVE. */ | ||||
| struct uiButCurveMapping { | struct uiButCurveMapping : public uiBut { | ||||
| uiBut but; | struct CurveMapping *edit_cumap = nullptr; | ||||
| eButGradientType gradient_type = UI_GRAD_SV; | |||||
| struct CurveMapping *edit_cumap; | |||||
| eButGradientType gradient_type; | |||||
| }; | }; | ||||
| /** Derived struct for #UI_BTYPE_HOTKEY_EVENT. */ | /** Derived struct for #UI_BTYPE_HOTKEY_EVENT. */ | ||||
| struct uiButHotkeyEvent { | struct uiButHotkeyEvent : public uiBut { | ||||
| uiBut but; | short modifier_key = 0; | ||||
| short modifier_key; | |||||
| }; | }; | ||||
| /** | /** | ||||
| * Additional, superimposed icon for a button, invoking an operator. | * Additional, superimposed icon for a button, invoking an operator. | ||||
| */ | */ | ||||
| struct uiButExtraOpIcon { | struct uiButExtraOpIcon { | ||||
| uiButExtraOpIcon *next, *prev; | uiButExtraOpIcon *next, *prev; | ||||
| ▲ Show 20 Lines • Show All 1,088 Lines • Show Last 20 Lines | |||||