Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

glutcreatemenu(3glut) [osx man page]

glutCreateMenu(3GLUT)						       GLUT						     glutCreateMenu(3GLUT)

glutCreateMenu - creates a new pop-up menu. SYNTAX
#include <GLUT/glut.h> int glutCreateMenu(void (*func)(int value)); ARGUMENTS
func The callback function for the menu that is called when a menu entry from the menu is selected. The value passed to the callback is determined by the value for the selected menu entry. DESCRIPTION
glutCreateMenu creates a new pop-up menu and returns a unique small integer identifier. The range of allocated identifiers starts at one. The menu identifier range is separate from the window identifier range. Implicitly, the current menu is set to the newly created menu. This menu identifier can be used when calling glutSetMenu. When the menu callback is called because a menu entry is selected for the menu, the current menu will be implicitly set to the menu with the selected entry before the callback is made. EXAMPLE
Here is a quick example of how to create a GLUT popup menu with two submenus and attach it to the right button of the current window: int submenu1, submenu2; submenu1 = glutCreateMenu(selectMessage); glutAddMenuEntry("abc", 1); glutAddMenuEntry("ABC", 2); submenu2 = glutCreateMenu(selectColor); glutAddMenuEntry("Green", 1); glutAddMenuEntry("Red", 2); glutAddMenuEntry("White", 3); glutCreateMenu(selectFont); glutAddMenuEntry("9 by 15", 0); glutAddMenuEntry("Times Roman 10", 1); glutAddMenuEntry("Times Roman 24", 2); glutAddSubMenu("Messages", submenu1); glutAddSubMenu("Color", submenu2); glutAttachMenu(GLUT_RIGHT_BUTTON); X IMPLEMENTATION NOTES
If available, GLUT for X will take advantage of overlay planes for implementing pop-up menus. The use of overlay planes can eliminate dis- play callbacks when pop-up menus are deactivated. The SERVER_OVERLAY_VISUALS convention is used to determine if overlay visuals are avail- able. SEE ALSO
glutCreateWindow, glutDestroyMenu, glutSetMenu, glutAttachMenu AUTHOR
Mark J. Kilgard ( GLUT
3.7 glutCreateMenu(3GLUT)

Check Out this Related Man Page

glutMenuStatusFunc(3GLUT)					       GLUT						 glutMenuStatusFunc(3GLUT)

glutMenuStatusFunc - sets the global menu status callback. SYNTAX
#include <GLUT/glut.h> void glutMenuStatusFunc(void (*func)(int status, int x, int y)); void glutMenuStateFunc(void (*func)(int status)); ARGUMENTS
func The new menu status (or state) callback function. DESCRIPTION
glutMenuStatusFunc sets the global menu status callback so a GLUT program can determine when a menu is in use or not. When a menu status callback is registered, it will be called with the value GLUT_MENU_IN_USE for its value parameter when pop-up menus are in use by the user; and the callback will be called with the value GLUT_MENU_NOT_IN_USE for its status parameter when pop-up menus are no longer in use. The x and y parameters indicate the location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window). The func parameter names the callback function. Other callbacks continue to operate (except mouse motion callbacks) when pop-up menus are in use so the menu status callback allows a program to suspend animation or other tasks when menus are in use. The cascading and unmapping of sub-menus from an initial pop-up menu does not generate menu status callbacks. There is a single menu status callback for GLUT. When the menu status callback is called, the current menu will be set to the initial pop-up menu in both the GLUT_MENU_IN_USE and GLUT_MENU_NOT_IN_USE cases. The current window will be set to the window from which the initial menu was popped up from, also in both cases. Passing NULL to glutMenuStatusFunc disables the generation of the menu status callback. glutMenuStateFunc is a deprecated version of the glutMenuStatusFunc routine. The only difference is glutMenuStateFunc callback prototype does not deliver the two additional x and y coordinates. SEE ALSO
glutCreateMenu, glutCreateWindow AUTHOR
Mark J. Kilgard ( GLUT
3.7 glutMenuStatusFunc(3GLUT)
Man Page