本文整理汇总了C++中BObjectList::FirstItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BObjectList::FirstItem方法的具体用法?C++ BObjectList::FirstItem怎么用?C++ BObjectList::FirstItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BObjectList
的用法示例。
在下文中一共展示了BObjectList::FirstItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message
void
TFilePanel::OpenDirectory()
{
BObjectList<BPose>* list = PoseView()->SelectionList();
if (list->CountItems() != 1)
return;
Model* model = list->FirstItem()->TargetModel();
if (model->ResolveIfLink()->IsDirectory()) {
BMessage message(B_REFS_RECEIVED);
message.AddRef("refs", model->EntryRef());
PostMessage(&message);
}
}
示例2: GetLinkFlavor
void
TFilePanel::AdjustButton()
{
// adjust button state
BButton* button = dynamic_cast<BButton*>(FindView("default button"));
if (button == NULL)
return;
BTextControl* textControl
= dynamic_cast<BTextControl*>(FindView("text view"));
BObjectList<BPose>* selectionList = fPoseView->SelectionList();
BString buttonText = fButtonText;
bool enabled = false;
if (fIsSavePanel && textControl != NULL) {
enabled = textControl->Text()[0] != '\0';
if (fPoseView->IsFocus()) {
fPoseView->ShowSelection(true);
if (selectionList->CountItems() == 1) {
Model* model = selectionList->FirstItem()->TargetModel();
if (model->ResolveIfLink()->IsDirectory()) {
enabled = true;
buttonText = B_TRANSLATE("Open");
} else {
// insert the name of the selected model into
// the text field
textControl->SetText(model->Name());
textControl->MakeFocus(true);
}
}
} else
fPoseView->ShowSelection(false);
} else {
int32 count = selectionList->CountItems();
if (count) {
enabled = true;
// go through selection list looking at content
for (int32 index = 0; index < count; index++) {
Model* model = selectionList->ItemAt(index)->TargetModel();
uint32 modelFlavor = GetLinkFlavor(model, false);
uint32 linkFlavor = GetLinkFlavor(model, true);
// if only one item is selected and we're not in dir
// selection mode then we don't disable button ever
if ((modelFlavor == B_DIRECTORY_NODE
|| linkFlavor == B_DIRECTORY_NODE)
&& count == 1)
break;
if ((fNodeFlavors & modelFlavor) == 0
&& (fNodeFlavors & linkFlavor) == 0) {
enabled = false;
break;
}
}
}
}
button->SetLabel(buttonText.String());
button->SetEnabled(enabled);
}