Simple toolbox-style menu system. Brecht will review it
though, and/or check on way to use it for menus.
I tried to avoid uiBlock and rna stuff all over. :)

Quick image test:
http://www.blender.org/bf/rt.jpg

Examples you can read in:
- editors/screen/screen_ops.c:testing123() (press F5)
- editors/object/object_edit.c:object_add_primitive_invoke()
  (press SHIFT+A)

Concept is simple:

uiMenuBegin(): returns a handle.
uiMenuEnd(): puts it all to work.

In between you can add items like:

uiMenuItemVal(): a name, icon, retval (use uiMenuFunc()) 
uiMenuItemO(): an operator + icon
uiMenuItemEnumO(): an operator, property name, value

Sublevels go easy too:

uiMenuLevel(): creates item for sublevel, with function pointer.
     Inside that function you can use all menu calls again.
     Levels can go as deep you want.

uiMenuLevelEnumO(): creates operator sublevel for an enum
This commit is contained in:
2009-01-25 20:22:05 +00:00
parent cfd9342600
commit 3c088f3434
10 changed files with 677 additions and 23 deletions

View File

@@ -219,6 +219,23 @@ void uiPupmenuNotice(struct bContext *C, char *str, ...);
void uiPupmenuError(struct bContext *C, char *str, ...);
void uiPupmenuReports(struct bContext *C, struct ReportList *reports);
/* Custom popup menus and toolbox */
typedef struct uiMenuItem uiMenuItem;
uiMenuItem *uiMenuBegin(const char *title);
void uiMenuFunc(uiMenuItem *head, void (*eventfunc)(struct bContext *, void *, int), void *argv);
void uiMenuContext(uiMenuItem *head, int opcontext);
void uiMenuItemVal(uiMenuItem *head, const char *name, int icon, int argval);
void uiMenuItemEnumO(uiMenuItem *head, char *opname, char *propname, int value);
void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname);
void uiMenuItemO(uiMenuItem *head, char *name, int icon);
void uiMenuLevel(uiMenuItem *head, const char *name, void (*newlevel)(uiMenuItem *));
void uiMenuLevelEnumO(uiMenuItem *head, char *opname, char *propname);
void uiMenuEnd(struct bContext *C, struct uiMenuItem *head);
/* Block */
uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, char *name, short dt, short font);