本文整理汇总了C++中Property::IsEditable方法的典型用法代码示例。如果您正苦于以下问题:C++ Property::IsEditable方法的具体用法?C++ Property::IsEditable怎么用?C++ Property::IsEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::IsEditable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selection
// SetTo
void
PropertyListView::SetTo(PropertyObject* object)
{
// try to do without rebuilding the list
// it should in fact be pretty unlikely that this does not
// work, but we keep being defensive
if (fPropertyObject && object &&
fPropertyObject->ContainsSameProperties(*object)) {
// iterate over view items and update their value views
bool error = false;
for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) {
Property* property = object->PropertyAt(i);
if (!item->AdoptProperty(property)) {
// the reason for this can be that the property is
// unkown to the PropertyEditorFactory and therefor
// there is no editor view at this item
fprintf(stderr, "PropertyListView::_SetTo() - "
"property mismatch at %ld\n", i);
error = true;
break;
}
if (property)
item->SetEnabled(property->IsEditable());
}
// we didn't need to make empty, but transfer ownership
// of the object
if (!error) {
// if the "adopt" process went only halfway,
// some properties of the original object
// are still referenced, so we can only
// delete the original object if the process
// was successful and leak Properties otherwise,
// but this case is only theoretical anyways...
delete fPropertyObject;
}
fPropertyObject = object;
} else {
// remember scroll pos, selection and focused item
BPoint scrollOffset = ScrollOffset();
BList selection(20);
int32 focused = -1;
for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) {
if (item->IsSelected())
selection.AddItem((void*)i);
if (item->IsFocused())
focused = i;
}
if (Window())
Window()->BeginViewTransaction();
fSuspendUpdates = true;
// rebuild list
_MakeEmpty();
fPropertyObject = object;
if (fPropertyObject) {
// fill with content
for (int32 i = 0; Property* property = fPropertyObject->PropertyAt(i); i++) {
PropertyItemView* item = new PropertyItemView(property);
item->SetEnabled(property->IsEditable());
_AddItem(item);
}
_LayoutItems();
// restore scroll pos, selection and focus
SetScrollOffset(scrollOffset);
for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) {
if (selection.HasItem((void*)i))
item->SetSelected(true);
if (i == focused)
item->MakeFocus(true);
}
}
if (Window())
Window()->EndViewTransaction();
fSuspendUpdates = false;
SetDataRect(_ItemsRect());
}
_UpdateSavedProperties();
_CheckMenuStatus();
Invalidate();
}