1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. Copyright (C) 1999, Jake Hamby.
4 * This program is freely distributable without licensing fees
5 * and is provided without guarantee or warrantee expressed or
6 * implied. This program is -not- in the public domain.
10 * DESCRIPTION: the GlutMenu class is a simple popup menu
11 ***********************************************************/
13 /***********************************************************
15 ***********************************************************/
19 #include <PopUpMenu.h>
21 /***********************************************************
23 ***********************************************************/
24 const int32 MENU_ITEM
= 'menu';
26 /***********************************************************
28 ***********************************************************/
33 GlutMenu(int n_id
, GLUTselectCB n_select
) {
40 BMenu
*CreateBMenu(bool toplevel
=true); // construct BPopUpMenu
44 GLUTselectCB select
; // callback function
45 GlutMenuItem
*list
; // list of menu items
46 int num
; // number of items
49 /***********************************************************
51 ***********************************************************/
54 GlutMenuItem(GlutMenu
*n_menu
, bool n_trig
, int n_value
, const char *n_label
);
57 GlutMenu
*menu
; // parent menu
58 bool isTrigger
; // are we a submenu?
59 int value
; // value to send, or submenu id if isTrigger
60 char *label
; // strdup'ed label string
61 GlutMenuItem
*next
; // next menu entry on list
64 /***********************************************************
66 ***********************************************************/
67 class GlutPopUp
: public BPopUpMenu
{
69 GlutPopUp(int m
) : BPopUpMenu(0, false, false) { menu
= m
;}
71 BPoint point
; // point to start menu
72 GlutWindow
*win
; // pointer to my window
73 int menu
; // my menu number
76 /***********************************************************
77 * CLASS: GlutBMenuItem
78 ***********************************************************/
79 class GlutBMenuItem
: public BMenuItem
{
81 GlutBMenuItem(const char *name
) : BMenuItem(name
, 0) {}
82 GlutBMenuItem(BMenu
* menu
) : BMenuItem(menu
) {}