diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index bf5ffa20986..9377ef8a925 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -275,6 +275,29 @@ static void rna_uiItemM( uiItemM(layout, C, menuname, name, icon); } +static void rna_uiItemPopoverPanel( + uiLayout *layout, bContext *C, + int space_type, int region_type, const char *panel_type, + const char *name, const char *text_ctxt, + int translate, int icon, int icon_value) +{ + /* Get translated name (label). */ + name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); + + if (icon_value && !icon) { + icon = icon_value; + } + + uiItemPopoverPanel(layout, C, space_type, region_type, panel_type, name, icon); +} + +static void rna_uiItemPopoverPanelFromGroup( + uiLayout *layout, bContext *C, + int space_id, int region_id, const char *context, const char *category) +{ + uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category); +} + static void rna_uiTemplateAnyID( uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, const char *name, const char *text_ctxt, int translate) @@ -495,6 +518,19 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_return(func, parm); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); + func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow"); + RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column"); + RNA_def_int(func, "num_columns", 0, INT_MIN, INT_MAX, "", + "Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are " + "automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. " + "columns for row major layout, and 2, 4, 6 etc. rows for column major layout)", + INT_MIN, INT_MAX); + RNA_def_boolean(func, "even_columns", false, "", "All columns will have the same width"); + RNA_def_boolean(func, "even_rows", false, "", "All rows will have the same height"); + RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); + parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); + RNA_def_function_return(func, parm); + /* box layout */ func = RNA_def_function(srna, "box", "uiLayoutBox"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); @@ -680,9 +716,35 @@ void RNA_api_ui_layout(StructRNA *srna) parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); + func = RNA_def_function(srna, "popover", "rna_uiItemPopoverPanel"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_string(func, "panel_type", NULL, 0, "", "Identifier of the panel"); + api_ui_item_common(func); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); + + func = RNA_def_function(srna, "popover_group", "rna_uiItemPopoverPanelFromGroup"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_string(func, "context", NULL, 0, "", "panel type context"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_string(func, "category", NULL, 0, "", "panel type category"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + func = RNA_def_function(srna, "separator", "uiItemS"); RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items"); + func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer"); + RNA_def_function_ui_description(func, "Item. Inserts horizontal spacing empty space into the layout between items"); + /* context */ func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer"); parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context"); @@ -725,6 +787,39 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); api_ui_item_common_text(func); + func = RNA_def_function(srna, "template_ID_tabs", "uiTemplateIDTabs"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block"); + RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block"); + RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block"); + RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL, + "", "Optionally limit the items which can be selected"); + + func = RNA_def_function(srna, "template_search", "uiTemplateSearch"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection"); + RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink or delete the active " + "item from the collection"); + + func = RNA_def_function(srna, "template_search_preview", "uiTemplateSearchPreview"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + api_ui_item_rna_common(func); + parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection"); + RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink or delete the active " + "item from the collection"); + RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX); + RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); + func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); @@ -774,6 +869,12 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); + func = RNA_def_function(srna, "template_icon", "uiTemplateIcon"); + RNA_def_function_ui_description(func, "Display a large icon"); + parm = RNA_def_int(func, "icon_value", 0, 0, INT_MAX, "Icon to display", "", 0, INT_MAX); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + RNA_def_float(func, "scale", 1.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f); + func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView"); RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews"); api_ui_item_rna_common(func); @@ -909,6 +1010,9 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Inserts common 3DView header UI (selectors for context mode, shading, etc.)"); + func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + RNA_def_function_ui_description(func, ""); func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); |