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 18 typedef std::map<BString, AppUsage *> appusage_t; 19 20 class BButton; 21 class BCheckBox; 22 class BTextControl; 23 class BStringColumn; 24 class BDateColumn; 25 26 27 class AppRow : public BRow { 28 public: 29 AppRow(const char* name, 30 const char* signature, bool allowed); 31 Name()32 const char* Name() const { return fName.String(); } Signature()33 const char* Signature() { return fSignature.String(); }; 34 void SetAllowed(bool allowed); Allowed()35 bool Allowed() { return fAllowed; }; 36 void RefreshEnabledField(); 37 38 private: 39 BString fName; 40 BString fSignature; 41 bool fAllowed; 42 }; 43 44 45 class NotificationsView : public SettingsPane { 46 public: 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 58 private: 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