本文整理汇总了C++中LabelControl::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelControl::GetText方法的具体用法?C++ LabelControl::GetText怎么用?C++ LabelControl::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelControl
的用法示例。
在下文中一共展示了LabelControl::GetText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PositionColumns
void ChooseServerForm::PositionColumns() {
ListControl *plstc = (ListControl *)GetControlPtr(kidcServerList);
Rect rcList;
plstc->GetRect(&rcList);
Font *pfnt = plstc->GetFont();
LabelControl *plblPlayers = (LabelControl *)GetControlPtr(kidcNumPlayers);
int cxNumPlayers = pfnt->GetTextExtent(plblPlayers->GetText());
int xNumPlayers = rcList.right - cxNumPlayers;
LabelControl *plblStatus = (LabelControl *)GetControlPtr(kidcServerStatus);
int cxStatus = pfnt->GetTextExtent(plblStatus->GetText());
int xStatus = xNumPlayers - 40 - cxStatus;
int xLocation = rcList.left + (xStatus - rcList.left) / 2;
int xName = rcList.left;
plstc->SetTabStops(xName - rcList.left, xLocation - rcList.left,
xStatus + cxStatus / 2 - rcList.left,
xNumPlayers + cxNumPlayers / 2 - rcList.left);
plstc->SetTabFlags(0, 0, kfLstTabCenterOn, kfLstTabCenterOn);
word ids[] = { kidcServerName, kidcServerLocation, kidcServerStatus,
kidcNumPlayers };
int ax[] = { xName, xLocation, xStatus, xNumPlayers };
for (int i = 0; i < ARRAYSIZE(ids); i++) {
LabelControl *plbl = (LabelControl *)GetControlPtr(ids[i]);
Rect rcCtl;
plbl->GetRect(&rcCtl);
plbl->SetPosition(ax[i], rcCtl.top);
}
}
示例2: Sort
void DownloadMissionPackForm::Sort(word id) {
word aidColumns[] = {
kidcStatus, kidcTitle, kidcNumPlayers, kidcNumMissions
};
int iCol;
for (iCol = 0; iCol < ARRAYSIZE(aidColumns); iCol++) {
if (id == aidColumns[iCol]) {
break;
}
}
if (iCol >= ARRAYSIZE(aidColumns)) {
return;
}
HttpIndexLoader::SortType asortFlip[] = {
HttpIndexLoader::SORT_UNSORTED,
HttpIndexLoader::SORT_INSTALLEDDESCENDING,
HttpIndexLoader::SORT_INSTALLEDASCENDING,
HttpIndexLoader::SORT_TITLEDESCENDING,
HttpIndexLoader::SORT_TITLEASCENDING,
HttpIndexLoader::SORT_PLAYERSDESCENDING,
HttpIndexLoader::SORT_PLAYERSASCENDING,
HttpIndexLoader::SORT_MISSIONSDESCENDING,
HttpIndexLoader::SORT_MISSIONSASCENDING
};
// If this is already the sort column, flip the sort
if (id == idSortIndicator_) {
sort_ = asortFlip[sort_];
idxl_.Sort(sort_);
ShowIndex();
return;
}
// Take sort indicator off
char szT[32];
if (idSortIndicator_ != 0) {
LabelControl *plbl = (LabelControl *)GetControlPtr(idSortIndicator_);
strncpyz(szT, plbl->GetText(), sizeof(szT));
int cch = (int)strlen(szT);
if (szT[cch - 1] == '*') {
szT[cch - 1] = 0;
plbl->SetText(szT);
}
UpdateLabelRects(plbl);
}
// Put on new column
idSortIndicator_ = id;
LabelControl *plbl = (LabelControl *)GetControlPtr(idSortIndicator_);
strncpyz(szT, plbl->GetText(), sizeof(szT));
int cch = (int)strlen(szT);
if (szT[cch - 1] != '*') {
szT[cch] = '*';
szT[cch + 1] = 0;
plbl->SetText(szT);
UpdateLabelRects(plbl);
}
// Force this before the sort occurs, for immediate visual feedback
gpmfrmm->DrawFrame(false);
// Perform default sort for this column
HttpIndexLoader::SortType asortDefault[] = {
HttpIndexLoader::SORT_INSTALLEDDESCENDING,
HttpIndexLoader::SORT_TITLEASCENDING,
HttpIndexLoader::SORT_PLAYERSASCENDING,
HttpIndexLoader::SORT_MISSIONSDESCENDING
};
sort_ = asortDefault[iCol];
idxl_.Sort(sort_);
ShowIndex();
}
示例3: PositionColumns
void DownloadMissionPackForm::PositionColumns() {
// Calc tab stops in the list
// S Title # Players Downloads
// S is + for installed, or ! for upgrade
// Title is the title. Make this as wide as possible
// # Players is as close to Downloads as is reasonable
// # Missions is right aligned
ListControl *plstc = (ListControl *)GetControlPtr(kidcMissionPackList);
Font *pfnt = plstc->GetFont();
LabelControl *plbl = (LabelControl *)GetControlPtr(kidcStatus);
#if 1
plbl->SetText("");
int cxPlus = pfnt->GetTextExtent("+");
#else
int cxPlus = pfnt->GetTextExtent(plbl->GetText());
#endif
plbl = (LabelControl *)GetControlPtr(kidcTitle);
int cxTitle = pfnt->GetTextExtent(plbl->GetText());
plbl = (LabelControl *)GetControlPtr(kidcNumPlayers);
int cxNumPlayers = pfnt->GetTextExtent(plbl->GetText());
int cxAsterisk = pfnt->GetTextExtent("*");
plbl = (LabelControl *)GetControlPtr(kidcNumMissions);
int cxNumMissions = pfnt->GetTextExtent(plbl->GetText());
Rect rcList;
plstc->GetRect(&rcList);
int xStatus = 2;
int xTitle = (rcList.Width() / 4 - cxTitle) / 2;
int xNumMissions = rcList.Width() - cxAsterisk - cxNumMissions;
int xNumPlayers = xNumMissions - 10 - cxNumPlayers;
// Calc the top of the list (past the arrow) for better column
// label hittesting
Size sizArrow;
ListControl::s_ptbmScrollUpUp->GetSize(&sizArrow);
int yListTop = rcList.top + sizArrow.cy;
// Set the label positions
// Enable the labels for hittesting
Rect rc;
plbl = (LabelControl *)GetControlPtr(kidcStatus);
plbl->GetRect(&rc);
rc.left = rcList.left + xStatus;
rc.right = xTitle;
rc.bottom += (yListTop - rc.bottom) / 2;
plbl->SetRect(&rc);
plbl->SetFlags(plbl->GetFlags() | kfLblHitTest);
rcStatus_ = rc;
plbl = (LabelControl *)GetControlPtr(kidcTitle);
plbl->GetRect(&rc);
rc.Offset(rcList.left + xTitle - rc.left, 0);
rc.right += rc.Width();
rc.bottom += (yListTop - rc.bottom) / 2;
plbl->SetRect(&rc);
plbl->SetFlags(plbl->GetFlags() | kfLblHitTest);
rcTitle_ = rc;
plbl = (LabelControl *)GetControlPtr(kidcNumPlayers);
plbl->GetRect(&rc);
rc.Offset(rcList.left + xNumPlayers - rc.left, 0);
rc.bottom += (yListTop - rc.bottom) / 2;
plbl->SetRect(&rc);
plbl->SetFlags(plbl->GetFlags() | kfLblHitTest);
rcNumPlayers_ = rc;
plbl = (LabelControl *)GetControlPtr(kidcNumMissions);
plbl->GetRect(&rc);
rc.Offset(rcList.left + xNumMissions - rc.left, 0);
rc.bottom += (yListTop - rc.bottom) / 2;
plbl->SetRect(&rc);
plbl->SetFlags(plbl->GetFlags() | kfLblHitTest);
rcNumMissions_ = rc;
// Remember the tab settings for later use
x0_ = 0;
x1_ = cxPlus + 4;
x2_ = xNumPlayers + cxNumPlayers / 2;
x3_ = xNumMissions + cxNumMissions / 2;
}