xref: /haiku/src/apps/debugger/user_interface/gui/team_window/VariablesView.h (revision c90684742e7361651849be4116d0e5de3a817194)
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 private:
45 	// TreeTableListener
46 	virtual	void				TreeTableNodeExpandedChanged(TreeTable* table,
47 									const TreeTablePath& path, bool expanded);
48 
49 	virtual	void				TreeTableCellMouseDown(TreeTable* table,
50 									const TreeTablePath& path,
51 									int32 columnIndex, BPoint screenWhere,
52 									uint32 buttons);
53 
54 private:
55 			class ContainerListener;
56 			class ModelNode;
57 			class VariableValueColumn;
58 			class VariableTableModel;
59 			class ContextMenu;
60 			class TableCellContextMenuTracker;
61 
62 private:
63 			void				_Init();
64 
65 			void				_RequestNodeValue(ModelNode* node);
66 			void				_FinishContextMenu(bool force);
67 
68 //			void				_SaveViewState() const;
69 //			void				_RestoreViewState();
70 //			status_t			_AddViewStateDescendentNodeInfos(
71 //									VariablesViewState* viewState, void* parent,
72 //									TreeTablePath& path) const;
73 //			status_t			_ApplyViewStateDescendentNodeInfos(
74 //									VariablesViewState* viewState, void* parent,
75 //									TreeTablePath& path);
76 
77 private:
78 			Thread*				fThread;
79 			StackFrame*			fStackFrame;
80 			TreeTable*			fVariableTable;
81 			VariableTableModel*	fVariableTableModel;
82 			ContainerListener*	fContainerListener;
83 			VariablesViewState*	fPreviousViewState;
84 			VariablesViewStateHistory* fViewStateHistory;
85 			TableCellContextMenuTracker* fTableCellContextMenuTracker;
86 			Listener*			fListener;
87 };
88 
89 
90 class VariablesView::Listener {
91 public:
92 	virtual						~Listener();
93 
94 	virtual	void				ValueNodeValueRequested(CpuState* cpuState,
95 									ValueNodeContainer* container,
96 									ValueNode* valueNode) = 0;
97 };
98 
99 
100 #endif	// VARIABLES_VIEW_H
101