本文整理汇总了C++中CLTGUITextCtrl::SetFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ CLTGUITextCtrl::SetFixedWidth方法的具体用法?C++ CLTGUITextCtrl::SetFixedWidth怎么用?C++ CLTGUITextCtrl::SetFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLTGUITextCtrl
的用法示例。
在下文中一共展示了CLTGUITextCtrl::SetFixedWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: BuildChapterList
// Build the list of Chapters
void CScreenSingle::BuildChapterList()
{
LTRect rect = g_pLayoutMgr->GetScreenCustomRect((eScreenID)m_nScreenID,"ChapterRect");
int nWidth = (rect.right - rect.left) - 16;
CLTGUITextCtrl* pItem;
uint8 nListFontSize = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontSize");
for (int i = 0; i < g_pMissionButeMgr->GetNumMissions(); i++)
{
const MISSION* pMission = g_pMissionButeMgr->GetMission(i);
pItem = CreateTextItem(pMission->nNameId, CMD_CUSTOM+1000+i, pMission->nDescId);
pItem->SetFont(LTNULL, nListFontSize);
pItem->SetFixedWidth(nWidth,LTTRUE);
m_pChapter->AddControl(pItem);
}
}
示例3: 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");
}
}
示例4: AddColumn
// Adds a column to the control
// nWidth - Width of the column
// hString - The initial text for the column
uint8 CLTGUIColumnCtrl::AddColumn(const char *pString, uint16 nWidth, LTBOOL bClip)
{
if ( !pString )
{
assert(LTFALSE);
return -1;
}
CLTGUITextCtrl *pCtrl = debug_new(CLTGUITextCtrl);
if (!pCtrl->Create(pString,LTNULL,LTNULL,m_pFont,m_nBaseFontSize,LTNULL))
{
debug_delete(pCtrl);
return -1;
}
m_columnArray.push_back(pCtrl);
//force a little extra space between columns, if we can
nWidth -= (m_nBaseFontSize/2);
if (nWidth < m_nBaseFontSize + 1)
nWidth = m_nBaseFontSize + 1 ;
pCtrl->SetFixedWidth(nWidth,bClip);
LTIntPt pos = m_basePos;
pos.x += m_nBaseWidth;
pCtrl->SetColors(m_argbSelected, m_argbNormal, m_argbDisabled);
pCtrl->SetBasePos(pos);
pCtrl->SetScale(m_fScale);
CalculateSize();
return m_columnArray.size() - 1;
}
示例5: Build
// Build the screen
LTBOOL CScreenConfigure::Build()
{
CreateTitle(IDS_TITLE_CONFIGURE);
m_nActionWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"ActionWidth");
m_nEqualsWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"EqualsWidth");
m_nCommandWidth = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"CommandWidth");
m_ListRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_CONFIGURE,"ListRect");
m_nListFontSize = g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_CONFIGURE,"ListFontSize");
int nWidth = GetPageRight() - GetPageLeft();
LTIntPt topPos = g_pLayoutMgr->GetScreenCustomPoint(SCREEN_ID_CONFIGURE,"MoveControlPos");
CLTGUITextCtrl *pCtrl = AddTextItem(IDS_MOVE_CONTROLS,CMD_MOVE_COM,LTNULL,topPos);
pCtrl->SetFixedWidth(nWidth);
pCtrl = AddTextItem(IDS_INV_CONTROLS,CMD_INV_COM,LTNULL);
pCtrl->SetFixedWidth(nWidth);
pCtrl = AddTextItem(IDS_VIEW_CONTROLS,CMD_VIEW_COM,LTNULL);
pCtrl->SetFixedWidth(nWidth);
pCtrl = AddTextItem(IDS_MISC_CONTROLS,CMD_MISC_COM,LTNULL);
pCtrl->SetFixedWidth(nWidth);
LTIntPt pos(m_ListRect.left,m_ListRect.top);
int nHt = m_ListRect.bottom - m_ListRect.top;
int nWd = m_nActionWidth + m_nEqualsWidth + m_nCommandWidth;
char szFrame[128];
g_pLayoutMgr->GetScreenCustomString(SCREEN_ID_CONFIGURE,"FrameTexture",szFrame,sizeof(szFrame));
HTEXTURE hFrame = g_pInterfaceResMgr->GetTexture(szFrame);
m_pFrame = debug_new(CLTGUIFrame);
m_pFrame->Create(hFrame,nWd,nHt+8,LTTRUE);
m_pFrame->SetBasePos(pos);
AddControl(m_pFrame);
for (int nType = 0; nType < kNumCommandTypes; nType++)
{
m_pList[nType] = AddList(pos,nHt);
m_pList[nType]->SetFrameWidth(2);
m_pList[nType]->SetIndent(LTIntPt(4,4));
m_pList[nType]->Show(LTFALSE);
pCtrl = LTNULL;
switch (nType)
{
case COM_MOVE:
pCtrl = CreateTextItem(IDS_MOVE_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
break;
case COM_INV:
pCtrl = CreateTextItem(IDS_INV_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
break;
case COM_VIEW:
pCtrl = CreateTextItem(IDS_VIEW_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
break;
case COM_MISC:
pCtrl = CreateTextItem(IDS_MISC_CONTROLS,LTNULL,LTNULL,kDefaultPos,LTTRUE);
break;
}
if (pCtrl)
m_pList[nType]->AddControl(pCtrl);
}
InitControlList();
// Make sure to call the base class
if (! CBaseScreen::Build()) return LTFALSE;
UseBack(LTTRUE,LTTRUE);
return LTTRUE;
}
示例6: BuildCustomLevelsList
// Build the list of Custom Levels
void CScreenSingle::BuildCustomLevelsList(int nWidth)
{
m_Filenames.clear();
m_pCustom->RemoveAll();
// Get a list of world names and sort them alphabetically
uint8 nNumPaths = g_pClientButeMgr->GetNumSingleWorldPaths();
char pathBuf[128];
FileEntry** pFilesArray = debug_newa(FileEntry*, nNumPaths);
if (pFilesArray)
{
for (int i=0; i < nNumPaths; ++i)
{
pathBuf[0] = '\0';
g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf));
if (pathBuf[0])
{
pFilesArray[i] = g_pLTClient->GetFileList(pathBuf);
}
else
{
pFilesArray[i] = LTNULL;
}
}
}
char Buf[255];
for (int i=0; i < nNumPaths; ++i)
{
pathBuf[0] = '\0';
g_pClientButeMgr->GetWorldPath(i, pathBuf, ARRAY_LEN(pathBuf));
if (pathBuf[0] && pFilesArray[i])
{
sprintf(Buf, "%s\\", pathBuf);
AddFilesToFilenames(pFilesArray[i], Buf);
g_pLTClient->FreeFileList(pFilesArray[i]);
}
}
debug_deletea(pFilesArray);
CLTGUITextCtrl* pItem;
uint8 nListFontSize = (uint8)g_pLayoutMgr->GetScreenCustomInt((eScreenID)m_nScreenID,"ListFontSize");
int index = 0;
StringSet::iterator iter = m_Filenames.begin();
while (iter != m_Filenames.end())
{
pItem = CreateTextItem((char *)iter->c_str(), CMD_CUSTOM+index, IDS_HELP_CUSTOMLEVEL);
pItem->SetFont(LTNULL, nListFontSize);
pItem->SetFixedWidth(nWidth,LTTRUE);
m_pCustom->AddControl(pItem);
++index;
iter++;
}
}