1 /* 2 * Copyright 2010, Haiku, Inc. All Rights Reserved. 3 * Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved. 4 * Copyright 2004-2008, Michael Davidson. All Rights Reserved. 5 * Copyright 2004-2007, Mikael Eiman. All Rights Reserved. 6 * Distributed under the terms of the MIT License. 7 */ 8 #ifndef _NOTIFICATION_WINDOW_H 9 #define _NOTIFICATION_WINDOW_H 10 11 #include <cmath> 12 #include <vector> 13 #include <map> 14 15 #include <Directory.h> 16 #include <Deskbar.h> 17 #include <Entry.h> 18 #include <FindDirectory.h> 19 #include <Message.h> 20 #include <Notifications.h> 21 #include <PropertyInfo.h> 22 #include <String.h> 23 #include <Window.h> 24 25 #include "NotificationView.h" 26 27 class AppGroupView; 28 class AppUsage; 29 class BorderView; 30 class SettingsFile; 31 32 typedef std::map<BString, AppGroupView*> appview_t; 33 typedef std::map<BString, AppUsage*> appfilter_t; 34 typedef std::vector<NotificationView*> views_t; 35 36 extern const float kEdgePadding; 37 extern const float kSmallPadding; 38 extern const float kCloseSize; 39 extern const float kExpandSize; 40 extern const float kPenSize; 41 42 const uint32 kResizeToFit = 'IWrf'; 43 44 class NotificationWindow : public BWindow { 45 public: 46 NotificationWindow(); 47 virtual ~NotificationWindow(); 48 49 virtual bool QuitRequested(); 50 virtual void MessageReceived(BMessage*); 51 virtual void WorkspaceActivated(int32, bool); 52 virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, 53 int32, const char*); 54 55 icon_size IconSize(); 56 int32 Timeout(); 57 infoview_layout Layout(); 58 float ViewWidth(); 59 60 void ResizeAll(); 61 62 private: 63 friend class AppGroupView; 64 65 void PopupAnimation(float, float); 66 void LoadSettings(bool startMonitor = false); 67 void LoadAppFilters(bool startMonitor = false); 68 void SaveAppFilters(); 69 void _LoadGeneralSettings(bool startMonitor); 70 void _LoadDisplaySettings(bool startMonitor); 71 72 views_t fViews; 73 BorderView* fBorder; 74 75 appview_t fAppViews; 76 77 BString fStatusText; 78 BString fMessageText; 79 80 float fWidth; 81 icon_size fIconSize; 82 int32 fTimeout; 83 infoview_layout fLayout; 84 85 appfilter_t fAppFilters; 86 }; 87 88 extern property_info main_prop_list[]; 89 90 #endif // _NOTIFICATION_WINDOW_H 91