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 void FrameResized(float width, float height); 49 virtual void ScreenChanged(BRect frame, color_space mode); 50 virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, 51 int32, const char*); 52 53 icon_size IconSize(); 54 int32 Timeout(); 55 float Width(); 56 57 void _ShowHide(); 58 59 private: 60 friend class AppGroupView; 61 62 void NotificationViewSwapped( 63 NotificationView* stale, 64 NotificationView* fresh); 65 66 void SetPosition(); 67 void _LoadSettings(bool startMonitor = false); 68 void _LoadAppFilters(BMessage& settings); 69 void _LoadGeneralSettings(BMessage& settings); 70 void _LoadDisplaySettings(BMessage& settings); 71 72 views_t fViews; 73 appview_t fAppViews; 74 75 BString fStatusText; 76 BString fMessageText; 77 78 float fWidth; 79 icon_size fIconSize; 80 int32 fTimeout; 81 82 appfilter_t fAppFilters; 83 }; 84 85 extern property_info main_prop_list[]; 86 87 #endif // _NOTIFICATION_WINDOW_H 88