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

+ Collaboration diagram for Popup Menus:

Functions

t_jpopupmenu * jpopupmenu_create ()
 Create a pop-up menu. More...
 
void jpopupmenu_destroy (t_jpopupmenu *menu)
 Free a pop-up menu created with jpopupmenu_create(). More...
 
void jpopupmenu_clear (t_jpopupmenu *menu)
 Clear the conents of a pop-up menu. More...
 
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. More...
 
void jpopupmenu_setfont (t_jpopupmenu *menu, t_jfont *font)
 Set the font used by a pop-up menu. More...
 
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. More...
 
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. More...
 
void jpopupmenu_addseperator (t_jpopupmenu *menu)
 Add a separator to a pop-menu. More...
 
int jpopupmenu_popup (t_jpopupmenu *menu, t_pt screen, int defitemid)
 Tell a menu to display at a specified location. More...
 
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. More...
 
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. More...
 
int jpopupmenu_popup_belowrect (t_jpopupmenu *menu, t_rect rect, int defitemid)
 Tell a menu to display below a given rectangle in a patcher. More...
 
int jpopupmenu_popup_aboverect (t_jpopupmenu *menu, t_rect rect, int defitemid)
 Tell a menu to display above a given rectangle in a patcher. More...
 

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
menuThe pop-up menu to which the item will be added.
itemidEach menu item should be assigned a unique integer id using this parameter.
utf8TextThe text to display in for the menu item.
textColorThe color to use for the menu item, or NULL to use the default color.
checkedA non-zero value indicates that the item should have a check-mark next to it.
disabledA non-zero value indicates that the item should be disabled.
iconA 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
menuThe 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
menuThe pop-up menu to which a menu will be added as a submenu.
utf8NameThe name of the menu item.
submenuThe pop-up menu which will be used as the submenu.
disabledPass a non-zero value to disable the menu item.
void jpopupmenu_clear ( t_jpopupmenu *  menu)

Clear the conents of a pop-up menu.

Parameters
menuThe 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
menuThe 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
menuThe pop-up menu to display.
screenThe point at which to display in screen coordinates.
defitemidThe 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
menuThe pop-up menu to display.
boxThe box above which to display the menu.
viewThe patcherview for the box in which to display the menu.
offsetAn offset from the box position at which to display the menu.
defitemidThe initially choosen item id.
Returns
The item id for the item in the menu choosen by the user.
int jpopupmenu_popup_aboverect ( t_jpopupmenu *  menu,
t_rect  rect,
int  defitemid 
)

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

Parameters
menuThe pop-up menu to display.
rectThe rectangle above which to display the menu.
defitemidThe initially choosen item id.
Returns
The item id for the item in the menu choosen by the user.
int jpopupmenu_popup_belowrect ( t_jpopupmenu *  menu,
t_rect  rect,
int  defitemid 
)

Tell a menu to display below a given rectangle in a patcher.

Parameters
menuThe pop-up menu to display.
rectThe rectangle below which to display the menu.
defitemidThe 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
menuThe pop-up menu to display.
boxThe box above which to display the menu.
viewThe patcherview for the box in which to display the menu.
defitemidThe 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
menuThe pop-up menu to which the colors will be applied.
textThe text color for menu items.
bgThe background color for menu items.
highlightedtextThe text color for the highlighted menu item.
highlightedbgThe 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
menuThe pop-up menu whose font will be set.
fontA pointer to a font object, whose font info will be copied to the pop-up menu.
  Copyright © 2015, Cycling '74