Max 5 API Reference

Popup Menus
[JGraphics]

Popup menu API so externals can create popup menus that can also be drawn into. More...

Collaboration diagram for Popup Menus:

Functions

t_jpopupmenujpopupmenu_create ()
 Create a pop-up menu.
void jpopupmenu_destroy (t_jpopupmenu *menu)
 Free a pop-up menu created with jpopupmenu_create().
void jpopupmenu_clear (t_jpopupmenu *menu)
 Clear the conents of a pop-up menu.
void jpopupmenu_setcolors (t_jpopupmenu *menu, t_jrgba text, t_jrgba bg, t_jrgba highlightedtext, t_jrgba highlightedbg)
 Set the colors used by a pop-up menu.
void jpopupmenu_setfont (t_jpopupmenu *menu, t_jfont *font)
 Set the font used by a pop-up menu.
void jpopupmenu_additem (t_jpopupmenu *menu, int itemid, const char *utf8Text, t_jrgba *textColor, int checked, int disabled, t_jsurface *icon)
 Add an item to a pop-up menu.
void jpopupmenu_addsubmenu (t_jpopupmenu *menu, const char *utf8Name, t_jpopupmenu *submenu, int disabled)
 Add a pop-menu to another pop-menu as a submenu.
void jpopupmenu_addseperator (t_jpopupmenu *menu)
 Add a separator to a pop-menu.
int jpopupmenu_popup (t_jpopupmenu *menu, t_pt screen, int defitemid)
 Tell a menu to display at a specified location.
int jpopupmenu_popup_abovebox (t_jpopupmenu *menu, t_object *box, t_object *view, int offset, int defitemid)
 Tell a menu to display above a given box in a patcher.
int jpopupmenu_popup_nearbox (t_jpopupmenu *menu, t_object *box, t_object *view, int defitemid)
 Tell a menu to display near a given box in a patcher.

Detailed Description

Popup menu API so externals can create popup menus that can also be drawn into.


Function Documentation

void jpopupmenu_additem ( t_jpopupmenu menu,
int  itemid,
const char *  utf8Text,
t_jrgba textColor,
int  checked,
int  disabled,
t_jsurface icon 
)

Add an item to a pop-up menu.

Parameters:
menu The pop-up menu to which the item will be added.
itemid Each menu item should be assigned a unique integer id using this parameter.
utf8Text The text to display in for the menu item.
textColor The color to use for the menu item, or NULL to use the default color.
checked A non-zero value indicates that the item should have a check-mark next to it.
disabled A non-zero value indicates that the item should be disabled.
icon A t_jsurface will be used as an icon for the menu item if provided here. Pass NULL for no icon.
void jpopupmenu_addseperator ( t_jpopupmenu menu  ) 

Add a separator to a pop-menu.

Parameters:
menu The pop-up menu to which the separator will be added.
void jpopupmenu_addsubmenu ( t_jpopupmenu menu,
const char *  utf8Name,
t_jpopupmenu submenu,
int  disabled 
)

Add a pop-menu to another pop-menu as a submenu.

Parameters:
menu The pop-up menu to which a menu will be added as a submenu.
utf8Name The name of the menu item.
submenu The pop-up menu which will be used as the submenu.
disabled Pass a non-zero value to disable the menu item.
void jpopupmenu_clear ( t_jpopupmenu menu  ) 

Clear the conents of a pop-up menu.

Parameters:
menu The pop-up menu whose contents will be cleared.
t_jpopupmenu* jpopupmenu_create (  ) 

Create a pop-up menu.

Free this pop-up menu using jpopupmenu_destroy().

Returns:
A pointer to the newly created jpopupmenu object.
void jpopupmenu_destroy ( t_jpopupmenu menu  ) 

Free a pop-up menu created with jpopupmenu_create().

Parameters:
menu The pop-up menu to be freed.
int jpopupmenu_popup ( t_jpopupmenu menu,
t_pt  screen,
int  defitemid 
)

Tell a menu to display at a specified location.

Parameters:
menu The pop-up menu to display.
screen The point at which to display in screen coordinates.
defitemid The initially choosen item id.
Returns:
The item id for the item in the menu choosen by the user.
int jpopupmenu_popup_abovebox ( t_jpopupmenu menu,
t_object box,
t_object view,
int  offset,
int  defitemid 
)

Tell a menu to display above a given box in a patcher.

Parameters:
menu The pop-up menu to display.
box The box above which to display the menu.
view The patcherview for the box in which to display the menu.
offset An offset from the box position at which to display the menu.
defitemid The initially choosen item id.
Returns:
The item id for the item in the menu choosen by the user.
int jpopupmenu_popup_nearbox ( t_jpopupmenu menu,
t_object box,
t_object view,
int  defitemid 
)

Tell a menu to display near a given box in a patcher.

Parameters:
menu The pop-up menu to display.
box The box above which to display the menu.
view The patcherview for the box in which to display the menu.
defitemid The initially choosen item id.
Returns:
The item id for the item in the menu choosen by the user.
void jpopupmenu_setcolors ( t_jpopupmenu menu,
t_jrgba  text,
t_jrgba  bg,
t_jrgba  highlightedtext,
t_jrgba  highlightedbg 
)

Set the colors used by a pop-up menu.

Parameters:
menu The pop-up menu to which the colors will be applied.
text The text color for menu items.
bg The background color for menu items.
highlightedtext The text color for the highlighted menu item.
highlightedbg The background color the highlighted menu item.
void jpopupmenu_setfont ( t_jpopupmenu menu,
t_jfont font 
)

Set the font used by a pop-up menu.

Parameters:
menu The pop-up menu whose font will be set.
font A pointer to a font object, whose font info will be copied to the pop-up menu.

Copyright © 2008, Cycling '74