本文整理汇总了C++中CLTGUITextCtrl::SetColors方法的典型用法代码示例。如果您正苦于以下问题:C++ CLTGUITextCtrl::SetColors方法的具体用法?C++ CLTGUITextCtrl::SetColors怎么用?C++ CLTGUITextCtrl::SetColors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLTGUITextCtrl
的用法示例。
在下文中一共展示了CLTGUITextCtrl::SetColors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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));
}
}