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