MenuItem* _make_item(Menu *pMenu) { if (BBVERSION_09X) { char buffer[20]; sprintf(buffer, "%d", initval); return MakeMenuItemString(pMenu, text, menu->addid(cmd), buffer); } else { return MakeMenuItemInt(pMenu, text, menu->addid(cmd), initval, minval, maxval); } }
void make_menuitem_int(Menu *m, const char *title, const char* cmd, int val, int minval, int maxval) { if (BBVERSION_09X == BBVersion) { char buffer[20]; sprintf(buffer, "%d", val); MakeMenuItemString(m, title, cmd, buffer); } else { MakeMenuItemInt(m, title, cmd, val, minval, maxval); } }
void make_menuitem_str(Menu *m, const char *title, const char* cmd, const char * init_string) { char buffer[BBI_MAX_LINE_LENGTH]; if (BBVERSION_LEAN == BBVersion) sprintf(buffer, "%s \"%%s\"", cmd), cmd = buffer; if (BBVERSION_09X == BBVersion) sprintf(buffer, "\"%s\"", init_string), init_string = buffer; MakeMenuItemString(m, title, cmd, init_string); }
void make_menuitem_str(Menu *m, const char *title, const char* cmd, const char * init_string) { char buffer[BBI_MAX_LINE_LENGTH]; if (BBP_is_bbversion_lean()) sprintf(buffer, "%s \"%%s\"", cmd), cmd = buffer; if (BBP_is_bbversion_09x()) sprintf(buffer, "\"%s\"", init_string), init_string = buffer; MakeMenuItemString(m, title, cmd, init_string); }
void ShowMyMenu(bool popup) { Menu *pMenu, *pSub; /* Create the main menu, with a title and an unique IDString */ pMenu = MakeNamedMenu(szAppName, MENU_ID("Main"), popup); /* Create a submenu, also with title and unique IDString */ pSub = MakeNamedMenu("Configuration", MENU_ID("Config"), popup); /* Insert first Item */ MakeMenuItem(pSub, "Draw Border", BROAM("drawBorder"), my.drawBorder); if (g_hSlit) MakeMenuItem(pSub, "Use Slit", BROAM("useSlit"), my.useSlit); if (false == my.is_inslit) { /* these are only available if outside the slit */ MakeMenuItem(pSub, "Always On Top", BROAM("alwaysOnTop"), my.alwaysOnTop); MakeMenuItem(pSub, "Snap To Edges", BROAM("snapWindow"), my.snapWindow); MakeMenuItem(pSub, "Toggle With Plugins", BROAM("pluginToggle"), my.pluginToggle); MakeMenuItem(pSub, "Transparency", BROAM("alphaEnabled"), my.alphaEnabled); MakeMenuItemInt(pSub, "Alpha Value", BROAM("alphaValue"), my.alphaValue, 0, 255); } /* Insert the submenu into the main menu */ MakeSubmenu(pMenu, pSub, "Configuration"); /* The configurable text string */ MakeMenuItemString(pMenu, "Display Text", BROAM("windowText"), my.windowText); /* ---------------------------------- */ /* add an empty line */ MakeMenuNOP(pMenu, NULL); /* add an entry to let the user edit the setting file */ MakeMenuItem(pMenu, "Edit Settings", BROAM("editRC"), false); /* and an about box */ MakeMenuItem(pMenu, "About", BROAM("About"), false); /* ---------------------------------- */ /* Finally, show the menu... */ ShowMenu(pMenu); }
//=========================================================================== Menu* MakeDesktopMenu(int mode, bool popup) { DesktopInfo DI; struct string_node *sl; int n, d; Menu *m, *s, *i = NULL; if (mode == 2) { m = MakeNamedMenu(NLS0("Tasks"), "Core_tasks_menu", popup); } else { i = build_task_folder(-1, NLS0("Icons"), popup); if (mode == 1) return i; m = MakeNamedMenu(NLS0("Workspaces"), "Core_tasks_workspaces", popup); } getWorkspaces().GetDesktopInfo(DI); for (n = 0, d = DI.nScreens, sl = DI.deskNames; n < d; ++n, sl = sl->next) { if (mode == 0) { char buf[100]; MenuItem *fi; fi = MakeSubmenu(m, build_task_folder(n, sl->str, popup), NULL); sprintf(buf, "@BBCore.SwitchToWorkspace %d", n+1); MenuItemOption(fi, BBMENUITEM_LCOMMAND, buf); if (n == DI.number) MenuItemOption(fi, BBMENUITEM_CHECKED); } else { fill_task_folder(m, n, e_alltasks); if (n == d-1) return m; MakeMenuNOP(m, NULL); } } MakeMenuNOP(m, NULL); MakeSubmenu(m, i, NULL); s = MakeNamedMenu(NLS0("New/Remove"), "Core_workspaces_setup", popup); MakeMenuItem(s, NLS0("New Workspace"), "@BBCore.AddWorkspace", false); if (d > 1) MakeMenuItem(s, NLS0("Remove Last"), "@BBCore.DelWorkspace", false); MakeMenuItemString(s, NLS0("Workspace Names"), "@BBCore.SetWorkspaceNames", Settings_workspaceNames); MakeSubmenu(m, s, NULL); MakeMenuGrip(s, "New/Remove"); MakeMenuGrip(m, "Workspaces"); return m; }
MenuItem* _make_item(Menu *pMenu) { return MakeMenuItemString(pMenu, text, menu->addid(cmd), init); }
Menu *CfgMenuMaker(const char *title, const char *defbroam, const struct cfgmenu *pm, bool pop, char *menu_id) { char buf[100]; char *broam_dot; char *end_id; Menu *pMenu, *pSub; end_id = strchr(menu_id, 0); pMenu = MakeNamedMenu(title, menu_id, pop); broam_dot = strchr(strcpy_max(buf, defbroam, sizeof buf), 0); for (;pm->text; ++pm) { const char *item_text = pm->text; const void *v = pm->pvalue; const char *cmd = pm->command; const struct int_item *iip; bool disabled, checked; MenuItem *pItem; disabled = checked = false; if (cmd) { if ('@' != *cmd) strcpy(broam_dot, cmd), cmd = buf; if (NULL != (iip = get_int_item(v))) { pItem = MakeMenuItemInt( pMenu, item_text, cmd, *iip->v, iip->minval, iip->maxval); if (-2 != iip->offval) MenuItemOption(pItem, BBMENUITEM_OFFVAL, iip->offval, 10000 == iip->maxval ? NLS0("auto") : NULL); continue; } else if (is_string_item(v)) { MakeMenuItemString(pMenu, item_text, cmd, (const char*)v); continue; } else if (is_fixed_string(v)) { checked = 0 == stricmp((const char *)v, strchr(cmd, ' ')+1); } else if (v) { checked = *(bool*)v; } disabled = (v == &Settings_styleXPFix && Settings_altMethod) || (v == &Settings_menu.dropShadows && false == usingXP) ; pItem = MakeMenuItem(pMenu, item_text, cmd, checked && false == disabled); } else if (v) { sprintf(end_id, "_%s", item_text); if ((DWORD_PTR)v <= SUB_PLUGIN_SLIT) pSub = PluginManager_GetMenu(item_text, menu_id, pop, (int)(DWORD_PTR)v); else pSub = CfgMenuMaker(item_text, defbroam, (struct cfgmenu*)v, pop, menu_id); if (NULL == pSub) continue; pItem = MakeSubmenu(pMenu, pSub, NULL); } else { pItem = MakeMenuNOP(pMenu, item_text); } if (disabled) MenuItemOption(pItem, BBMENUITEM_DISABLED); } return pMenu; }