本文整理汇总了C++中BTextControl::Label方法的典型用法代码示例。如果您正苦于以下问题:C++ BTextControl::Label方法的具体用法?C++ BTextControl::Label怎么用?C++ BTextControl::Label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTextControl
的用法示例。
在下文中一共展示了BTextControl::Label方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
Window::Window()
: BWindow(BRect(100, 100, 590, 260), "EventMask-Test",
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
BView* view = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(view);
BTextControl* textControl = new BTextControl(BRect(10, 10, 290, 30),
"text", "Type to test focus suspending:", "", NULL, B_FOLLOW_LEFT_RIGHT);
textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
view->AddChild(textControl);
textControl = new BTextControl(BRect(300, 10, 420, 30),
"all", "All keys:", "", NULL, B_FOLLOW_LEFT_RIGHT);
textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
view->AddChild(textControl);
textControl->TextView()->SetEventMask(B_KEYBOARD_EVENTS, 0);
BRect rect(10, 40, 120, 120);
for (int32 i = 0; i < 4; i++) {
uint32 options = 0;
switch (i) {
case 1:
options = B_SUSPEND_VIEW_FOCUS;
break;
case 2:
options = B_LOCK_WINDOW_FOCUS;
break;
case 3:
options = B_SUSPEND_VIEW_FOCUS | B_LOCK_WINDOW_FOCUS;
break;
}
fViews[i] = new PositionView(rect, options);
view->AddChild(fViews[i]);
rect.OffsetBy(120, 0);
}
BCheckBox* checkBox = new BCheckBox(BRect(10, 130, 200, 160), "permanent", "Get all pointer events", new BMessage(kMsgPointerEvents));
view->AddChild(checkBox);
}
示例2:
void
DocInfoWindow::_ReadFieldsFromTable(BMessage& docInfo)
{
docInfo.MakeEmpty();
BView* child;
for (int32 i = 0; (child = fTable->ChildAt(i)) != NULL; i++) {
BTextControl* textControl = dynamic_cast<BTextControl*>(child);
if (textControl)
docInfo.AddString(textControl->Label(), textControl->Text());
}
}
示例3: HDialog
CInfoDialog::CInfoDialog(BRect frame, const char *name, window_type type, int flags,
BWindow *owner, BPositionIO* data)
: HDialog(frame, name, type, flags, owner, data)
{
fDoc = dynamic_cast<PDoc*>(owner);
FailNil(fDoc);
SetText("name", owner->Title());
char s[32];
sprintf(s, "%d", fDoc->TextView()->Size());
SetText("docsize", s);
sprintf(s, "%d", fDoc->TextView()->LineCount());
SetText("lines", s);
BMenuField *mf = dynamic_cast<BMenuField*>(FindView("mime"));
FailNil(mf);
fTypes = mf->Menu();
const char *p;
int i = 0;
while ((p = gPrefs->GetIxPrefString(prf_X_Mimetype, i++)) != NULL)
fTypes->AddItem(new BMenuItem(p, new BMessage(msg_FieldChanged)));
if (i == 1)
fTypes->AddItem(new BMenuItem("text/plain", new BMessage(msg_FieldChanged)));
const char *mime = fDoc->MimeType();
if (mime && mime[0])
{
for (i = 0; i < fTypes->CountItems(); i++)
{
BMenuItem *item = fTypes->ItemAt(i);
if (strcmp(item->Label(), mime) == 0)
{
item->SetMarked(true);
break;
}
}
if (i == fTypes->CountItems())
{
fTypes->AddSeparatorItem();
fTypes->AddItem(new BMenuItem(mime, new BMessage(msg_FieldChanged)));
fTypes->ItemAt(fTypes->CountItems() - 1)->SetMarked(true);
}
}
else
{
BMenuItem *item;
fTypes->AddSeparatorItem();
fTypes->AddItem(item = new BMenuItem("<undefined>", new BMessage(msg_FieldChanged)));
item->SetMarked(true);
}
if (fDoc->EntryRef())
{
BNode node;
FailOSErr(node.SetTo(fDoc->EntryRef()));
time_t t;
node.GetModificationTime(&t);
char time[256];
strcpy(time, ctime(&t));
time[strlen(time) - 1] = 0;
SetText("time", time);
}
else
{
//SetEnabled("mime", false);
SetText("time", "Not Saved");
}
mf = dynamic_cast<BMenuField*>(FindView("font"));
FailNil(mf);
fMenu = mf->Menu();
FailNil(fMenu);
font_family ff;
font_style fs;
for (int i = 0; i < count_font_families(); i++)
{
get_font_family(i, &ff);
BMenu *fontItem = new BMenu(ff);
FailNil(fontItem);
fMenu->AddItem(new BMenuItem(fontItem, new BMessage(msg_FieldChanged)));
fontItem->SetFont(be_plain_font);
for (int j = 0; j < count_font_styles(ff); j++)
{
get_font_style(ff, j, &fs);
BMessage *msg = new BMessage(msg_FieldChanged);
msg->AddString("family", ff);
//.........这里部分代码省略.........