xref: /haiku/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.h (revision 7e78b434f4cb9bfc5b2f676a3c6033d77c3f9df0)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Copyright 2013, Rene Gollent, rene@gollent.com.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef BREAKPOINT_LIST_VIEW_H
7 #define BREAKPOINT_LIST_VIEW_H
8 
9 
10 #include <GroupView.h>
11 
12 #include "table/Table.h"
13 
14 
15 class Team;
16 class UserBreakpoint;
17 class Watchpoint;
18 
19 
20 enum breakpoint_proxy_type {
21 	BREAKPOINT_PROXY_TYPE_BREAKPOINT = 0,
22 	BREAKPOINT_PROXY_TYPE_WATCHPOINT = 1
23 };
24 
25 
26 class BreakpointProxy : public BReferenceable {
27 public:
28 								BreakpointProxy(UserBreakpoint* breakpoint,
29 									Watchpoint* watchpoint);
30 								~BreakpointProxy();
31 
32 			breakpoint_proxy_type Type() const;
33 
GetBreakpoint()34 			UserBreakpoint*		GetBreakpoint() const { return fBreakpoint; }
GetWatchpoint()35 			Watchpoint*			GetWatchpoint() const { return fWatchpoint; }
36 
37 private:
38 			UserBreakpoint*		fBreakpoint;
39 			Watchpoint*			fWatchpoint;
40 };
41 
42 typedef BObjectList<BreakpointProxy> BreakpointProxyList;
43 
44 
45 class BreakpointListView : public BGroupView, private TableListener {
46 public:
47 	class Listener;
48 
49 public:
50 								BreakpointListView(Team* team,
51 									Listener* listener);
52 								~BreakpointListView();
53 
54 	static	BreakpointListView*	Create(Team* team, Listener* listener,
55 									BView* filterTarget);
56 									// throws
57 
58 			void				UnsetListener();
59 
60 			void				UserBreakpointChanged(
61 									UserBreakpoint* breakpoint);
62 			void				WatchpointChanged(
63 									Watchpoint* breakpoint);
64 
65 			void				LoadSettings(const BMessage& settings);
66 			status_t			SaveSettings(BMessage& settings);
67 
68 private:
69 			class BreakpointsTableModel;
70 			class ListInputFilter;
71 
72 private:
73 	// TableListener
74 	virtual	void				TableSelectionChanged(Table* table);
75 
76 			void				_Init(BView* filterTarget);
77 
78 private:
79 			Team*				fTeam;
80 			Table*				fBreakpointsTable;
81 			BreakpointsTableModel* fBreakpointsTableModel;
82 			Listener*			fListener;
83 };
84 
85 
86 class BreakpointListView::Listener {
87 public:
88 	virtual						~Listener();
89 
90 	virtual	void				BreakpointSelectionChanged(
91 									BreakpointProxyList& breakpoints) = 0;
92 };
93 
94 
95 #endif	// BREAKPOINT_LIST_VIEW_H
96