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


C++ BStringItem::SetEnabled方法代码示例

本文整理汇总了C++中BStringItem::SetEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringItem::SetEnabled方法的具体用法?C++ BStringItem::SetEnabled怎么用?C++ BStringItem::SetEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BStringItem的用法示例。


在下文中一共展示了BStringItem::SetEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rect

ListChooseWindow::ListChooseWindow(list<string>* strL, string title, 
	string text1, string text2, string str) : 
	BWindow(BRect(200, 200, 415, 400), title.c_str(),
	B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, 
	B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_CLOSABLE)
{
	BRect rect(200, 200, 415, 400);
	rect.OffsetTo(0, 0);
	BView* backview = new BView(rect, "ListChooseBackView", 0, B_WILL_DRAW);
	backview->SetViewColor(222, 222, 222);
	AddChild(backview);
	
	BStringView* sv = new BStringView(BRect(15, 5, 185, 20),
		"ListChooseSV", text1.c_str());
	backview->AddChild(sv);
	sv = new BStringView(BRect(15, 20, 185, 33),
		"ListChooseSV", text2.c_str());
	backview->AddChild(sv);

	lv = new BListView(BRect(15, 40, 185, 153), "ListChooseLV");
	backview->AddChild(new BScrollView("scrollregister", lv,
		B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));

	BStringItem* si;
	for (list<string>::iterator iter = strL->begin(); iter !=
		strL->end(); iter++)
	{
		si = new BStringItem((*iter).c_str());
		lv->AddItem(si);
		if (*iter == str)
			si->SetEnabled(false);
	}
	
	BButton* button = new BButton(BRect(15, 165, 95, 185), "okB",
		"OK", new BMessage(ListChooseOKMSG));
	backview->AddChild(button);
	button->MakeDefault(true);
	button = new BButton(BRect(105, 165, 200, 185), "cancelB",
		"Cancel", new BMessage(ListChooseCancelMSG));
	backview->AddChild(button);
	
	clickWait = create_sem(0, "clickWait");
}
开发者ID:HaikuArchives,项目名称:Finance,代码行数:43,代码来源:ListChooseWindow.cpp

示例2: GetThemeManager

void
ThemeInterfaceView::_ThemeListPopulator()
{
	status_t err;
	int32 i, count;
	int32 importer;
	BString name;
	ThemeItem *ti;
	bool isro;
	BStringItem *si;

	LockLooper();
	fThemeList->MakeEmpty();
	UnlockLooper();

	ThemeManager* tman = GetThemeManager();
	tman->LoadThemes();

	count = tman->CountThemes();
	

	LockLooper();

	si = new BStringItem("(System themes)");
	si->SetEnabled(false);
	fThemeList->AddItem(si);
	si = NULL; // first non-readonly item will set it again

	// native themes
	for (i = 0; i < count; i++) {
		err = tman->ThemeName(i, name);
		isro = tman->ThemeIsReadOnly(i);
		if (err)
			continue;

		if (!isro && si == NULL) {
			si = new BStringItem("(User themes)");
			si->SetEnabled(false);
			fThemeList->AddItem(si);
		}

		ti = new ThemeItem(i, name.String(), isro);
		fThemeList->AddItem(ti);
	}

	UnlockLooper();

	// for each importer
	for (importer = 0; importer < tman->CountThemeImporters(); importer++) {
		err = tman->ImportThemesFor(importer);
		if (err < 0)
			continue;
		PRINT(("Imports for %s: %d\n", tman->ThemeImporterAt(importer), (tman->CountThemes() - count)));
		if (tman->CountThemes() == count)
			continue; // nothing found

		// separator item
		name = "Imported (";
		name << tman->ThemeImporterAt(importer) << ")";
		si = new BStringItem(name.String());
		si->SetEnabled(false);
		LockLooper();
		fThemeList->AddItem(si);
		UnlockLooper();

		// add new themes
		count = tman->CountThemes();
		// we reuse i from where it was left
		for (; i < count; i++) {
			err = tman->ThemeName(i, name);
			isro = true;// importers can't save themes back
			if (err)
				continue;
			ti = new ThemeItem(i, name.String(), isro);
			LockLooper();
			fThemeList->AddItem(ti);
			UnlockLooper();
			// rest a bit
			snooze(1000);
		}
	}

	// enable controls again
	BControl *c;
	LockLooper();
	for (i = 0; ChildAt(i); i++) {
		c = dynamic_cast<BControl *>(ChildAt(i));
		if (c)
			c->SetEnabled(true);
	}
	UnlockLooper();
}
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:92,代码来源:ThemeInterfaceView.cpp


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