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


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

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


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

示例1: BAlert

void
GrepWindow::_OnTrimSelection()
{
	if (fSearchResults->CurrentSelection() < 0) {
		BString text;
		text << B_TRANSLATE("Please select the files you wish to keep searching.");
		text << "\n";
		text << B_TRANSLATE("The unselected files will be removed from the list.");
		text << "\n";
		BAlert* alert = new BAlert(NULL, text.String(), B_TRANSLATE("OK"), NULL, NULL,
			B_WIDTH_AS_USUAL, B_WARNING_ALERT);
		alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
		alert->Go(NULL);
		return;
	}

	BMessage message;
	BString path;

	for (int32 index = 0; ; index++) {
		BStringItem* item = dynamic_cast<BStringItem*>(
			fSearchResults->ItemAt(index));
		if (item == NULL)
			break;

		if (!item->IsSelected() || item->OutlineLevel() != 0)
			continue;

		if (path == item->Text())
			continue;

		path = item->Text();
		entry_ref ref;
		if (get_ref_for_path(path.String(), &ref) == B_OK)
			message.AddRef("refs", &ref);
	}

	fModel->fDirectory = entry_ref();
		// invalidated on purpose

	fModel->fSelectedFiles.MakeEmpty();
	fModel->fSelectedFiles = message;

	PostMessage(MSG_START_CANCEL);

	_SetWindowTitle();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:47,代码来源:GrepWindow.cpp

示例2:

void
GrepWindow::_OnCopyText()
{
	bool onlyCopySelection = true;

	if (fSearchResults->CurrentSelection() < 0)
		onlyCopySelection = false;

	BString buffer;

	for (int32 index = 0; ; index++) {
		BStringItem* item = dynamic_cast<BStringItem*>(
			fSearchResults->ItemAt(index));
		if (item == NULL)
			break;

		if (onlyCopySelection) {
			if (item->IsSelected())
				buffer << item->Text() << "\n";
		} else
			buffer << item->Text() << "\n";
	}

	status_t status = B_OK;

	BMessage* clip = NULL;

	if (be_clipboard->Lock()) {
		be_clipboard->Clear();

		clip = be_clipboard->Data();

		clip->AddData("text/plain", B_MIME_TYPE, buffer.String(),
			buffer.Length());

		status = be_clipboard->Commit();

		if (status != B_OK) {
			be_clipboard->Unlock();
			return;
		}

		be_clipboard->Unlock();
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:45,代码来源:GrepWindow.cpp

示例3:

void
ProjectSettingsWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case M_SHOW_ADD_PATH:
		{
			fFilePanel->Show();
			break;
		}

		case M_DROP_PATH:
		{
			BString path;
			if (message->FindString("path",&path) == B_OK)
				fProject->AddLocalInclude(path.String());
			break;
		}

		case M_ADD_PATH:
		{
			entry_ref ref;
			int32 i = 0;
			while (message->FindRef("refs", i++, &ref) == B_OK) {
				fDirty = true;
				AddInclude(ref);
			}
			break;
		}

		case M_REMOVE_PATH:
		{
			int32 selection = fIncludeList->CurrentSelection();
			if (selection < 0)
				break;
			
			fDirty = true;
			
			for (int32 i = fIncludeList->CountItems() - 1; i >= 0; i--) {
				BStringItem* item = (BStringItem*)fIncludeList->ItemAt(i);
				if (item->IsSelected()) {
					fIncludeList->RemoveItem(item);
					fProject->RemoveLocalInclude(item->Text());
					delete item;
				}
			}
			break;
		}

		case M_TARGET_NAME_CHANGED:
		{
			if (fTargetText->Text() && strlen(fTargetText->Text()) > 0)
				fProject->SetTargetName(fTargetText->Text());

			fDirty = true;
		}

		case M_TOGGLE_DEBUG:
		{
			if (fDebugBox->Value() == B_CONTROL_ON) {
				fProject->SetDebug(true);
				fOpField->SetEnabled(false);
				fOpSizeBox->SetEnabled(false);
			} else {
				fProject->SetDebug(false);
				fOpField->SetEnabled(true);
				fOpSizeBox->SetEnabled(true);
			}
			fDirty = true;
			break;
		}

		case M_TOGGLE_PROFILE:
		{
			if (fProfileBox->Value() == B_CONTROL_ON)
				fProject->SetProfiling(true);
			else
				fProject->SetProfiling(false);

			fDirty = true;
			break;
		}

		case M_TOGGLE_OPSIZE:
		{
			if (fOpSizeBox->Value() == B_CONTROL_ON)
				fProject->SetOpForSize(true);
			else
				fProject->SetOpForSize(false);

			fDirty = true;
			break;
		}

		case M_SET_OP_VALUE:
		{
			BMenuItem *item = fOpField->Menu()->FindMarked();
			if (item)
				fProject->SetOpLevel(fOpField->Menu()->IndexOf(item));

			fDirty = true;
//.........这里部分代码省略.........
开发者ID:ModeenF,项目名称:Paladin,代码行数:101,代码来源:ProjectSettingsWindow.cpp


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