diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 05:26:17 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-21 05:26:17 +0400 |
commit | a78ef19054af921c536f647bd84ed9fd2636bfe0 (patch) | |
tree | 47e5912921bf0b17832495d9eb525f75427de2b1 /source/blender/makesrna/intern | |
parent | f682de6fd2b4b64bc405f36f68c4024797b84492 (diff) |
2.5: UI
* List template visual changes. Items now look different,
and it expands to size 5 as more items are added.
* Added LISTROW and LISTBOX elements. The former is like
a typical ROW button, but looks diffrent. The latter
looks like a BOUNDBOX, and has no extra features yet.
* Fix some glColor3ubv warnings with casting, did not find
a nicer way.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 75 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 6 |
3 files changed, 70 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index e83557957f6..8a51a5f4142 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -199,7 +199,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi return pt->py_srna; } -static StructRNA* rna_Panel_refine(struct PointerRNA *ptr) +static StructRNA* rna_Panel_refine(PointerRNA *ptr) { Panel *hdr= (Panel*)ptr->data; return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Panel; @@ -290,7 +290,7 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo return ht->py_srna; } -static StructRNA* rna_Header_refine(struct PointerRNA *htr) +static StructRNA* rna_Header_refine(PointerRNA *htr) { Header *hdr= (Header*)htr->data; return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Header; @@ -405,92 +405,108 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void return mt->py_srna; } -static StructRNA* rna_Menu_refine(struct PointerRNA *mtr) +static StructRNA* rna_Menu_refine(PointerRNA *mtr) { Menu *hdr= (Menu*)mtr->data; return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Menu; } -static int rna_UILayout_active_get(struct PointerRNA *ptr) +static int rna_UILayout_active_get(PointerRNA *ptr) { return uiLayoutGetActive(ptr->data); } -static void rna_UILayout_active_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_active_set(PointerRNA *ptr, int value) { uiLayoutSetActive(ptr->data, value); } -static void rna_UILayout_op_context_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_op_context_set(PointerRNA *ptr, int value) { uiLayoutSetOperatorContext(ptr->data, value); } -static int rna_UILayout_op_context_get(struct PointerRNA *ptr) +static int rna_UILayout_op_context_get(PointerRNA *ptr) { return uiLayoutGetOperatorContext(ptr->data); } -static int rna_UILayout_enabled_get(struct PointerRNA *ptr) +static int rna_UILayout_enabled_get(PointerRNA *ptr) { return uiLayoutGetEnabled(ptr->data); } -static void rna_UILayout_enabled_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_enabled_set(PointerRNA *ptr, int value) { uiLayoutSetEnabled(ptr->data, value); } -static int rna_UILayout_red_alert_get(struct PointerRNA *ptr) +#if 0 +static int rna_UILayout_red_alert_get(PointerRNA *ptr) { return uiLayoutGetRedAlert(ptr->data); } -static void rna_UILayout_red_alert_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_red_alert_set(PointerRNA *ptr, int value) { uiLayoutSetRedAlert(ptr->data, value); } -static int rna_UILayout_keep_aspect_get(struct PointerRNA *ptr) +static int rna_UILayout_keep_aspect_get(PointerRNA *ptr) { return uiLayoutGetKeepAspect(ptr->data); } -static void rna_UILayout_keep_aspect_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_keep_aspect_set(PointerRNA *ptr, int value) { uiLayoutSetKeepAspect(ptr->data, value); } +#endif -static int rna_UILayout_alignment_get(struct PointerRNA *ptr) +static int rna_UILayout_alignment_get(PointerRNA *ptr) { return uiLayoutGetAlignment(ptr->data); } -static void rna_UILayout_alignment_set(struct PointerRNA *ptr, int value) +static void rna_UILayout_alignment_set(PointerRNA *ptr, int value) { uiLayoutSetAlignment(ptr->data, value); } -static float rna_UILayout_scale_x_get(struct PointerRNA *ptr) +static float rna_UILayout_scale_x_get(PointerRNA *ptr) { return uiLayoutGetScaleX(ptr->data); } -static void rna_UILayout_scale_x_set(struct PointerRNA *ptr, float value) +static void rna_UILayout_scale_x_set(PointerRNA *ptr, float value) { uiLayoutSetScaleX(ptr->data, value); } -static float rna_UILayout_scale_y_get(struct PointerRNA *ptr) +static float rna_UILayout_scale_y_get(PointerRNA *ptr) { return uiLayoutGetScaleY(ptr->data); } -static void rna_UILayout_scale_y_set(struct PointerRNA *ptr, float value) +static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value) { uiLayoutSetScaleY(ptr->data, value); } +static PointerRNA rna_UIListItem_layout_get(PointerRNA *ptr) +{ + uiListItem *item= (uiListItem*)ptr->data; + PointerRNA newptr; + RNA_pointer_create(NULL, &RNA_UILayout, item->layout, &newptr); + return newptr; +} + +static PointerRNA rna_UIListItem_data_get(PointerRNA *ptr) +{ + uiListItem *item= (uiListItem*)ptr->data; + return item->data; +} + #else // RNA_RUNTIME static void rna_def_ui_layout(BlenderRNA *brna) @@ -516,6 +532,8 @@ static void rna_def_ui_layout(BlenderRNA *brna) {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""}, {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""}, {0, NULL, 0, NULL, NULL}}; + + /* layout */ srna= RNA_def_struct(brna, "UILayout", NULL); RNA_def_struct_sdna(srna, "uiLayout"); @@ -531,15 +549,19 @@ static void rna_def_ui_layout(BlenderRNA *brna) prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set"); +#if 0 prop= RNA_def_property(srna, "red_alert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_red_alert_get", "rna_UILayout_red_alert_set"); +#endif prop= RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, alignment_items); RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL); +#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"); +#endif prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL); @@ -548,6 +570,21 @@ static void rna_def_ui_layout(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL); RNA_api_ui_layout(srna); + + /* list item */ + + srna= RNA_def_struct(brna, "UIListItem", NULL); + RNA_def_struct_ui_text(srna, "UI List Item", "User interface list."); + + prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "UILayout"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, "rna_UIListItem_layout_get", NULL, NULL); + + prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "AnyType"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, "rna_UIListItem_data_get", NULL, NULL); } static void rna_def_panel(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 404befc9bb2..e89e633acbe 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -86,6 +86,12 @@ void RNA_api_ui_layout(StructRNA *srna) {'v', "VECTOR", 0, "Vector", ""}, {'c', "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem list_type_items[] = { + {0, "DEFAULT", 0, "None", ""}, + {'c', "COMPACT", 0, "Compact", ""}, + {'i', "ICONS", 0, "Icons", ""}, + {0, NULL, 0, NULL, NULL}}; /* simple layout specifiers */ func= RNA_def_function(srna, "row", "uiLayoutRow"); @@ -258,14 +264,14 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); func= RNA_def_function(srna, "template_list", "uiTemplateList"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm= RNA_def_pointer(func, "active_data", "AnyType", "", "Data from which to take property for the active element."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element."); RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display.", 0, INT_MAX); - parm= RNA_def_int(func, "columns", 5, 0, INT_MAX, "", "Number of columns to display.", 0, INT_MAX); - parm= RNA_def_boolean(func, "compact", 0, "", "Use compact, single row list template."); + parm= RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use."); parm= RNA_def_collection(func, "items", 0, "", "Items visible in the list."); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 5235883e408..f9aa27fcdbd 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -410,6 +410,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Scroll Widget Colors", ""); RNA_def_property_update(prop, NC_WINDOW, NULL); + prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "wcol_list_item"); + RNA_def_property_struct_type(prop, "ThemeWidgetColors"); + RNA_def_property_ui_text(prop, "List Item Colors", ""); + RNA_def_property_update(prop, NC_WINDOW, NULL); + prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_state"); RNA_def_property_struct_type(prop, "ThemeWidgetStateColors"); |