1/*
2 * Copyright 2013-2015, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef SIGNALS_CONFIG_VIEW_H
6#define SIGNALS_CONFIG_VIEW_H
7
8
9#include <GroupView.h>
10
11#include "table/Table.h"
12
13#include "Team.h"
14
15#include "types/Types.h"
16
17
18class BButton;
19class BMenuField;
20class SignalDispositionEditWindow;
21class UserInterfaceListener;
22
23
24class SignalsConfigView : public BGroupView, private Team::Listener,
25	private TableListener {
26public:
27								SignalsConfigView(::Team* team,
28									UserInterfaceListener* listener);
29
30								~SignalsConfigView();
31
32	static	SignalsConfigView* 	Create(::Team* team,
33									UserInterfaceListener* listener);
34									// throws
35
36	virtual	void				AttachedToWindow();
37	virtual	void				MessageReceived(BMessage* message);
38
39private:
40			class SignalDispositionModel;
41
42private:
43	// Team::Listener
44	virtual	void				CustomSignalDispositionChanged(
45									const Team::CustomSignalDispositionEvent&
46										event);
47	virtual	void				CustomSignalDispositionRemoved(
48									const Team::CustomSignalDispositionEvent&
49										event);
50
51	// TableListener
52	virtual	void				TableSelectionChanged(Table* table);
53
54			void	 			_Init();
55
56			void				_UpdateSignalConfigState();
57									// must be called with team lock held
58
59private:
60			::Team*				fTeam;
61			UserInterfaceListener* fListener;
62			BMenuField*			fDefaultSignalDisposition;
63			Table*				fDispositionExceptions;
64			BButton*			fAddDispositionButton;
65			BButton*			fEditDispositionButton;
66			BButton*			fRemoveDispositionButton;
67			SignalDispositionModel* fDispositionModel;
68			SignalDispositionEditWindow* fEditWindow;
69};
70
71
72#endif // SIGNALS_CONFIG_VIEW_H
73