1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2012, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6#ifndef VARIABLES_VIEW_H 7#define VARIABLES_VIEW_H 8 9 10#include <GroupView.h> 11 12#include "table/TreeTable.h" 13 14 15class ActionMenuItem; 16class CpuState; 17class SettingsMenu; 18class StackFrame; 19class Thread; 20class Type; 21class TypeComponentPath; 22class ValueNode; 23class ValueNodeContainer; 24class Variable; 25class VariablesViewState; 26class VariablesViewStateHistory; 27 28 29class VariablesView : public BGroupView, private TreeTableListener { 30public: 31 class Listener; 32 33public: 34 VariablesView(Listener* listener); 35 ~VariablesView(); 36 37 static VariablesView* Create(Listener* listener); 38 // throws 39 40 void SetStackFrame(Thread* thread, 41 StackFrame* stackFrame); 42 43 virtual void MessageReceived(BMessage* message); 44 45 virtual void DetachedFromWindow(); 46 47 void LoadSettings(const BMessage& settings); 48 status_t SaveSettings(BMessage& settings); 49 50private: 51 // TreeTableListener 52 virtual void TreeTableNodeExpandedChanged(TreeTable* table, 53 const TreeTablePath& path, bool expanded); 54 55 virtual void TreeTableCellMouseDown(TreeTable* table, 56 const TreeTablePath& path, 57 int32 columnIndex, BPoint screenWhere, 58 uint32 buttons); 59 60private: 61 class ContainerListener; 62 class ModelNode; 63 class VariableValueColumn; 64 class VariableTableModel; 65 class ContextMenu; 66 class TableCellContextMenuTracker; 67 typedef BObjectList<ActionMenuItem> ContextActionList; 68 69private: 70 void _Init(); 71 72 void _RequestNodeValue(ModelNode* node); 73 status_t _GetContextActionsForNode(ModelNode* node, 74 ContextActionList* actions); 75 status_t _AddContextAction(const char* action, 76 uint32 what, ContextActionList* actions, 77 BMessage*& _message); 78 void _FinishContextMenu(bool force); 79 void _SaveViewState() const; 80 void _RestoreViewState(); 81 status_t _AddViewStateDescendentNodeInfos( 82 VariablesViewState* viewState, void* parent, 83 TreeTablePath& path) const; 84 status_t _ApplyViewStateDescendentNodeInfos( 85 VariablesViewState* viewState, void* parent, 86 TreeTablePath& path); 87 88private: 89 Thread* fThread; 90 StackFrame* fStackFrame; 91 TreeTable* fVariableTable; 92 VariableTableModel* fVariableTableModel; 93 ContainerListener* fContainerListener; 94 VariablesViewState* fPreviousViewState; 95 VariablesViewStateHistory* fViewStateHistory; 96 TableCellContextMenuTracker* fTableCellContextMenuTracker; 97 Listener* fListener; 98}; 99 100 101class VariablesView::Listener { 102public: 103 virtual ~Listener(); 104 105 virtual void ValueNodeValueRequested(CpuState* cpuState, 106 ValueNodeContainer* container, 107 ValueNode* valueNode) = 0; 108}; 109 110 111#endif // VARIABLES_VIEW_H 112