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 <AppFileInfo.h> 16 #include <String.h> 17 #include <Window.h> 18 19 #include "NotificationView.h" 20 21 22 class AppGroupView; 23 class AppUsage; 24 25 struct property_info; 26 27 typedef std::map<BString, AppGroupView*> appview_t; 28 typedef std::map<BString, AppUsage*> appfilter_t; 29 typedef std::vector<NotificationView*> views_t; 30 31 extern const float kEdgePadding; 32 extern const float kSmallPadding; 33 extern const float kCloseSize; 34 extern const float kExpandSize; 35 extern const float kPenSize; 36 37 const uint32 kRemoveGroupView = 'RGVi'; 38 39 40 class NotificationWindow : public BWindow { 41 public: 42 NotificationWindow(); 43 virtual ~NotificationWindow(); 44 45 virtual bool QuitRequested(); 46 virtual void MessageReceived(BMessage*); 47 virtual void WorkspaceActivated(int32, bool); 48 virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, 49 int32, const char*); 50 51 icon_size IconSize(); 52 int32 Timeout(); 53 float Width(); 54 55 void _ShowHide(); 56 57 private: 58 friend class AppGroupView; 59 60 void NotificationViewSwapped( 61 NotificationView* stale, 62 NotificationView* fresh); 63 64 void SetPosition(); 65 void _LoadSettings(bool startMonitor = false); 66 void _LoadAppFilters(bool startMonitor = false); 67 void _SaveAppFilters(); 68 void _LoadGeneralSettings(bool startMonitor); 69 void _LoadDisplaySettings(bool startMonitor); 70 71 views_t fViews; 72 appview_t fAppViews; 73 74 BString fStatusText; 75 BString fMessageText; 76 77 float fWidth; 78 icon_size fIconSize; 79 int32 fTimeout; 80 81 appfilter_t fAppFilters; 82 }; 83 84 extern property_info main_prop_list[]; 85 86 #endif // _NOTIFICATION_WINDOW_H 87