Add a listener hook to notify the parent when model nodes are marked hidden.

This allows the variables view to request value/location resolution for those
nodes as needed, since it's otherwise unaware of their existence. This is
necessary in order to correctly handle nodes which require resolution to
happen in order to publish their children, since their value would otherwise
never be requested when they're hidden by virtue of being the child of an
address node.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42369 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent 2011-07-04 12:41:58 +00:00
parent 4c330e8cfd
commit aa069e23fa
1 changed files with 39 additions and 0 deletions

View File

@ -46,6 +46,12 @@ enum {
VALUE_NODE_TYPE = 'valn'
};
enum {
MSG_MODEL_NODE_HIDDEN = 'monh'
};
// maximum number of array elements to show by default
static const uint64 kMaxArrayElementCount = 10;
@ -62,6 +68,8 @@ public:
virtual void ValueNodeChildrenDeleted(ValueNode* node);
virtual void ValueNodeValueChanged(ValueNode* node);
virtual void ModelNodeHidden(ModelNode* node);
private:
BHandler* fIndirectTarget;
VariableTableModel* fModel;
@ -356,6 +364,7 @@ public:
void NodeExpanded(ModelNode* node);
void NotifyNodeChanged(ModelNode* node);
void NotifyNodeHidden(ModelNode* node);
private:
struct NodeHashDefinition {
@ -666,6 +675,20 @@ VariablesView::ContainerListener::ValueNodeValueChanged(ValueNode* node)
}
void
VariablesView::ContainerListener::ModelNodeHidden(ModelNode* node)
{
BReference<ModelNode> nodeReference(node);
BMessage message(MSG_MODEL_NODE_HIDDEN);
if (message.AddPointer("node", node) == B_OK
&& fIndirectTarget->Looper()->PostMessage(&message, fIndirectTarget)
== B_OK) {
nodeReference.Detach();
}
}
// #pragma mark - VariableTableModel
@ -1002,6 +1025,13 @@ VariablesView::VariableTableModel::NotifyNodeChanged(ModelNode* node)
}
void
VariablesView::VariableTableModel::NotifyNodeHidden(ModelNode* node)
{
fContainerListener->ModelNodeHidden(node);
}
status_t
VariablesView::VariableTableModel::_AddNode(Variable* variable,
ModelNode* parent, ValueNodeChild* nodeChild, bool isPresentationNode,
@ -1047,6 +1077,7 @@ VariablesView::VariableTableModel::_AddNode(Variable* variable,
== TYPE_ADDRESS
&& nodeChildRawType->Kind() == TYPE_COMPOUND) {
node->SetHidden(true);
NotifyNodeHidden(node);
}
}
@ -1372,6 +1403,14 @@ VariablesView::MessageReceived(BMessage* message)
break;
}
case MSG_MODEL_NODE_HIDDEN:
{
ModelNode* node;
if (message->FindPointer("node", (void**)&node) == B_OK)
_RequestNodeValue(node);
break;
}
case MSG_VARIABLES_VIEW_CONTEXT_MENU_DONE:
{
_FinishContextMenu(false);