xref: /haiku/src/apps/debugger/user_interface/gui/team_window/VariablesView.h (revision 1026b0a1a76dc88927bb8175c470f638dc5464ee)
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 ActionMenuItem;
15 class CpuState;
16 class SettingsMenu;
17 class StackFrame;
18 class Thread;
19 class TypeComponentPath;
20 class ValueNode;
21 class ValueNodeContainer;
22 class Variable;
23 class VariablesViewState;
24 class VariablesViewStateHistory;
25 
26 
27 class VariablesView : public BGroupView, private TreeTableListener {
28 public:
29 	class Listener;
30 
31 public:
32 								VariablesView(Listener* listener);
33 								~VariablesView();
34 
35 	static	VariablesView*		Create(Listener* listener);
36 									// throws
37 
38 			void				SetStackFrame(Thread* thread,
39 									StackFrame* stackFrame);
40 
41 	virtual	void				MessageReceived(BMessage* message);
42 
43 	virtual	void				DetachedFromWindow();
44 
45 			void				LoadSettings(const BMessage& settings);
46 			status_t			SaveSettings(BMessage& settings);
47 
48 private:
49 	// TreeTableListener
50 	virtual	void				TreeTableNodeExpandedChanged(TreeTable* table,
51 									const TreeTablePath& path, bool expanded);
52 
53 	virtual	void				TreeTableCellMouseDown(TreeTable* table,
54 									const TreeTablePath& path,
55 									int32 columnIndex, BPoint screenWhere,
56 									uint32 buttons);
57 
58 private:
59 			class ContainerListener;
60 			class ModelNode;
61 			class VariableValueColumn;
62 			class VariableTableModel;
63 			class ContextMenu;
64 			class TableCellContextMenuTracker;
65 			typedef BObjectList<ActionMenuItem> ContextActionList;
66 
67 private:
68 			void				_Init();
69 
70 			void				_RequestNodeValue(ModelNode* node);
71 			status_t			_GetContextActionsForNode(ModelNode* node,
72 									ContextActionList* actions);
73 			void				_FinishContextMenu(bool force);
74 			void				_SaveViewState() const;
75 			void				_RestoreViewState();
76 			status_t			_AddViewStateDescendentNodeInfos(
77 									VariablesViewState* viewState, void* parent,
78 									TreeTablePath& path) const;
79 			status_t			_ApplyViewStateDescendentNodeInfos(
80 									VariablesViewState* viewState, void* parent,
81 									TreeTablePath& path);
82 
83 private:
84 			Thread*				fThread;
85 			StackFrame*			fStackFrame;
86 			TreeTable*			fVariableTable;
87 			VariableTableModel*	fVariableTableModel;
88 			ContainerListener*	fContainerListener;
89 			VariablesViewState*	fPreviousViewState;
90 			VariablesViewStateHistory* fViewStateHistory;
91 			TableCellContextMenuTracker* fTableCellContextMenuTracker;
92 			Listener*			fListener;
93 };
94 
95 
96 class VariablesView::Listener {
97 public:
98 	virtual						~Listener();
99 
100 	virtual	void				ValueNodeValueRequested(CpuState* cpuState,
101 									ValueNodeContainer* container,
102 									ValueNode* valueNode) = 0;
103 };
104 
105 
106 #endif	// VARIABLES_VIEW_H
107