xref: /haiku/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef BREAKPOINTS_VIEW_H
6 #define BREAKPOINTS_VIEW_H
7 
8 
9 #include <GroupView.h>
10 
11 #include "BreakpointListView.h"
12 
13 
14 class BButton;
15 
16 
17 class BreakpointsView : public BGroupView,
18 	private BreakpointListView::Listener {
19 public:
20 	class Listener;
21 
22 public:
23 								BreakpointsView(Team* team, Listener* listener);
24 								~BreakpointsView();
25 
26 	static	BreakpointsView*	Create(Team* team, Listener* listener);
27 									// throws
28 
29 			void				UnsetListener();
30 
31 			void				SetBreakpoint(UserBreakpoint* breakpoint,
32 									Watchpoint* watchpoint);
33 
34 			void				UserBreakpointChanged(
35 									UserBreakpoint* breakpoint);
36 			void				WatchpointChanged(
37 									Watchpoint* watchpoint);
38 
39 	virtual	void				MessageReceived(BMessage* message);
40 	virtual	void				AttachedToWindow();
41 
42 			void				LoadSettings(const BMessage& settings);
43 			status_t			SaveSettings(BMessage& settings);
44 
45 private:
46 	// BreakpointListView::Listener
47 	virtual	void				BreakpointSelectionChanged(
48 									UserBreakpoint* breakpoint);
49 	virtual	void				WatchpointSelectionChanged(
50 									Watchpoint* watchpoint);
51 
52 			void				_Init();
53 
54 			void				_UpdateButtons();
55 
56 private:
57 			Team*				fTeam;
58 			UserBreakpoint*		fBreakpoint;
59 			Watchpoint*			fWatchpoint;
60 			BreakpointListView*	fListView;
61 			BButton*			fToggleBreakpointButton;
62 			BButton*			fRemoveBreakpointButton;
63 			Listener*			fListener;
64 };
65 
66 
67 
68 class BreakpointsView::Listener {
69 public:
70 	virtual						~Listener();
71 
72 	virtual	void				BreakpointSelectionChanged(
73 									UserBreakpoint* breakpoint) = 0;
74 	virtual	void				SetBreakpointEnabledRequested(
75 									UserBreakpoint* breakpoint,
76 									bool enabled) = 0;
77 	virtual	void				ClearBreakpointRequested(
78 									UserBreakpoint* breakpoint) = 0;
79 
80 	virtual	void				WatchpointSelectionChanged(
81 									Watchpoint* Watchpoint) = 0;
82 	virtual	void				SetWatchpointEnabledRequested(
83 									Watchpoint* breakpoint,
84 									bool enabled) = 0;
85 	virtual	void				ClearWatchpointRequested(
86 									Watchpoint* watchpoint) = 0;
87 };
88 
89 
90 #endif	// BREAKPOINT_LIST_VIEW_H
91