本文整理汇总了C++中ModelNode::TableCellRenderer方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::TableCellRenderer方法的具体用法?C++ ModelNode::TableCellRenderer怎么用?C++ ModelNode::TableCellRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::TableCellRenderer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}