Re: Menus



bagfors@hpc2n.umu.se writes:

> How about looking on how gnustep does this?
> 
> looking at the screenshot at
> http://home.sprintmail.com/~mhanni/gstep-desktop-981021.jpg you will see =
> that they have next-step-like menues.  However it doesn't seam like they =
> have a global menu that changes depending on which program is in focus.  =

I thought that this is done via the dps engine, and since WindowMaker and
gnustep are somewhat related, they look the same way :-).

There is a functionality in the WindowMaker Source to let the
WindowMaker handle application specific menus. 

>From src/main.c:

---
Atom _XA_GNUSTEP_WM_ATTR;
Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
Atom _XA_GNUSTEP_WM_RESIZEBAR;

#ifdef MWM_HINTS
/* MWM support */
Atom _XA_MOTIF_WM_HINTS;
#endif

Atom _XA_WINDOWMAKER_MENU;
Atom _XA_WINDOWMAKER_WM_PROTOCOLS;
Atom _XA_WINDOWMAKER_STATE;
---

The _XA_WINDOWMAKER_MENU Atom is used to display application specific
Menus. This is done this way (from test/wtest.c)

---
WMMenu *menu;
WMMenu *submenu;

    /* create app context */
    app = WMAppCreateWithMain(dpy, DefaultScreen(dpy), leader);
    menu = WMMenuCreate(app, "Test Menu");
    submenu = WMMenuCreate(app, "File");
    WMMenuAddSubmenu(menu, "File", submenu);
    
    WMMenuAddItem(menu, "Hide", (WMMenuAction)hide, NULL, NULL, NULL);
    WMMenuAddItem(menu, "Quit", (WMMenuAction)quit, NULL, NULL, NULL);
    WMMenuAddItem(submenu, "New", (WMMenuAction)newwin, NULL, NULL, NULL);
    WMMenuAddItem(submenu, "Open", (WMMenuAction)callback, NULL, NULL, NULL);
    WMMenuAddItem(submenu, "Save", (WMMenuAction)callback, NULL, NULL, NULL);
    WMMenuAddItem(submenu, "Save As...", (WMMenuAction)callback, NULL, NULL, NUL
L);
    
    WMAppSetMainMenu(app, menu);
    
    WMRealizeMenus(app);
---

Dirk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]