1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef THREAD_LIST_VIEW_H
6#define THREAD_LIST_VIEW_H
7
8
9#include <GroupView.h>
10
11#include "table/Table.h"
12#include "Team.h"
13
14
15class Thread;
16
17
18class ThreadListView : public BGroupView, private Team::Listener,
19	private TableListener {
20public:
21	class Listener;
22
23public:
24								ThreadListView(Team* team, Listener* listener);
25								~ThreadListView();
26
27	static	ThreadListView*		Create(Team* team, Listener* listener);
28									// throws
29
30			void				UnsetListener();
31
32			void				SetThread(Thread* thread);
33
34	virtual	void				MessageReceived(BMessage* message);
35
36			void				LoadSettings(const BMessage& settings);
37			status_t			SaveSettings(BMessage& settings);
38
39private:
40			class ThreadsTableModel;
41
42private:
43	// Team::Listener
44	virtual	void				ThreadAdded(const Team::ThreadEvent& event);
45	virtual	void				ThreadRemoved(const Team::ThreadEvent& event);
46	virtual	void				ThreadStateChanged(
47									const Team::ThreadEvent& event);
48
49	// TableListener
50	virtual	void				TableSelectionChanged(Table* table);
51
52			void				_Init();
53
54private:
55			Team*				fTeam;
56			Thread*				fThread;
57			Table*				fThreadsTable;
58			ThreadsTableModel*	fThreadsTableModel;
59			Listener*			fListener;
60};
61
62
63class ThreadListView::Listener {
64public:
65	virtual						~Listener();
66
67	virtual	void				ThreadSelectionChanged(Thread* thread) = 0;
68};
69
70
71#endif	// THREAD_LIST_VIEW_H
72