static int Menu_Style( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int style = luaL_checkinteger( L, 2 ); menu->window.style = style; return 0; }
static int Menu_Activate( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); Menus_CloseAll(); Menus_ActivateByName( menu->window.name ); trap->Key_SetCatcher( KEYCATCH_CGAME ); return 0; }
void Main_SetMenus (void) { HMENU hm = GetMenu (g.hMain); LPASIDLIST pSel = Display_GetSelectedList(); Main_SetViewMenus (hm); // Fix the Operations In Progress entry // CheckMenu (hm, M_ACTIONS, gr.fShowActions); // Fix the CellProperties and Edit.* menu items. Many get disabled if there // is no selection // BOOL fEnable = (pSel && pSel->cEntries) ? TRUE : FALSE; EnableMenu (hm, M_DELETE, fEnable); EnableMenu (hm, M_REFRESH, fEnable); EnableMenu (hm, M_MEMBERSHIP, fEnable); EnableMenu (hm, M_PROPERTIES, fEnable); if ((fEnable = (pSel && (pSel->cEntries == 1))) == TRUE) { // Make sure it's a group ASOBJTYPE Type; if (!asc_ObjectTypeGet_Fast (g.idClient, g.idCell, pSel->aEntries[0].idObject, &Type)) fEnable = FALSE; else if (Type != TYPE_GROUP) fEnable = FALSE; } EnableMenu (hm, M_RENAME, fEnable); if (pSel) asc_AsidListFree (&pSel); }
static int Menu_SetFont( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); const char *font = luaL_checkstring( L, 2 ); if ( trap->R_RegisterFont( font ) ) { menu->font = String_Alloc( font ); } return 0; }
static int Menu_SetDescXY( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int x = luaL_checkinteger( L, 2 ); int y = luaL_checkinteger( L, 3 ); menu->descX = x; menu->descY = y; return 0; }
static int Menu_CreateItem( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); const char *name = luaL_checkstring( L, 2 ); int type = luaL_checkinteger( L, 3 ); itemDef_t *item = Interface_CreateItem( menu, name, type ); Item_CreateRef( L, item, menu ); return 1; }
/*------------------------------------------------ when the clock is right-clicked show pop-up menu --------------------------------------------------*/ void OnContextMenu(HWND hwnd, HWND hwndClicked, int xPos, int yPos) { WIN32_FIND_DATA fd; HANDLE hfind; TPMPARAMS tpmp; LPTPMPARAMS lptpmp = NULL; SendOnContextMenu(); if(m_tcmenutxt[0] == 0 || !IsFile(m_tcmenutxt)) { // common/tclang.c FindFileWithLangCode(m_tcmenutxt, GetUserDefaultLangID(), TCMENUTXT); } hfind = FindFirstFile(m_tcmenutxt, &fd); if(hfind != INVALID_HANDLE_VALUE) { FindClose(hfind); if(m_lasttime != fd.ftLastWriteTime.dwLowDateTime) { EndContextMenu(); m_lasttime = fd.ftLastWriteTime.dwLowDateTime; } } else m_lasttime = 0; // create popup menu and append items from tcmenu.txt if(!m_hMenu) { m_hMenu = CreatePopupMenu(); if(hfind != INVALID_HANDLE_VALUE) LoadMenuFromText(m_hMenu, m_tcmenutxt, &fd); else LoadMenuFromText(m_hMenu, NULL, NULL); } CheckMenu(m_hMenu); // get keyboard input SetFocusTClockMain(hwnd); // APP key if((xPos == -1) && (yPos == -1)) { tpmp.cbSize = sizeof(tpmp); lptpmp = &tpmp; GetWindowRect(g_hwndClock, &tpmp.rcExclude); xPos = tpmp.rcExclude.right; yPos = tpmp.rcExclude.top; } // open popup menu TrackPopupMenuEx(m_hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, xPos, yPos, hwnd, lptpmp); PostMessage(hwnd, WM_NULL, 0, 0); }
static int Menu_Finalize( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); if ( !menu ) { return 0; } Menu_PostParse( menu ); return 0; }
static int Menu_SetEscFunc( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); if ( lua_isfunction( L, 2 ) ) { menu->lua_onESC = luaL_ref( L, LUA_REGISTRYINDEX ); if ( !menu->uselua ) { menu->uselua = true; } } return 0; }
static int Menu_SetAcceptFunc( lua_State *L ) { menuDef_t *menu = CheckMenu(L, 1); if (lua_type(L, 2) == LUA_TFUNCTION){ menu->lua_onAccept = luaL_ref(L, LUA_REGISTRYINDEX); if (!menu->uselua){ menu->uselua = true; } } return 0; }
static int Menu_OutOfBoundClick( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); qboolean value = lua_toboolean( L, 2 ); if ( value ) { menu->window.flags |= WINDOW_OOB_CLICK; } else { menu->window.flags &= ~WINDOW_OOB_CLICK; } return 0; }
static int Menu_Forecolor( lua_State *L ){ menuDef_t *menu = CheckMenu( L, 1 ); ReadFloats( menu->window.foreColor.raw, 4, L, 2 ); qboolean plycolour = lua_toboolean( L, 3 ); if ( plycolour ) { menu->window.flags |= WINDOW_PLAYERCOLOR; } else { menu->window.flags |= ~WINDOW_FORECOLORSET; } return 0; }
static int Menu_Visible( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); qboolean value = lua_toboolean( L, 2 ); if ( value ) { menu->window.flags |= WINDOW_VISIBLE; } else { menu->window.flags &= ~WINDOW_VISIBLE; } return 0; }
static int Menu_Popup( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); qboolean value = lua_toboolean( L, 2 ); if ( value ) { menu->window.flags |= WINDOW_POPUP; } else { menu->window.flags &= ~WINDOW_POPUP; } return 0; }
static int Menu_Rect( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int x = luaL_checkinteger( L, 2 ); int y = luaL_checkinteger( L, 3 ); int w = luaL_checkinteger( L, 4 ); int h = luaL_checkinteger( L, 5 ); menu->window.rect.x = x; menu->window.rect.y = y; menu->window.rect.w = w; menu->window.rect.h = h; return 0; }
static int Menu_OwnerDrawFlag( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); //FIXME: is there a smarter way to do this? uint32_t bit = luaL_checkinteger( L, 2 ); int found = 0; for ( int i = 0; i < 32; i++ ) { if ( bit & (1 << i) ) { found++; } } if ( found > 1 ) { lua_pushfstring( L, "too many bits set (%i)\n", found ); return 1; } menu->window.ownerDrawFlags |= bit; return 0; }
static int Menu_Background( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); const char *value = luaL_checkstring( L, 2 ); menu->window.background = trap->R_RegisterShaderNoMip( value); return 0; }
static int Menu_SoundLoop( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); const char *sound = luaL_checkstring( L, 2 ); menu->soundName = String_Alloc( sound ); return 0; }
void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer) { HMENU hm; if (lpiServer == NULL) hm = TaLocale_LoadMenu (MENU_SVR_NONE); else hm = TaLocale_LoadMenu (MENU_SVR); if (hm != NULL) { if (lpiServer == NULL) { int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView; HMENU hmView = GetSubMenu (hm, 0); CheckMenuRadioItem (hmView, M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT, ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL : (lvs == FLS_VIEW_LIST) ? M_SVR_VIEW_REPORT : M_SVR_VIEW_LARGE ), MF_BYCOMMAND); ICONVIEW ivSvr = Display_GetServerIconView(); CheckMenuRadioItem (hmView, M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS, (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS : (ivSvr == ivONEICON) ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS, MF_BYCOMMAND); if (lvs != FLS_VIEW_LIST) { EnableMenu (hmView, M_SVR_VIEW_ONEICON, FALSE); EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE); EnableMenu (hmView, M_SVR_VIEW_STATUS, FALSE); } if (!PropCache_Search (pcSERVER, ANYVALUE)) EnableMenu (hmView, M_SVR_CLOSEALL, FALSE); } else { BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer)); LPSERVER_PREF lpsp; if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) || (lpsp->fIsMonitored) ) { EnableMenu (hm, M_SVR_OPEN, !fOpenNow); EnableMenu (hm, M_SVR_CLOSE, fOpenNow); CheckMenu (hm, M_SVR_MONITOR, TRUE); } else { if (!fOpenNow) EnableMenu (hm, M_SVR_CLOSE, FALSE); if (fOpenNow || !gr.fOpenMonitors) EnableMenu (hm, M_SVR_OPEN, FALSE); CheckMenu (hm, M_SVR_MONITOR, FALSE); EnableMenu (hm, M_SVR_SECURITY, FALSE); EnableMenu (hm, M_SALVAGE, FALSE); EnableMenu (hm, M_SET_CLONE, FALSE); EnableMenu (hm, M_SET_UNLOCK, FALSE); EnableMenu (hm, M_SYNCVLDB, FALSE); } } DisplayContextMenu (hm, ptScreen, hParent); } }
static int Menu_SetDescScale( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int value = luaL_checkinteger( L, 2 ); menu->descScale = value; return 0; }
static int Menu_OutlineColor( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); ReadFloats( menu->window.outlineColor.raw, 4, L, 2 ); return 0; }
static int Menu_SetName( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); menu->window.name = String_Alloc( luaL_checkstring( L, 2 ) ); return 0; }
static int Menu_FadeCycle( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int value = luaL_checkinteger( L, 2 ); menu->fadeCycle = value; return 0; }
static int Menu_FullScreen( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); qboolean value = lua_toboolean( L, 2 ); menu->fullScreen = value; return 0; }
static int Menu_FocusColor( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); ReadFloats( menu->focusColor.raw, 4, L, 2 ); return 0; }
static int Menu_AppearanceIncrement( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); float value = luaL_checknumber( L, 2 ); menu->appearanceIncrement = value; return 0; }
static int Menu_ToString( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); lua_pushfstring( L, "Menu(%d)(%s)", menu->id, menu->window.name ); return 1; }
static int Menu_OwnerDraw( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int value = luaL_checkinteger( L, 2 ); menu->window.ownerDraw = value; return 0; }
static int Menu_DescAlignment( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int value = luaL_checkinteger( L, 2 ); menu->descAlignment = value; return 0; }
static int Menu_BorderSize( lua_State *L ) { menuDef_t *menu = CheckMenu( L, 1 ); int value = lua_tointeger( L, 2 ); menu->window.borderSize = value; return 0; }