本文整理汇总了C++中CLTGUITextCtrl::SetParam1方法的典型用法代码示例。如果您正苦于以下问题:C++ CLTGUITextCtrl::SetParam1方法的具体用法?C++ CLTGUITextCtrl::SetParam1怎么用?C++ CLTGUITextCtrl::SetParam1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLTGUITextCtrl
的用法示例。
在下文中一共展示了CLTGUITextCtrl::SetParam1方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateProfileList
void CScreenProfile::CreateProfileList()
{
// Empty the list
m_pListCtrl->RemoveAll();
// Get new stuff
m_ProfileList.clear();
g_pProfileMgr->GetProfileList(m_ProfileList);
CLTGUICtrl_create cs;
cs.rnBaseRect.m_vMin.Init();
cs.rnBaseRect.m_vMax = LTVector2n(kDlgWd - 48,nListFontSz);
cs.nCommandID = CMD_OK;
// Profiles to the list
for (ProfileArray::iterator iter = m_ProfileList.begin(); iter != m_ProfileList.end(); ++iter)
{
CLTGUITextCtrl* pTextCtrl = CreateTextItem( iter->m_sFriendlyName.c_str(), cs, false, sListFont.c_str(), nListFontSz);
if (pTextCtrl)
{
uint32 ndx = m_pListCtrl->AddControl(pTextCtrl);
pTextCtrl->SetParam1(ndx);
if (LTStrIEquals(iter->m_sFriendlyName.c_str(),m_pProfile->m_sFriendlyName.c_str()))
m_pListCtrl->SetSelection(ndx);
}
}
}
示例2: CreateProfileList
void CScreenProfile::CreateProfileList()
{
// Empty the list
m_pListCtrl->RemoveAll();
// Get new stuff
m_ProfileList.clear();
g_pProfileMgr->GetProfileList(m_ProfileList);
CUIFont *pFont = g_pInterfaceResMgr->GetFont(nListFont);
// Profiles to the list
for (StringSet::iterator iter = m_ProfileList.begin(); iter != m_ProfileList.end(); ++iter)
{
char *pStr = (char *)iter->c_str();
CLTGUITextCtrl* pTextCtrl = CreateTextItem(pStr, CMD_OK, LTNULL);
pTextCtrl->SetFont(pFont,nListFontSz);
uint16 ndx = m_pListCtrl->AddControl(pTextCtrl);
pTextCtrl->SetParam1(ndx);
if (stricmp(iter->c_str(),m_pProfile->m_sName.c_str()) == 0)
m_pListCtrl->SetSelection(ndx);
}
}
示例3: FillAvailList
LTBOOL CScreenHostLevels::FillAvailList()
{
// Sanity checks...
if (!m_pAvailMissions) return(LTFALSE);
for (int nMission = 0; nMission < g_pMissionButeMgr->GetNumMissions(); nMission++)
{
MISSION* pMission = g_pMissionButeMgr->GetMission(nMission);
if (pMission)
{
CLTGUITextCtrl *pCtrl = NULL;
if (pMission->nNameId > 0)
pCtrl = CreateTextItem(LoadTempString(pMission->nNameId),CMD_ADD_LEVEL,pMission->nDescId);
else if (!pMission->sName.empty())
pCtrl = CreateTextItem((char *)pMission->sName.c_str(),CMD_ADD_LEVEL,pMission->nDescId);
else
{
char szWorldTitle[MAX_PATH] = "";
_splitpath( pMission->aLevels[0].szLevel, NULL, NULL, szWorldTitle, NULL );
pCtrl = CreateTextItem(szWorldTitle,CMD_ADD_LEVEL,0);
}
pCtrl->SetFont(LTNULL,nListFontSize);
pCtrl->SetParam1(nMission);
pCtrl->SetFixedWidth(nAvailWidth,LTTRUE);
m_pAvailMissions->AddControl(pCtrl);
}
}
return (LTTRUE);
}
示例4: AddMissionToList
void CScreenHostLevels::AddMissionToList(int nMissionId)
{
// Sanity checks...
if (!m_pSelMissions) return;
if (m_pSelMissions->GetNumControls() == MAX_GAME_LEVELS) return;
// Add the level to the list...
MISSION *pMission = g_pMissionButeMgr->GetMission(nMissionId);
if (pMission)
{
CLTGUITextCtrl *pCtrl = NULL;
if (pMission->nNameId > 0)
pCtrl = CreateTextItem(LoadTempString(pMission->nNameId),CMD_REMOVE_LEVEL,pMission->nDescId);
else if (!pMission->sName.empty())
pCtrl = CreateTextItem((char *)pMission->sName.c_str(),CMD_REMOVE_LEVEL,pMission->nDescId);
else
{
char szWorldTitle[MAX_PATH] = "";
_splitpath( pMission->aLevels[0].szLevel, NULL, NULL, szWorldTitle, NULL );
pCtrl = CreateTextItem(szWorldTitle,CMD_REMOVE_LEVEL,0);
}
pCtrl->SetFont(LTNULL,nListFontSize);
pCtrl->SetParam1(nMissionId);
pCtrl->SetFixedWidth(nSelWidth,LTTRUE);
m_pSelMissions->AddControl(pCtrl);
}
else
{
ASSERT(!"Invalid mission id");
}
}
示例5: Init
LTBOOL CMenuMgr::Init()
{
//build menu array
m_MenuArray.reserve(MENU_ID_UNASSIGNED);
//add menus here
m_MenuArray.push_back(&m_MenuSystem);
m_MenuArray.push_back(&m_MenuMission);
m_MenuArray.push_back(&m_MenuInventory);
m_MenuArray.push_back(&m_MenuKeys);
m_MenuArray.push_back(&m_MenuIntel);
m_MenuArray.push_back(&m_MenuPlayer);
//init menus
MenuArray::iterator iter = m_MenuArray.begin();
while (iter != m_MenuArray.end())
{
if (!(*iter)->Init())
return LTFALSE;
iter++;
}
m_fSlideInTime = g_pLayoutMgr->GetMenuSlideInTime();
m_fSlideOutTime = g_pLayoutMgr->GetMenuSlideOutTime();
m_nMenuPos = g_pLayoutMgr->GetMenuPosition();
char szTemp[128];
char *pTag = "Menu";
g_pLayoutMgr->GetString(pTag,"SlideInSound",szTemp,sizeof(szTemp));
m_sSlideInSound = szTemp;
g_pLayoutMgr->GetString(pTag,"SlideOutSound",szTemp,sizeof(szTemp));
m_sSlideOutSound = szTemp;
g_pLayoutMgr->GetString(pTag,"Bar",szTemp,sizeof(szTemp));
HTEXTURE hBar = g_pInterfaceResMgr->GetTexture(szTemp);
g_pLayoutMgr->GetString(pTag,"BarTip",szTemp,sizeof(szTemp));
HTEXTURE hBarTip = g_pInterfaceResMgr->GetTexture(szTemp);
LTIntPt size = g_pLayoutMgr->GetPoint(pTag,"BarSize");
uint8 fontFace = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFont");
uint8 fontSize = (uint8)g_pLayoutMgr->GetInt(pTag,"BarFontSize");
m_nBarPos = g_pLayoutMgr->GetInt(pTag,"BarPosition");
int nBarSpacing = g_pLayoutMgr->GetInt(pTag,"BarSpacing");
LTVector vCol = g_pLayoutMgr->GetVector(pTag,"BarSelectColor");
uint8 nR = (uint8)vCol.x;
uint8 nG = (uint8)vCol.y;
uint8 nB = (uint8)vCol.z;
g_nSelectColor = SET_ARGB(0xFF,nR,nG,nB);
m_MenuBar.Init(hBar,hBarTip,size);
m_MenuBar.SetBasePos(LTIntPt(0,m_nBarPos));
CUIFont* pFont = g_pInterfaceResMgr->GetFont(fontFace);
LTIntPt offset(nBarSpacing,(size.y-fontSize)/2);
for (uint8 i =0; i < m_MenuArray.size(); i++)
{
CLTGUITextCtrl *pCtrl = debug_new(CLTGUITextCtrl);
CBaseMenu *pMenu = m_MenuArray[i];
pCtrl->Create(pMenu->GetTitle(),i,NULL,pFont,fontSize,&m_MenuBar);
pCtrl->SetColors(g_nSelectColor,argbBlack,argbWhite);
pCtrl->SetParam1(pMenu->GetMenuID());
m_MenuBar.AddControl(pCtrl,offset);
offset.x += nBarSpacing + pCtrl->GetWidth();
}
return LTTRUE;
}
示例6: CreateCampaignList
void CScreenHostMission::CreateCampaignList()
{
// Empty the list
m_pListCtrl->RemoveAll();
m_CampaignList.clear();
CUIFont *pFont = g_pInterfaceResMgr->GetFont(nListFont);
m_CampaignList.insert(DEFAULT_CAMPAIGN);
// Get new stuff
struct _finddata_t file;
intptr_t hFile;
CUserProfile* pUserProfile = g_pProfileMgr->GetCurrentProfile( );
std::string directory = GetCampaignDir( g_pProfileMgr->GetCurrentProfileName( ),
pUserProfile->m_ServerGameOptions.m_eGameType );
directory += "*.txt";
// find first file
if((hFile = _findfirst(directory.c_str(), &file)) != -1L)
{
do
{
if (_stricmp(file.name,DEFAULT_CAMPAIGN_FILE) != 0)
{
char *pName = strtok(file.name,".");
m_CampaignList.insert(pName);
}
}
while(_findnext(hFile, &file) == 0);
}
_findclose(hFile);
// add campaigns to the list control
for (StringSet::iterator iter = m_CampaignList.begin(); iter != m_CampaignList.end(); ++iter)
{
CLTGUITextCtrl* pTextCtrl = NULL;
uint16 ndx = 0;
if (iter->compare(DEFAULT_CAMPAIGN) == 0)
{
m_pDefaultTextCtrl = CreateTextItem(IDS_HOST_CAMPAIGN_DEFAULT, CMD_OK, LTNULL);
ndx = m_pListCtrl->AddControl(m_pDefaultTextCtrl);
m_nDefaultCampaign = ndx;
m_pDefaultTextCtrl->Show(LTFALSE);
m_pDefaultTextCtrl->SetParam1(ndx);
m_pDefaultTextCtrl->SetFont(pFont,nListFontSz);
}
else
{
pTextCtrl = CreateTextItem((char *)iter->c_str(), CMD_OK, LTNULL);
pTextCtrl->SetFont(pFont,nListFontSz);
ndx = m_pListCtrl->AddControl(pTextCtrl);
pTextCtrl->SetParam1(ndx);
}
if (iter->compare(m_pProfile->m_ServerGameOptions.GetCampaignName()) == 0)
m_pListCtrl->SetSelection(ndx);
}
}
示例7: CreateFileList
void CScreenHostOptionFile::CreateFileList()
{
// Empty the list
m_pListCtrl->RemoveAll();
m_List.clear();
// Get new stuff
LTFINDFILEINFO file;
LTFINDFILEHANDLE hFile;
// Create directory search string.
char szDirectory[MAX_PATH*2];
LTSNPrintF( szDirectory, LTARRAYSIZE( szDirectory ), "%s*.txt", GameModeMgr::Instance( ).GetOptionsFolder( ));
// Create the title of the default option file, which we won't show in the list.
char szExample[MAX_PATH*2];
LTFileOperations::SplitPath( SERVEROPTIONS_EXAMPLE, NULL, szExample, NULL );
CResExtUtil::StripFileExtension( szExample, LTARRAYSIZE( szExample ));
// find first file
if( LTFileOperations::FindFirst( szDirectory, hFile, &file ))
{
do
{
CResExtUtil::StripFileExtension( file.name, LTARRAYSIZE( file.name ));
if( !LTStrIEquals( szExample, file.name ))
{
const wchar_t* wszFriendlyName = CHostOptionsMapMgr::Instance().GetFriendlyNameFromFileName( file.name );
if( wszFriendlyName )
m_List.insert( wszFriendlyName );
else
m_List.insert( MPA2W(file.name).c_str() );
}
}
while( LTFileOperations::FindNext( hFile, &file ));
}
LTFileOperations::FindClose( hFile );
CLTGUICtrl_create cs;
cs.rnBaseRect.m_vMin.Init();
cs.rnBaseRect.m_vMax = LTVector2n(kDlgWd - 48,nListFontSz);
cs.nCommandID = CMD_OK;
// Get the current file title.
wchar_t wszCurrentName[MAX_PATH*2];
CUserProfile* pProfile = g_pProfileMgr->GetCurrentProfile();
const wchar_t* wszFriendlyName = CHostOptionsMapMgr::Instance().GetFriendlyNameFromFileName( pProfile->m_sServerOptionsFile.c_str() );
if( wszFriendlyName )
LTStrCpy( wszCurrentName, wszFriendlyName, LTARRAYSIZE( wszCurrentName ));
else
LTStrCpy( wszCurrentName, MPA2W( pProfile->m_sServerOptionsFile.c_str( )).c_str( ), LTARRAYSIZE( wszCurrentName ));
// add files to the list control
for (WStringSet::iterator iter = m_List.begin(); iter != m_List.end(); ++iter)
{
CLTGUITextCtrl* pTextCtrl = NULL;
uint16 ndx = 0;
pTextCtrl = CreateTextItem(iter->c_str(), cs, false, sListFont.c_str(), nListFontSz);
ndx = m_pListCtrl->AddControl(pTextCtrl);
pTextCtrl->SetParam1(ndx);
if( LTStrEquals( iter->c_str( ), wszCurrentName ))
m_pListCtrl->SetSelection(ndx);
}
}
示例8: OnFocus
// This is called when the screen gets or loses focus
void CMenuIntel::OnFocus(LTBOOL bFocus)
{
if (!m_PopupText.IsVisible())
{
ClearSelection();
}
if (bFocus)
{
uint16 nextItem = 0;
CIntelItemList *pList = g_pPlayerStats->GetIntelList();
char szTemp[512] = "";
for (uint16 i = 0; i < pList->GetCount(); i++)
{
uint16 nIndex = (pList->GetCount() - i) - 1;
INTEL_ITEM* pItem = pList->Get(nIndex);
if (!pItem)
{
continue;
}
GetIntelName(pItem->nTextId,szTemp,sizeof(szTemp));
CLTGUITextCtrl* pCtrl = LTNULL;
if (nextItem < m_List.GetNumControls())
{
pCtrl = (CLTGUITextCtrl*)m_List.GetControl(nextItem);
if (pCtrl)
{
pCtrl->SetString(szTemp);
pCtrl->Show(LTTRUE);
nextItem++;
}
}
else
{
uint16 ndx = AddControl(szTemp,MC_INTEL);
pCtrl = (CLTGUITextCtrl*)m_List.GetControl(ndx);
nextItem++;
}
if (pCtrl)
{
pCtrl->SetParam1(nIndex);
if (pItem->bIsIntel)
{
pCtrl->SetColors(0xFFFF0000,0xFFA00000,m_DisabledColor);
}
else
{
pCtrl->SetColors(m_SelectedColor,m_NonSelectedColor,m_DisabledColor);
}
}
}
for (uint16 nIndex = nextItem; nIndex < m_List.GetNumControls(); nIndex++)
{
CLTGUITextCtrl* pCtrl = (CLTGUITextCtrl*)m_List.GetControl(nIndex);
if (pCtrl)
{
pCtrl->Show(LTFALSE);
}
}
if (m_fScale != g_pInterfaceResMgr->GetXRatio())
{
SetScale(g_pInterfaceResMgr->GetXRatio());
}
SetSelection(GetIndex(&m_List));
}
}