From af02a0aa4e0b80c3c1154e7be095f4a387f81179 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 22 Apr 2009 18:39:44 +0000 Subject: UI * Headers and menus can now be created in python. * Replaced the uiMenuItem functions to create menus with equivalent uiItem functions using a layout, removing duplicated code. * More uiItem functions are now exposed to python. * The text editor header, panels and one of its menus are now created in space_text.py. * Buttons window data context icon new changes depending on active object. Issues * Icons are not wrapped yet, hardcoded ints at the moment. * The ID browse template is unfinished. --- source/blender/blenkernel/BKE_screen.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/blender/blenkernel/BKE_screen.h') diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 8ac3b4b0b51..4797616a471 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -38,6 +38,7 @@ struct bScreen; struct ListBase; struct Panel; struct Header; +struct Menu; struct ScrArea; struct SpaceType; struct wmNotifier; @@ -136,6 +137,9 @@ typedef struct ARegionType { /* header type definitions */ ListBase headertypes; + /* menu type definitions */ + ListBase menutypes; + /* hardcoded constraints, smaller than these values region is not visible */ int minsizex, minsizey; /* default keymaps to add */ @@ -183,6 +187,27 @@ typedef struct HeaderType { void (*py_free)(void *py_data); } HeaderType; +/* menu types */ + +typedef struct MenuType { + struct MenuType *next, *prev; + + char idname[BKE_ST_MAXNAME]; /* unique name */ + char label[BKE_ST_MAXNAME]; /* for button text */ + int space_type; + + /* verify if the menu should draw or not */ + int (*poll)(const struct bContext *, struct MenuType *); + /* draw entirely, view changes should be handled here */ + void (*draw)(const struct bContext *, struct Menu *); + + /* python integration */ + void *py_data; + struct StructRNA *py_srna; + int (*py_call)(struct PointerRNA *, struct FunctionRNA *, struct ParameterList *); + void (*py_free)(void *py_data); +} MenuType; + /* spacetypes */ struct SpaceType *BKE_spacetype_from_id(int spaceid); struct ARegionType *BKE_regiontype_from_id(struct SpaceType *st, int regionid); -- cgit v1.2.3