当前位置: 首页>>代码示例>>C++>>正文


C++ BTextControl::Label方法代码示例

本文整理汇总了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);
}
开发者ID:mmanley,项目名称:Antares,代码行数:43,代码来源:EventMask.cpp

示例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());
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:12,代码来源:DocInfoWindow.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:jscipione,项目名称:Paladin,代码行数:101,代码来源:CInfoDialog.cpp


注:本文中的BTextControl::Label方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。