Example #1
0
static void
OpenMenu(AG_HSVPal *pal, int x, int y)
{
	if (pal->menu != NULL)
		CloseMenu(pal);

	pal->menu = AG_MenuNew(NULL, 0);
	pal->menu_item = AG_MenuNode(pal->menu->root, NULL, NULL);
	{
#if 0
		AG_MenuAction(pal->menu_item, _("Edit numerically"), NULL,
		    EditNumValues, "%p", pal);
#endif
		AG_MenuAction(pal->menu_item, _("Copy color"), agIconSave.s,
		    CopyColor, "%p", pal);
		AG_MenuAction(pal->menu_item, _("Paste color"), agIconLoad.s,
		    PasteColor, "%p", pal);
		AG_MenuAction(pal->menu_item, _("Complementary color"), NULL,
		    SetComplementaryColor, "%p", pal);
		AG_MenuSeparator(pal->menu_item);
		AG_MenuFlags(pal->menu_item, _("Show RGB value"), agIconMagnifier.s,
		    &pal->flags, AG_HSVPAL_SHOW_RGB, 0);
		AG_MenuFlags(pal->menu_item, _("Show HSV value"), agIconMagnifier.s,
		    &pal->flags, AG_HSVPAL_SHOW_HSV, 0);
	}
	pal->menu->itemSel = pal->menu_item;
	pal->menu_win = AG_MenuExpand(pal, pal->menu_item, x, y);
}
Example #2
0
/* Display a generic popup menu for the display background. */
void
AG_WM_BackgroundPopupMenu(AG_DriverSw *dsw)
{
	AG_Menu *me;
	AG_MenuItem *mi;
	AG_Window *win;
	int nWindows = 0;

	me = AG_MenuNew(NULL, 0);
	mi = me->itemSel = AG_MenuNode(me->root, NULL, NULL);

	AG_FOREACH_WINDOW_REVERSE(win, dsw) {
		if (strcmp(win->caption, "win-popup") == 0) {
			continue;
		}
		AG_MenuAction(mi,
		    win->caption[0] != '\0' ? win->caption : _("Untitled"),
		    agIconWinMaximize.s,
		    UnminimizeWindow, "%p", win);
		nWindows++;
	}
	if (nWindows > 0) {
		AG_MenuSeparator(mi);
	}
#ifdef AG_DEBUG
	AG_MenuAction(mi, _("GUI debugger"), agIconMagnifier.s,
	    OpenGuiDebugger, NULL);
#endif
	AG_MenuAction(mi, _("Exit application"), agIconWinClose.s,
	    ExitApplication, NULL);
				
	AG_MenuExpand(NULL, mi,
	    AGDRIVER(dsw)->mouse->x + 4,
	    AGDRIVER(dsw)->mouse->y + 4);
}