xref: /haiku/src/apps/debugger/user_interface/gui/team_window/StackTraceView.h (revision 46d4471af7fad4e52cfbd09174598cf5318aceed)
1 /*
2  * Copyright 2014, Rene Gollent, rene@gollent.com.
3  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef STACK_TRACE_VIEW_H
7 #define STACK_TRACE_VIEW_H
8 
9 #include <GroupView.h>
10 
11 #include <util/OpenHashTable.h>
12 
13 #include "table/Table.h"
14 #include "Team.h"
15 
16 
17 class StackFrame;
18 
19 
20 class StackTraceView : public BGroupView, private TableListener {
21 public:
22 	class Listener;
23 
24 public:
25 								StackTraceView(Listener* listener);
26 								~StackTraceView();
27 
28 	static	StackTraceView*		Create(Listener* listener);
29 									// throws
30 
31 			void				UnsetListener();
32 
33 			void				SetStackTrace(StackTrace* stackTrace);
34 			void				SetStackFrame(StackFrame* stackFrame);
35 
36 			void				LoadSettings(const BMessage& settings);
37 			status_t			SaveSettings(BMessage& settings);
38 
39 			void				SetStackTraceClearPending();
40 
41 private:
42 			class FramesTableModel;
43 			struct StackTraceKey;
44 			struct StackTraceSelectionEntry;
45 			struct StackTraceSelectionEntryHashDefinition;
46 
47 			typedef BOpenHashTable<StackTraceSelectionEntryHashDefinition>
48 				StackTraceSelectionInfoTable;
49 
50 private:
51 	// TableListener
52 	virtual	void				TableSelectionChanged(Table* table);
53 
54 			void				_Init();
55 
56 private:
57 			StackTrace*			fStackTrace;
58 			Table*				fFramesTable;
59 			FramesTableModel*	fFramesTableModel;
60 			bool				fTraceClearPending;
61 			StackTraceSelectionInfoTable* fSelectionInfoTable;
62 			Listener*			fListener;
63 };
64 
65 
66 class StackTraceView::Listener {
67 public:
68 	virtual						~Listener();
69 
70 	virtual	void				StackFrameSelectionChanged(
71 									StackFrame* frame) = 0;
72 };
73 
74 
75 #endif	// STACK_TRACE_VIEW_H
76