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
14class BButton;
15class BCheckBox;
16
17
18class BreakpointsView : public BGroupView,
19	private BreakpointListView::Listener {
20public:
21	class Listener;
22
23public:
24								BreakpointsView(Team* team, Listener* listener);
25								~BreakpointsView();
26
27	static	BreakpointsView*	Create(Team* team, Listener* listener);
28									// throws
29
30			void				UnsetListener();
31
32			void				UserBreakpointChanged(
33									UserBreakpoint* breakpoint);
34			void				WatchpointChanged(
35									Watchpoint* watchpoint);
36
37	virtual	void				MessageReceived(BMessage* message);
38	virtual	void				AttachedToWindow();
39
40			void				LoadSettings(const BMessage& settings);
41			status_t			SaveSettings(BMessage& settings);
42
43private:
44	// BreakpointListView::Listener
45	virtual	void				BreakpointSelectionChanged(
46									BreakpointProxyList& proxies);
47
48			void				_Init();
49
50			void				_UpdateButtons();
51
52			void				_SetSelection(BreakpointProxyList& proxies);
53			void				_HandleBreakpointAction(uint32 action);
54private:
55			Team*				fTeam;
56			BreakpointListView*	fListView;
57			BreakpointProxyList	fSelectedBreakpoints;
58			BButton*			fToggleBreakpointButton;
59			BButton*			fEditBreakpointButton;
60			BButton*			fRemoveBreakpointButton;
61			Listener*			fListener;
62};
63
64
65
66class BreakpointsView::Listener {
67public:
68	virtual						~Listener();
69
70	virtual	void				BreakpointSelectionChanged(
71									BreakpointProxyList& proxies) = 0;
72	virtual	void				SetBreakpointEnabledRequested(
73									UserBreakpoint* breakpoint,
74									bool enabled) = 0;
75	virtual	void				ClearBreakpointRequested(
76									UserBreakpoint* breakpoint) = 0;
77
78	virtual	void				SetWatchpointEnabledRequested(
79									Watchpoint* breakpoint,
80									bool enabled) = 0;
81	virtual	void				ClearWatchpointRequested(
82									Watchpoint* watchpoint) = 0;
83};
84
85
86#endif	// BREAKPOINT_LIST_VIEW_H
87