diff options
author | Antonioya <blendergit@gmail.com> | 2018-09-25 21:59:04 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-09-25 21:59:04 +0300 |
commit | f4f99d1d7557eadec49113e743c49db2356d62af (patch) | |
tree | ddf99a2cd649b9e4900e5a2476516e15f8d77d08 /source/blender/makesrna/intern/rna_ui.c | |
parent | 0f7e858f069d7d4f00bdcaa68e293b7b48bda3fc (diff) |
Add fixed width/height parameter for layouts
New parameters to define a fixed size for a layout. This allows to avoid UI changes when the text length changes.
This commit implements D3725
Diffstat (limited to 'source/blender/makesrna/intern/rna_ui.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 9ea51247ed4..eccf0e73d8e 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -947,6 +947,26 @@ static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value) uiLayoutSetScaleY(ptr->data, value); } +static int rna_UILayout_units_x_get(PointerRNA *ptr) +{ + return uiLayoutGetUnitsX(ptr->data); +} + +static void rna_UILayout_units_x_set(PointerRNA *ptr, int value) +{ + uiLayoutSetUnitsX(ptr->data, value); +} + +static int rna_UILayout_units_y_get(PointerRNA *ptr) +{ + return uiLayoutGetUnitsY(ptr->data); +} + +static void rna_UILayout_units_y_set(PointerRNA *ptr, int value) +{ + uiLayoutSetUnitsY(ptr->data, value); +} + static int rna_UILayout_emboss_get(PointerRNA *ptr) { return uiLayoutGetEmboss(ptr->data); @@ -1036,6 +1056,14 @@ static void rna_def_ui_layout(BlenderRNA *brna) prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL); RNA_def_property_ui_text(prop, "Scale Y", "Scale factor along the Y for items in this (sub)layout"); + + prop = RNA_def_property(srna, "ui_units_x", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_UILayout_units_x_get", "rna_UILayout_units_x_set", NULL); + RNA_def_property_ui_text(prop, "Units X", "Fixed Size along the X for items in this (sub)layout"); + + prop = RNA_def_property(srna, "ui_units_y", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_funcs(prop, "rna_UILayout_units_y_get", "rna_UILayout_units_y_set", NULL); + RNA_def_property_ui_text(prop, "Units Y", "Fixed Size along the Y for items in this (sub)layout"); RNA_api_ui_layout(srna); prop = RNA_def_property(srna, "emboss", PROP_ENUM, PROP_NONE); |