本文整理汇总了C++中BTextView::GetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ BTextView::GetFont方法的具体用法?C++ BTextView::GetFont怎么用?C++ BTextView::GetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTextView
的用法示例。
在下文中一共展示了BTextView::GetFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message
//.........这里部分代码省略.........
= fPairsView->PairsButtonList();
if (pairsButtonList == NULL)
break;
// look at what icon is behind a button
int32 buttonCount = pairsButtonList->CountItems();
for (int32 i = 0; i < buttonCount; i++) {
int32 iconPosition = fPairsView->GetIconPosition(i);
if (iconPosition == buttonNumber) {
fPairCardPosition = i % (buttonCount / 2);
fButtonPosition = iconPosition;
break;
}
}
// gameplay
fButtonClicks++;
pairsButtonList->ItemAt(fButtonPosition)->Hide();
if (fIsFirstClick) {
fPairCardTmpPosition = fPairCardPosition;
fButtonTmpPosition = fButtonPosition;
} else {
delete fPairComparing;
// message of message runner might not have arrived
// yet, so it is deleted here to prevent any leaking
// just in case
BMessage message(kMsgPairComparing);
fPairComparing = new BMessageRunner(BMessenger(this),
&message, 5 * 100000L, 1);
fIsPairsActive = false;
}
fIsFirstClick = !fIsFirstClick;
break;
}
case kMsgPairComparing:
{
BObjectList<PairsButton>* pairsButtonList
= fPairsView->PairsButtonList();
if (pairsButtonList == NULL)
break;
delete fPairComparing;
fPairComparing = NULL;
fIsPairsActive = true;
if (fPairCardPosition == fPairCardTmpPosition)
fFinishPairs++;
else {
pairsButtonList->ItemAt(fButtonPosition)->Show();
pairsButtonList->ItemAt(fButtonTmpPosition)->Show();
}
// game end and results
if (fFinishPairs == pairsButtonList->CountItems() / 2) {
BString score;
score << fButtonClicks;
BString strAbout = B_TRANSLATE("%app%\n"
"\twritten by Ralf Schülke\n"
"\tCopyright 2008-2010, Haiku Inc.\n"
"\n"
"You completed the game in %num% clicks.\n");
strAbout.ReplaceFirst("%app%",
B_TRANSLATE_SYSTEM_NAME("Pairs"));
strAbout.ReplaceFirst("%num%", score);
BAlert* alert = new BAlert("about",
strAbout.String(),
B_TRANSLATE("New game"),
B_TRANSLATE("Quit game"));
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetSize(18);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0,
strlen(B_TRANSLATE_SYSTEM_NAME("Pairs")), &font);
view->ResizeToPreferred();
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 0)
NewGame();
else
be_app->PostMessage(B_QUIT_REQUESTED);
}
break;
}
default:
BWindow::MessageReceived(message);
}
}
示例2: text
void
NetworkStatusView::_ShowConfiguration(BMessage* message)
{
static const struct information_entry {
const char* label;
int32 control;
} kInformationEntries[] = {
{ B_TRANSLATE("Address"), SIOCGIFADDR },
{ B_TRANSLATE("Broadcast"), SIOCGIFBRDADDR },
{ B_TRANSLATE("Netmask"), SIOCGIFNETMASK },
{ NULL }
};
SocketOpener socket;
if (socket.InitCheck() != B_OK)
return;
const char* name;
if (message->FindString("interface", &name) != B_OK)
return;
ifreq request;
if (!_PrepareRequest(request, name))
return;
BString text(B_TRANSLATE("%ifaceName information:\n"));
text.ReplaceFirst("%ifaceName", name);
size_t boldLength = text.Length();
for (int i = 0; kInformationEntries[i].label; i++) {
if (ioctl(socket, kInformationEntries[i].control, &request,
sizeof(request)) < 0) {
continue;
}
char address[32];
sockaddr_in* inetAddress = NULL;
switch (kInformationEntries[i].control) {
case SIOCGIFNETMASK:
inetAddress = (sockaddr_in*)&request.ifr_mask;
break;
default:
inetAddress = (sockaddr_in*)&request.ifr_addr;
break;
}
if (inet_ntop(AF_INET, &inetAddress->sin_addr, address,
sizeof(address)) == NULL) {
return;
}
text << "\n" << kInformationEntries[i].label << ": " << address;
}
BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK"));
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, boldLength, &font);
alert->Go(NULL);
}