本文整理汇总了C++中PView::GetView方法的典型用法代码示例。如果您正苦于以下问题:C++ PView::GetView方法的具体用法?C++ PView::GetView怎么用?C++ PView::GetView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PView
的用法示例。
在下文中一共展示了PView::GetView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invMsg
int32_t
PListViewInvoke(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *args = static_cast<PArgs*>(in);
int32 what;
if (args->FindInt32("message", &what) != B_OK)
what = -1;
if (backend->Window())
backend->Window()->Lock();
if (what >= 0)
{
BMessage invMsg(what);
backend->Invoke(&invMsg);
}
else
backend->Invoke();
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例2:
int32_t
PTextViewCut(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
uint64 id = 0;
if (inArgs->FindInt64("clipid", (int64*)&id) != B_OK)
return B_ERROR;
PObject *obj = BROKER->FindObject(id);
if (!obj || obj->GetType().ICompare("PClipboard") != 0)
return B_BAD_DATA;
PClipboard *clip = dynamic_cast<PClipboard*>(obj);
if (backend->Window())
backend->Window()->Lock();
backend->Cut(clip->GetBackend());
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例3:
int32_t
PListViewDeselectExcept(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
int32 from;
if (inArgs->FindInt32("from", &from) != B_OK)
return B_ERROR;
int32 to;
if (inArgs->FindInt32("to", &to) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->DeselectExcept(from, to);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例4:
int32_t
PMenuItemSubmenu(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BMenuItem *backend = (BMenuItem*)parent->GetView();
PArgs *outArgs = static_cast<PArgs*>(out);
outArgs->MakeEmpty();
BMenu *menu = backend->Menu();
PMenuBackend *menuBackend = static_cast<PMenuBackend*>(menu);
if (menuBackend)
{
PMenu *pmenu = static_cast<PMenu*>(menuBackend->GetOwner());
outArgs->AddInt64("id", pmenu->GetID());
}
else
outArgs->AddInt64("id", 0);
return B_OK;
}
示例5: BString
int32_t
PListViewAddItems(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *args = static_cast<PArgs*>(in), *outArgs = static_cast<PArgs*>(out);
int32 index;
if (args->FindInt32("index", &index) != B_OK)
index = -1;
if (backend->Window())
backend->Window()->Lock();
BList list;
BString itemName;
int32 nameIndex = 0;
while (args->FindString("items", &itemName, nameIndex) == B_OK)
{
list.AddItem(new BString(itemName));
nameIndex++;
}
bool outValue = true;
if (list.CountItems() > 0)
{
if (index >= 0)
outValue = backend->AddList(&list, index);
else
outValue = backend->AddList(&list);
}
if (backend->Window())
backend->Window()->Unlock();
for (int32 i = 0; i < list.CountItems(); i++)
delete ((BString*)list.ItemAt(i));
list.MakeEmpty();
outArgs->MakeEmpty();
outArgs->AddBool("value", outValue);
return B_OK;
}
示例6: BStringItem
int32_t
PListViewAddItem(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BListView *backend = (BListView*)parent->GetView();
PArgs *args = static_cast<PArgs*>(in), *outArgs = static_cast<PArgs*>(out);
BString label;
if (args->FindString("label", &label) != B_OK)
label = "";
int32 index;
if (args->FindInt32("index", &index) != B_OK)
index = -1;
if (backend->Window())
backend->Window()->Lock();
bool outValue;
BStringItem *item = new BStringItem(label.String());
if (index >= 0)
outValue = backend->AddItem(item);
else
outValue = backend->AddItem(item, index);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
outArgs->AddBool("value", outValue);
return B_OK;
}