xref: /haiku/src/servers/notification/NotificationWindow.h (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
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 			void					Show();
56 
57 			icon_size				IconSize();
58 			int32					Timeout();
59 			infoview_layout 		Layout();
60 			float					ViewWidth();
61 
62 			void					ResizeAll();
63 
64 private:
65 	friend class AppGroupView;
66 
67 			void					SetPosition();
68 			void					PopupAnimation();
69 			void					LoadSettings(bool startMonitor = false);
70 			void					LoadAppFilters(bool startMonitor = false);
71 			void					SaveAppFilters();
72 			void					_LoadGeneralSettings(bool startMonitor);
73 			void					_LoadDisplaySettings(bool startMonitor);
74 
75 			views_t					fViews;
76 			BorderView*				fBorder;
77 
78 			appview_t				fAppViews;
79 
80 			BString					fStatusText;
81 			BString					fMessageText;
82 
83 			float					fWidth;
84 			icon_size				fIconSize;
85 			int32					fTimeout;
86 			infoview_layout			fLayout;
87 
88 			appfilter_t				fAppFilters;
89 };
90 
91 extern property_info main_prop_list[];
92 
93 #endif	// _NOTIFICATION_WINDOW_H
94