1/*
2 * Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
3 * Copyright 2009, Pier Luigi Fiorini.
4 * Distributed under the terms of the MIT License.
5 */
6#ifndef _APPS_VIEW_H
7#define _APPS_VIEW_H
8
9#include <FilePanel.h>
10#include <ColumnListView.h>
11#include <View.h>
12
13#include <notification/AppUsage.h>
14
15#include "AppRefFilter.h"
16#include "SettingsPane.h"
17
18typedef std::map<BString, AppUsage *> appusage_t;
19
20class BButton;
21class BCheckBox;
22class BTextControl;
23class BStringColumn;
24class BDateColumn;
25
26
27class AppRow : public BRow {
28public:
29								AppRow(const char* name,
30									const char* signature, bool allowed);
31
32			const char*			Name() const { return fName.String(); }
33			const char*			Signature() { return fSignature.String(); };
34			void				SetAllowed(bool allowed);
35			bool				Allowed() { return fAllowed; };
36			void				RefreshEnabledField();
37
38private:
39			BString				fName;
40			BString				fSignature;
41			bool				fAllowed;
42};
43
44
45class NotificationsView : public SettingsPane {
46public:
47								NotificationsView(SettingsHost* host);
48								~NotificationsView();
49
50	virtual	void				AttachedToWindow();
51	virtual	void				MessageReceived(BMessage* msg);
52			status_t			Revert();
53			bool				RevertPossible();
54			status_t			Defaults();
55			bool				DefaultsPossible();
56			bool				UseDefaultRevertButtons();
57
58private:
59			status_t			Load(BMessage&);
60			status_t			Save(BMessage&);
61			void				_ClearItemSettings();
62			void				_UpdateSelectedItem();
63			void				_RecallItemSettings();
64			void				_PopulateApplications();
65
66			appusage_t			fAppFilters;
67			AppRefFilter*		fPanelFilter;
68			BFilePanel*			fAddAppPanel;
69			BButton*			fAddButton;
70			BButton*			fRemoveButton;
71			BCheckBox*			fMuteAll;
72			BColumnListView*	fApplications;
73			AppRow*				fSelectedRow;
74			BStringColumn*		fAppCol;
75			BStringColumn*		fAppEnabledCol;
76};
77
78#endif // _APPS_VIEW_H
79