home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- #include <gl.h>
- #include <device.h>
- #include "generic.h"
- #include "cmds.h"
- #include "showcaseui.h"
-
- /* pulldown.c makes a pull-down menu bar across the top of the
- * application. It has a File menu and a Help menu. In addition,
- * it has an Edit menu with one 'Touch' entry for the benefit of
- * the generic application. If you don't want a pull-down, get
- * rid of this file, and the external calls to makepulldown(),
- * remakepulldown(), and to pulldonwevent();
- */
-
- #define MENUCOUNT 3
-
- static PullDown *menu[MENUCOUNT];
- static MenuBar *mb = 0;
-
- long uiinited = 0; /* in case you're using libui.a */
-
- void makepulldown()
- {
- if (!uiinited) {
- uiinited = 1;
- initui();
- }
- initpd();
- if (mb == 0) mb = newmenubar();
- menu[0] = newpd(mb, "File");
- menu[1] = newpd(mb, "Edit");
- menu[2] = newpd(mb, "Help");
- loadpd(menu[0],"New%x100001%an|Open ...%x100002%ao|Save ...%x100003%as|Save As ...%x100004%aS|Insert ...%x100005|Print%x100006%ap|Print EPS%x100010|Quit%x100007%aq");
- loadpd(menu[1],"Edit Geom %x200038%ae|Delete Seln %x200020%ad|Describe %x200037");
- loadpd(menu[2],"Help%x100008");
- loadmenubar(mb, MENUCOUNT, menu);
- }
-
- void drawpulldown()
- {
- pushviewport();
- viewport(0, (short)(xsize - 1), 0, (short)(ysize - 1));
- savemat();
- ortho2(-0.5, xsize-0.5, -0.5, ysize-0.5);
- if (mb) drawmenubar(mb);
- restoremat();
- popviewport();
- }
-
- long pulldownevent(long mx, long my)
- {
- long selection;
- if (inmenubar(mb, mx, my) != -1) {
- selection = dopulldown(mb);
- return selection;
- }
- return -1;
- }
-
- void remakepulldown()
- {
- if (mb) movemenubar(mb);
- }
-