Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ui_api.c
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| /* Else, default context! */ | /* Else, default context! */ | ||||
| return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text); | return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text); | ||||
| } | } | ||||
| static void rna_uiItemR( | static void rna_uiItemR( | ||||
| uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt, | uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt, | ||||
| bool translate, int icon, bool expand, bool slider, bool toggle, bool icon_only, bool event, | bool translate, int icon, bool expand, bool split_row, bool slider, bool toggle, bool icon_only, bool event, | ||||
| bool full_event, bool emboss, int index, int icon_value) | bool full_event, bool emboss, int index, int icon_value) | ||||
| { | { | ||||
| PropertyRNA *prop = RNA_struct_find_property(ptr, propname); | PropertyRNA *prop = RNA_struct_find_property(ptr, propname); | ||||
| int flag = 0; | int flag = 0; | ||||
| if (!prop) { | if (!prop) { | ||||
| RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); | RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); | ||||
| return; | return; | ||||
| } | } | ||||
| if (icon_value && !icon) { | if (icon_value && !icon) { | ||||
| icon = icon_value; | icon = icon_value; | ||||
| } | } | ||||
| /* Get translated name (label). */ | /* Get translated name (label). */ | ||||
| name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); | name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate); | ||||
| flag |= (slider) ? UI_ITEM_R_SLIDER : 0; | flag |= (slider) ? UI_ITEM_R_SLIDER : 0; | ||||
| flag |= (expand) ? UI_ITEM_R_EXPAND : 0; | flag |= (expand) ? UI_ITEM_R_EXPAND : 0; | ||||
| flag |= (split_row) ? UI_ITEM_R_SPLIT_ROW : 0; | |||||
| flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0; | flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0; | ||||
| flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0; | flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0; | ||||
| flag |= (event) ? UI_ITEM_R_EVENT : 0; | flag |= (event) ? UI_ITEM_R_EVENT : 0; | ||||
| flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0; | flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0; | ||||
| flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG; | flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG; | ||||
| uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon); | uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 547 Lines • ▼ Show 20 Lines | void RNA_api_ui_layout(StructRNA *srna) | ||||
| RNA_def_function_ui_description(func, "Return the icon for this enum item"); | RNA_def_function_ui_description(func, "Return the icon for this enum item"); | ||||
| /* items */ | /* items */ | ||||
| func = RNA_def_function(srna, "prop", "rna_uiItemR"); | func = RNA_def_function(srna, "prop", "rna_uiItemR"); | ||||
| RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); | RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); | ||||
| api_ui_item_rna_common(func); | api_ui_item_rna_common(func); | ||||
| api_ui_item_common(func); | api_ui_item_common(func); | ||||
| RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); | RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); | ||||
| RNA_def_boolean(func, "split_row", false, "", "Separator will expand to a new row"); | |||||
jbakker: Update text: "Use separator to expand to next row" | |||||
| RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); | RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); | ||||
| RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); | RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); | ||||
| RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); | RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); | ||||
| RNA_def_boolean(func, "event", false, "", "Use button to input key events"); | RNA_def_boolean(func, "event", false, "", "Use button to input key events"); | ||||
| RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers"); | RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers"); | ||||
| RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text"); | RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text"); | ||||
| RNA_def_int(func, "index", -1, -2, INT_MAX, "", | RNA_def_int(func, "index", -1, -2, INT_MAX, "", | ||||
| "The index of this button, when set a single member of an array can be accessed, " | "The index of this button, when set a single member of an array can be accessed, " | ||||
| ▲ Show 20 Lines • Show All 532 Lines • Show Last 20 Lines | |||||
Update text: "Use separator to expand to next row"