示例#1
0
文件: Menu.c 项目: awmaker/awmaker
static WMPropList *processSubmenu(WEditMenu * menu)
{
	WEditMenuItem *item;
	WMPropList *pmenu;
	WMPropList *pl;
	char *s;
	int i;

	s = WGetEditMenuTitle(menu);
	pl = WMCreatePLString(s);

	pmenu = WMCreatePLArray(pl, NULL);

	i = 0;
	while ((item = WGetEditMenuItem(menu, i++))) {
		WEditMenu *submenu;

		s = WGetEditMenuItemTitle(item);

		submenu = WGetEditMenuSubmenu(item);
		if (submenu) {
			pl = processSubmenu(submenu);
		} else {
			pl = processData(s, WGetEditMenuItemData(item));
		}

		if (!pl)
			continue;

		WMAddToPLArray(pmenu, pl);
	}

	return pmenu;
}
示例#2
0
文件: Menu.c 项目: awmaker/awmaker
static Bool shouldRemoveItem(struct WEditMenuDelegate *delegate, WEditMenu * menu, WEditMenuItem * item)
{
	_Panel *panel = (_Panel *) delegate->data;

	if (panel->dontAsk)
		return True;

	if (WGetEditMenuSubmenu(item)) {
		int res;

		res = WMRunAlertPanel(WMWidgetScreen(menu), NULL,
				      _("Remove Submenu"),
				      _("Removing this item will destroy all items inside\n"
					"the submenu. Do you really want to do that?"),
				      _("Yes"), _("No"), _("Yes, don't ask again"));
		switch (res) {
		case WAPRDefault:
			return True;
		case WAPRAlternate:
			return False;
		case WAPROther:
			panel->dontAsk = True;
			return True;
		}
	}
	return True;
}
示例#3
0
static void
menuItemEdited(struct WEditMenuDelegate *delegate, WEditMenu *menu,
               WEditMenuItem *item)
{
    _Panel *panel = (_Panel*)delegate->data;
    WEditMenu *submenu;

    updateFrameTitle(panel, WGetEditMenuItemTitle(item), panel->currentType);

    submenu = WGetEditMenuSubmenu(menu, item);
    if (submenu) {
        WSetEditMenuTitle(submenu, WGetEditMenuItemTitle(item));
    }
}
示例#4
0
文件: Menu.c 项目: awmaker/awmaker
static void menuItemEdited(struct WEditMenuDelegate *delegate, WEditMenu * menu, WEditMenuItem * item)
{
	_Panel *panel = (_Panel *) delegate->data;
	WEditMenu *submenu;

	/* Parameter not used, but tell the compiler it is ok */
	(void) menu;

	updateFrameTitle(panel, WGetEditMenuItemTitle(item), panel->currentType);

	submenu = WGetEditMenuSubmenu(item);
	if (submenu) {
		WSetEditMenuTitle(submenu, WGetEditMenuItemTitle(item));
	}
}