From 91240f15c54632409da3f09d1c3eb40e6f66e52d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Dec 2018 11:59:31 +1100 Subject: UI: add UILayout.direction Read only attribute, needed for introspection. --- source/blender/makesrna/intern/rna_ui.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/blender/makesrna/intern/rna_ui.c') diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index ea39ce72598..7c792f04f02 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -950,6 +950,11 @@ static void rna_UILayout_alignment_set(PointerRNA *ptr, int value) uiLayoutSetAlignment(ptr->data, value); } +static int rna_UILayout_direction_get(PointerRNA *ptr) +{ + return uiLayoutGetLocalDir(ptr->data); +} + static float rna_UILayout_scale_x_get(PointerRNA *ptr) { return uiLayoutGetScaleX(ptr->data); @@ -1035,6 +1040,12 @@ static void rna_def_ui_layout(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static const EnumPropertyItem direction_items[] = { + {UI_LAYOUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, + {UI_LAYOUT_VERTICAL, "VERTICAL", 0, "Vertical", ""}, + {0, NULL, 0, NULL, NULL} + }; + static const EnumPropertyItem emboss_items[] = { {UI_EMBOSS, "NORMAL", 0, "Normal", "Draw standard button emboss style"}, {UI_EMBOSS_NONE, "NONE", 0, "None", "Draw only text and icons"}, @@ -1067,6 +1078,11 @@ static void rna_def_ui_layout(BlenderRNA *brna) RNA_def_property_enum_items(prop, alignment_items); RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL); + prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, direction_items); + RNA_def_property_enum_funcs(prop, "rna_UILayout_direction_get", NULL, NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + #if 0 prop = RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set"); -- cgit v1.2.3