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
15class Team;
16class UserBreakpoint;
17class Watchpoint;
18
19
20enum breakpoint_proxy_type {
21	BREAKPOINT_PROXY_TYPE_BREAKPOINT = 0,
22	BREAKPOINT_PROXY_TYPE_WATCHPOINT = 1
23};
24
25
26class BreakpointProxy : public BReferenceable {
27public:
28								BreakpointProxy(UserBreakpoint* breakpoint,
29									Watchpoint* watchpoint);
30								~BreakpointProxy();
31
32			breakpoint_proxy_type Type() const;
33
34			UserBreakpoint*		GetBreakpoint() const { return fBreakpoint; }
35			Watchpoint*			GetWatchpoint() const { return fWatchpoint; }
36
37private:
38			UserBreakpoint*		fBreakpoint;
39			Watchpoint*			fWatchpoint;
40};
41
42typedef BObjectList<BreakpointProxy> BreakpointProxyList;
43
44
45class BreakpointListView : public BGroupView, private TableListener {
46public:
47	class Listener;
48
49public:
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
68private:
69			class BreakpointsTableModel;
70			class ListInputFilter;
71
72private:
73	// TableListener
74	virtual	void				TableSelectionChanged(Table* table);
75
76			void				_Init(BView* filterTarget);
77
78private:
79			Team*				fTeam;
80			Table*				fBreakpointsTable;
81			BreakpointsTableModel* fBreakpointsTableModel;
82			Listener*			fListener;
83};
84
85
86class BreakpointListView::Listener {
87public:
88	virtual						~Listener();
89
90	virtual	void				BreakpointSelectionChanged(
91									BreakpointProxyList& breakpoints) = 0;
92};
93
94
95#endif	// BREAKPOINT_LIST_VIEW_H
96