本文整理汇总了C++中ModelNode::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::GetValue方法的具体用法?C++ ModelNode::GetValue怎么用?C++ ModelNode::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPreferredWidth
float GetPreferredWidth(const BVariant& value, BView* targetView) const
{
// get the preferred width from the node's designated renderer
if (value.Type() == VALUE_NODE_TYPE) {
ModelNode* node = dynamic_cast<ModelNode*>(value.ToReferenceable());
if (node != NULL && node->GetValue() != NULL
&& node->TableCellRenderer() != NULL) {
return node->TableCellRenderer()->PreferredValueWidth(
node->GetValue(), targetView);
}
}
return fColumn.BTitledColumn::GetPreferredWidth(NULL, targetView);
}
示例2: DrawValue
void DrawValue(const BVariant& value, BRect rect, BView* targetView)
{
// draw the node's value with the designated renderer
if (value.Type() == VALUE_NODE_TYPE) {
ModelNode* node = dynamic_cast<ModelNode*>(value.ToReferenceable());
if (node != NULL && node->GetValue() != NULL
&& node->TableCellRenderer() != NULL) {
node->TableCellRenderer()->RenderValue(node->GetValue(), rect,
targetView);
return;
}
}
// fall back to drawing an empty string
fField.SetString("");
fField.SetWidth(Width());
fColumn.DrawField(&fField, rect, targetView);
}
示例3: containerLocker
void
VariablesView::VariableTableModel::ValueNodeValueChanged(ValueNode* valueNode)
{
if (fContainer == NULL)
return;
AutoLocker<ValueNodeContainer> containerLocker(fContainer);
// check whether we know the node
ValueNodeChild* nodeChild = valueNode->NodeChild();
if (nodeChild == NULL)
return;
ModelNode* modelNode = fNodeTable.Lookup(nodeChild);
if (modelNode == NULL)
return;
// check whether the value actually changed
Value* value = valueNode->GetValue();
if (value == modelNode->GetValue())
return;
// get a value handler
ValueHandler* valueHandler;
status_t error = ValueHandlerRoster::Default()->FindValueHandler(value,
valueHandler);
if (error != B_OK)
return;
BReference<ValueHandler> handlerReference(valueHandler, true);
// create a table cell renderer for the value
TableCellValueRenderer* renderer = NULL;
error = valueHandler->GetTableCellValueRenderer(value, renderer);
if (error != B_OK)
return;
// set value/handler/renderer
modelNode->SetValue(value);
modelNode->SetValueHandler(valueHandler);
modelNode->SetTableCellRenderer(renderer);
// notify table model listeners
NotifyNodeChanged(modelNode);
}
示例4:
bool
VariablesView::VariableTableModel::GetValueAt(void* object, int32 columnIndex,
BVariant& _value)
{
ModelNode* node = (ModelNode*)object;
switch (columnIndex) {
case 0:
_value.SetTo(node->Name(), B_VARIANT_DONT_COPY_DATA);
return true;
case 1:
if (node->GetValue() == NULL)
return false;
_value.SetTo(node, VALUE_NODE_TYPE);
return true;
default:
return false;
}
}
示例5: settingsMenuReference
void
VariablesView::TreeTableCellMouseDown(TreeTable* table,
const TreeTablePath& path, int32 columnIndex, BPoint screenWhere,
uint32 buttons)
{
if ((buttons & B_SECONDARY_MOUSE_BUTTON) == 0)
return;
_FinishContextMenu(true);
ModelNode* node = (ModelNode*)fVariableTableModel->NodeForPath(path);
if (node == NULL)
return;
TableCellValueRenderer* cellRenderer = node->TableCellRenderer();
if (cellRenderer == NULL)
return;
Settings* settings = cellRenderer->GetSettings();
if (settings == NULL)
return;
SettingsMenu* settingsMenu;
status_t error = node->GetValueHandler()->CreateTableCellValueSettingsMenu(
node->GetValue(), settings, settingsMenu);
BReference<SettingsMenu> settingsMenuReference(settingsMenu, true);
if (error != B_OK)
return;
TableCellContextMenuTracker* tracker = new(std::nothrow)
TableCellContextMenuTracker(node, Looper(), this);
BReference<TableCellContextMenuTracker> trackerReference(tracker);
if (tracker == NULL || tracker->Init(settings, settingsMenu) != B_OK)
return;
fTableCellContextMenuTracker = trackerReference.Detach();
fTableCellContextMenuTracker->ShowMenu(screenWhere);
}