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 15 class ActionMenuItem; 16 class CpuState; 17 class SettingsMenu; 18 class StackFrame; 19 class Thread; 20 class Type; 21 class TypeComponentPath; 22 class ValueNode; 23 class ValueNodeContainer; 24 class Variable; 25 class VariablesViewState; 26 class VariablesViewStateHistory; 27 28 29 class VariablesView : public BGroupView, private TreeTableListener { 30 public: 31 class Listener; 32 33 public: 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 50 private: 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 60 private: 61 class ContainerListener; 62 class ModelNode; 63 class VariableValueColumn; 64 class VariableTableModel; 65 class ContextMenu; 66 class TableCellContextMenuTracker; 67 typedef BObjectList<ActionMenuItem> ContextActionList; 68 69 private: 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 88 private: 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 101 class VariablesView::Listener { 102 public: 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