本文整理汇总了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();
}
示例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();
}
}
示例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;
//.........这里部分代码省略.........