4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Blender Foundation (2009)
22 * ***** END GPL LICENSE BLOCK *****
27 #include "DNA_screen_types.h"
29 #include "RNA_define.h"
30 #include "RNA_types.h"
32 #include "rna_internal.h"
33 #include "RNA_enum_types.h"
35 #include "UI_interface.h"
41 #include "MEM_guardedalloc.h"
43 #include "RNA_access.h"
45 #include "BLI_dynstr.h"
47 #include "BKE_context.h"
48 #include "BKE_report.h"
49 #include "BKE_screen.h"
53 static ARegionType *region_type_find(ReportList *reports, int space_type, int region_type)
58 st= BKE_spacetype_from_id(space_type);
60 for(art= (st)? st->regiontypes.first: NULL; art; art= art->next) {
61 if (art->regionid==region_type)
65 /* region type not found? abort */
67 BKE_report(reports, RPT_ERROR, "Region not found in spacetype.");
76 static int panel_poll(const bContext *C, PanelType *pt)
84 RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
85 func= RNA_struct_find_function(&ptr, "poll");
87 RNA_parameter_list_create(&list, &ptr, func);
88 RNA_parameter_set_lookup(&list, "context", &C);
89 pt->ext.call(&ptr, func, &list);
91 RNA_parameter_get_lookup(&list, "visible", &ret);
94 RNA_parameter_list_free(&list);
99 static void panel_draw(const bContext *C, Panel *pnl)
105 RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
106 func= RNA_struct_find_function(&ptr, "draw");
108 RNA_parameter_list_create(&list, &ptr, func);
109 RNA_parameter_set_lookup(&list, "context", &C);
110 pnl->type->ext.call(&ptr, func, &list);
112 RNA_parameter_list_free(&list);
115 static void panel_draw_header(const bContext *C, Panel *pnl)
121 RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
122 func= RNA_struct_find_function(&ptr, "draw_header");
124 RNA_parameter_list_create(&list, &ptr, func);
125 RNA_parameter_set_lookup(&list, "context", &C);
126 pnl->type->ext.call(&ptr, func, &list);
128 RNA_parameter_list_free(&list);
131 static void rna_Panel_unregister(const bContext *C, StructRNA *type)
134 PanelType *pt= RNA_struct_blender_type_get(type);
138 if(!(art=region_type_find(NULL, pt->space_type, pt->region_type)))
141 RNA_struct_free_extension(type, &pt->ext);
143 BLI_freelinkN(&art->paneltypes, pt);
144 RNA_struct_free(&BLENDER_RNA, type);
146 /* update while blender is running */
148 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
151 static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
154 PanelType *pt, dummypt = {0};
155 Panel dummypanel= {0};
157 int have_function[3];
159 /* setup dummy panel & panel type to store static properties in */
160 dummypanel.type= &dummypt;
161 RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr);
163 /* validate the python class */
164 if(validate(&dummyptr, data, have_function) != 0)
167 if(!(art=region_type_find(reports, dummypt.space_type, dummypt.region_type)))
170 /* check if we have registered this panel type before, and remove it */
171 for(pt=art->paneltypes.first; pt; pt=pt->next) {
172 if(strcmp(pt->idname, dummypt.idname) == 0) {
174 rna_Panel_unregister(C, pt->ext.srna);
176 BLI_freelinkN(&art->paneltypes, pt);
181 /* create a new panel type */
182 pt= MEM_callocN(sizeof(PanelType), "python buttons panel");
183 memcpy(pt, &dummypt, sizeof(dummypt));
185 pt->ext.srna= RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel");
189 RNA_struct_blender_type_set(pt->ext.srna, pt);
191 pt->poll= (have_function[0])? panel_poll: NULL;
192 pt->draw= (have_function[1])? panel_draw: NULL;
193 pt->draw_header= (have_function[2])? panel_draw_header: NULL;
195 BLI_addtail(&art->paneltypes, pt);
197 /* update while blender is running */
199 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
204 static StructRNA* rna_Panel_refine(PointerRNA *ptr)
206 Panel *hdr= (Panel*)ptr->data;
207 return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Panel;
212 static void header_draw(const bContext *C, Header *hdr)
218 RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr);
219 func= RNA_struct_find_function(&htr, "draw");
221 RNA_parameter_list_create(&list, &htr, func);
222 RNA_parameter_set_lookup(&list, "context", &C);
223 hdr->type->ext.call(&htr, func, &list);
225 RNA_parameter_list_free(&list);
228 static void rna_Header_unregister(const bContext *C, StructRNA *type)
231 HeaderType *ht= RNA_struct_blender_type_get(type);
235 if(!(art=region_type_find(NULL, ht->space_type, RGN_TYPE_HEADER)))
238 RNA_struct_free_extension(type, &ht->ext);
240 BLI_freelinkN(&art->headertypes, ht);
241 RNA_struct_free(&BLENDER_RNA, type);
243 /* update while blender is running */
245 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
248 static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
251 HeaderType *ht, dummyht = {0};
252 Header dummyheader= {0};
254 int have_function[1];
256 /* setup dummy header & header type to store static properties in */
257 dummyheader.type= &dummyht;
258 RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr);
260 /* validate the python class */
261 if(validate(&dummyhtr, data, have_function) != 0)
264 if(!(art=region_type_find(reports, dummyht.space_type, RGN_TYPE_HEADER)))
267 /* check if we have registered this header type before, and remove it */
268 for(ht=art->headertypes.first; ht; ht=ht->next) {
269 if(strcmp(ht->idname, dummyht.idname) == 0) {
271 rna_Header_unregister(C, ht->ext.srna);
276 /* create a new header type */
277 ht= MEM_callocN(sizeof(HeaderType), "python buttons header");
278 memcpy(ht, &dummyht, sizeof(dummyht));
280 ht->ext.srna= RNA_def_struct(&BLENDER_RNA, ht->idname, "Header");
284 RNA_struct_blender_type_set(ht->ext.srna, ht);
286 ht->draw= (have_function[0])? header_draw: NULL;
288 BLI_addtail(&art->headertypes, ht);
290 /* update while blender is running */
292 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
297 static StructRNA* rna_Header_refine(PointerRNA *htr)
299 Header *hdr= (Header*)htr->data;
300 return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Header;
305 static int menu_poll(const bContext *C, MenuType *pt)
313 RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
314 func= RNA_struct_find_function(&ptr, "poll");
316 RNA_parameter_list_create(&list, &ptr, func);
317 RNA_parameter_set_lookup(&list, "context", &C);
318 pt->ext.call(&ptr, func, &list);
320 RNA_parameter_get_lookup(&list, "visible", &ret);
323 RNA_parameter_list_free(&list);
328 static void menu_draw(const bContext *C, Menu *hdr)
334 RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr);
335 func= RNA_struct_find_function(&mtr, "draw");
337 RNA_parameter_list_create(&list, &mtr, func);
338 RNA_parameter_set_lookup(&list, "context", &C);
339 hdr->type->ext.call(&mtr, func, &list);
341 RNA_parameter_list_free(&list);
344 static void rna_Menu_unregister(const bContext *C, StructRNA *type)
347 MenuType *mt= RNA_struct_blender_type_get(type);
351 if(!(art=region_type_find(NULL, mt->space_type, RGN_TYPE_HEADER)))
354 RNA_struct_free_extension(type, &mt->ext);
356 BLI_freelinkN(&art->menutypes, mt);
357 RNA_struct_free(&BLENDER_RNA, type);
359 /* update while blender is running */
361 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
364 static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
367 MenuType *mt, dummymt = {0};
370 int have_function[2];
372 /* setup dummy menu & menu type to store static properties in */
373 dummymenu.type= &dummymt;
374 RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr);
376 /* validate the python class */
377 if(validate(&dummymtr, data, have_function) != 0)
380 if(!(art=region_type_find(reports, dummymt.space_type, RGN_TYPE_HEADER)))
383 /* check if we have registered this menu type before, and remove it */
384 mt= BKE_spacemenu_find(dummymt.idname, dummymt.space_type);
385 if(mt && mt->ext.srna)
386 rna_Menu_unregister(C, mt->ext.srna);
388 /* create a new menu type */
389 mt= MEM_callocN(sizeof(MenuType), "python buttons menu");
390 memcpy(mt, &dummymt, sizeof(dummymt));
392 mt->ext.srna= RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu");
396 RNA_struct_blender_type_set(mt->ext.srna, mt);
398 mt->poll= (have_function[0])? menu_poll: NULL;
399 mt->draw= (have_function[1])? menu_draw: NULL;
401 BLI_addtail(&art->menutypes, mt);
403 /* update while blender is running */
405 WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
410 static StructRNA* rna_Menu_refine(PointerRNA *mtr)
412 Menu *hdr= (Menu*)mtr->data;
413 return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Menu;
416 static int rna_UILayout_active_get(PointerRNA *ptr)
418 return uiLayoutGetActive(ptr->data);
421 static void rna_UILayout_active_set(PointerRNA *ptr, int value)
423 uiLayoutSetActive(ptr->data, value);
426 static void rna_UILayout_op_context_set(PointerRNA *ptr, int value)
428 uiLayoutSetOperatorContext(ptr->data, value);
431 static int rna_UILayout_op_context_get(PointerRNA *ptr)
433 return uiLayoutGetOperatorContext(ptr->data);
436 static int rna_UILayout_enabled_get(PointerRNA *ptr)
438 return uiLayoutGetEnabled(ptr->data);
441 static void rna_UILayout_enabled_set(PointerRNA *ptr, int value)
443 uiLayoutSetEnabled(ptr->data, value);
447 static int rna_UILayout_red_alert_get(PointerRNA *ptr)
449 return uiLayoutGetRedAlert(ptr->data);
452 static void rna_UILayout_red_alert_set(PointerRNA *ptr, int value)
454 uiLayoutSetRedAlert(ptr->data, value);
457 static int rna_UILayout_keep_aspect_get(PointerRNA *ptr)
459 return uiLayoutGetKeepAspect(ptr->data);
462 static void rna_UILayout_keep_aspect_set(PointerRNA *ptr, int value)
464 uiLayoutSetKeepAspect(ptr->data, value);
468 static int rna_UILayout_alignment_get(PointerRNA *ptr)
470 return uiLayoutGetAlignment(ptr->data);
473 static void rna_UILayout_alignment_set(PointerRNA *ptr, int value)
475 uiLayoutSetAlignment(ptr->data, value);
478 static float rna_UILayout_scale_x_get(PointerRNA *ptr)
480 return uiLayoutGetScaleX(ptr->data);
483 static void rna_UILayout_scale_x_set(PointerRNA *ptr, float value)
485 uiLayoutSetScaleX(ptr->data, value);
488 static float rna_UILayout_scale_y_get(PointerRNA *ptr)
490 return uiLayoutGetScaleY(ptr->data);
493 static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value)
495 uiLayoutSetScaleY(ptr->data, value);
498 static PointerRNA rna_UIListItem_layout_get(PointerRNA *ptr)
500 uiListItem *item= (uiListItem*)ptr->data;
502 RNA_pointer_create(NULL, &RNA_UILayout, item->layout, &newptr);
506 static PointerRNA rna_UIListItem_data_get(PointerRNA *ptr)
508 uiListItem *item= (uiListItem*)ptr->data;
514 static void rna_def_ui_layout(BlenderRNA *brna)
519 static EnumPropertyItem alignment_items[] = {
520 {UI_LAYOUT_ALIGN_EXPAND, "EXPAND", 0, "Expand", ""},
521 {UI_LAYOUT_ALIGN_LEFT, "LEFT", 0, "Left", ""},
522 {UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""},
523 {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", 0, "RIght", ""},
524 {0, NULL, 0, NULL, NULL}};
527 static EnumPropertyItem operator_context_items[] = {
528 {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""},
529 {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""},
530 {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""},
531 {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""},
532 {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""},
533 {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""},
534 {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
535 {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
536 {0, NULL, 0, NULL, NULL}};
540 srna= RNA_def_struct(brna, "UILayout", NULL);
541 RNA_def_struct_sdna(srna, "uiLayout");
542 RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header.");
544 prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
545 RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set");
547 prop= RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE);
548 RNA_def_property_enum_items(prop, operator_context_items);
549 RNA_def_property_enum_funcs(prop, "rna_UILayout_op_context_get", "rna_UILayout_op_context_set", NULL);
551 prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
552 RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set");
555 prop= RNA_def_property(srna, "red_alert", PROP_BOOLEAN, PROP_NONE);
556 RNA_def_property_boolean_funcs(prop, "rna_UILayout_red_alert_get", "rna_UILayout_red_alert_set");
559 prop= RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
560 RNA_def_property_enum_items(prop, alignment_items);
561 RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL);
564 prop= RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
565 RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
568 prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
569 RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL);
571 prop= RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
572 RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
574 RNA_api_ui_layout(srna);
578 srna= RNA_def_struct(brna, "UIListItem", NULL);
579 RNA_def_struct_ui_text(srna, "UI List Item", "User interface list.");
581 prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
582 RNA_def_property_struct_type(prop, "UILayout");
583 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
584 RNA_def_property_pointer_funcs(prop, "rna_UIListItem_layout_get", NULL, NULL);
586 prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
587 RNA_def_property_struct_type(prop, "AnyType");
588 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
589 RNA_def_property_pointer_funcs(prop, "rna_UIListItem_data_get", NULL, NULL);
592 static void rna_def_panel(BlenderRNA *brna)
598 srna= RNA_def_struct(brna, "Panel", NULL);
599 RNA_def_struct_ui_text(srna, "Panel", "Panel containing buttons.");
600 RNA_def_struct_sdna(srna, "Panel");
601 RNA_def_struct_refine_func(srna, "rna_Panel_refine");
602 RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister");
605 func= RNA_def_function(srna, "poll", NULL);
606 RNA_def_function_ui_description(func, "Test if the panel is visible or not.");
607 RNA_def_function_flag(func, FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
608 RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
609 RNA_def_pointer(func, "context", "Context", "", "");
612 func= RNA_def_function(srna, "draw", NULL);
613 RNA_def_function_ui_description(func, "Draw buttons into the panel UI layout.");
614 RNA_def_function_flag(func, FUNC_REGISTER);
615 RNA_def_pointer(func, "context", "Context", "", "");
617 func= RNA_def_function(srna, "draw_header", NULL);
618 RNA_def_function_ui_description(func, "Draw buttons into the panel header UI layout.");
619 RNA_def_function_flag(func, FUNC_REGISTER);
620 RNA_def_pointer(func, "context", "Context", "", "");
622 prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
623 RNA_def_property_struct_type(prop, "UILayout");
625 prop= RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
626 RNA_def_property_string_sdna(prop, NULL, "drawname");
629 prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
630 RNA_def_property_string_sdna(prop, NULL, "type->idname");
631 RNA_def_property_flag(prop, PROP_REGISTER);
633 prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
634 RNA_def_property_string_sdna(prop, NULL, "type->label");
635 RNA_def_property_flag(prop, PROP_REGISTER);
637 prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
638 RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
639 RNA_def_property_enum_items(prop, space_type_items);
640 RNA_def_property_flag(prop, PROP_REGISTER);
642 prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
643 RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
644 RNA_def_property_enum_items(prop, region_type_items);
645 RNA_def_property_flag(prop, PROP_REGISTER);
647 prop= RNA_def_property(srna, "context", PROP_STRING, PROP_NONE);
648 RNA_def_property_string_sdna(prop, NULL, "type->context");
649 RNA_def_property_flag(prop, PROP_REGISTER);
651 prop= RNA_def_property(srna, "default_closed", PROP_BOOLEAN, PROP_NONE);
652 RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
653 RNA_def_property_flag(prop, PROP_REGISTER);
655 prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
656 RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
657 RNA_def_property_flag(prop, PROP_REGISTER);
660 static void rna_def_header(BlenderRNA *brna)
666 srna= RNA_def_struct(brna, "Header", NULL);
667 RNA_def_struct_ui_text(srna, "Header", "Editor header containing buttons.");
668 RNA_def_struct_sdna(srna, "Header");
669 RNA_def_struct_refine_func(srna, "rna_Header_refine");
670 RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister");
673 func= RNA_def_function(srna, "draw", NULL);
674 RNA_def_function_ui_description(func, "Draw buttons into the header UI layout.");
675 RNA_def_function_flag(func, FUNC_REGISTER);
676 RNA_def_pointer(func, "context", "Context", "", "");
678 RNA_define_verify_sdna(0); // not in sdna
680 prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
681 RNA_def_property_pointer_sdna(prop, NULL, "layout");
682 RNA_def_property_struct_type(prop, "UILayout");
685 prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
686 RNA_def_property_string_sdna(prop, NULL, "type->idname");
687 RNA_def_property_flag(prop, PROP_REGISTER);
689 prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
690 RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
691 RNA_def_property_enum_items(prop, space_type_items);
692 RNA_def_property_flag(prop, PROP_REGISTER);
694 RNA_define_verify_sdna(1);
697 static void rna_def_menu(BlenderRNA *brna)
703 srna= RNA_def_struct(brna, "Menu", NULL);
704 RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons.");
705 RNA_def_struct_sdna(srna, "Menu");
706 RNA_def_struct_refine_func(srna, "rna_Menu_refine");
707 RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister");
710 func= RNA_def_function(srna, "poll", NULL);
711 RNA_def_function_ui_description(func, "Test if the menu is visible or not.");
712 RNA_def_function_flag(func, FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
713 RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
714 RNA_def_pointer(func, "context", "Context", "", "");
717 func= RNA_def_function(srna, "draw", NULL);
718 RNA_def_function_ui_description(func, "Draw buttons into the menu UI layout.");
719 RNA_def_function_flag(func, FUNC_REGISTER);
720 RNA_def_pointer(func, "context", "Context", "", "");
722 RNA_define_verify_sdna(0); // not in sdna
724 prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
725 RNA_def_property_pointer_sdna(prop, NULL, "layout");
726 RNA_def_property_struct_type(prop, "UILayout");
729 prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
730 RNA_def_property_string_sdna(prop, NULL, "type->idname");
731 RNA_def_property_flag(prop, PROP_REGISTER);
733 prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
734 RNA_def_property_string_sdna(prop, NULL, "type->label");
735 RNA_def_property_flag(prop, PROP_REGISTER);
737 prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
738 RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
739 RNA_def_property_enum_items(prop, space_type_items);
740 RNA_def_property_flag(prop, PROP_REGISTER);
742 RNA_define_verify_sdna(1);
745 void RNA_def_ui(BlenderRNA *brna)
747 rna_def_ui_layout(brna);
749 rna_def_header(brna);
753 #endif // RNA_RUNTIME