本文整理汇总了C++中BListView::Window方法的典型用法代码示例。如果您正苦于以下问题:C++ BListView::Window方法的具体用法?C++ BListView::Window怎么用?C++ BListView::Window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BListView
的用法示例。
在下文中一共展示了BListView::Window方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int32_t
PListViewSelect(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 index;
if (inArgs->FindInt32("index", &index) != B_OK)
return B_ERROR;
bool extend;
if (inArgs->FindBool("extend", &extend) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->Select(index, extend);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例2: 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;
}
示例3: 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;
}
示例4: str
status_t
PListView::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BListView *backend = (BListView*)fView;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
else if (str.ICompare("SelectionMessage") == 0)
{
BMessage selMsg(*intval.value);
backend->SetSelectionMessage(&selMsg);
}
else if (str.ICompare("InvocationMessage") == 0)
{
BMessage invMsg(*intval.value);
backend->SetInvocationMessage(&invMsg);
}
else if (str.ICompare("SelectionType") == 0)
{
prop->GetValue(&intval);
backend->SetListType((list_view_type)*intval.value);
}
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::SetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例5: 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;
}