xref: /haiku/src/servers/notification/NotificationWindow.h (revision f2b4344867e97c3f4e742a1b4a15e6879644601a)
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 
30 typedef std::map<BString, AppGroupView*> appview_t;
31 typedef std::map<BString, AppUsage*> appfilter_t;
32 typedef std::vector<NotificationView*> views_t;
33 
34 extern const float kEdgePadding;
35 extern const float kSmallPadding;
36 extern const float kCloseSize;
37 extern const float kExpandSize;
38 extern const float kPenSize;
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					_ResizeAll();
56 
57 private:
58 	friend class AppGroupView;
59 
60 			void					SetPosition();
61 			void					_LoadSettings(bool startMonitor = false);
62 			void					_LoadAppFilters(bool startMonitor = false);
63 			void					_SaveAppFilters();
64 			void					_LoadGeneralSettings(bool startMonitor);
65 			void					_LoadDisplaySettings(bool startMonitor);
66 
67 			views_t					fViews;
68 			appview_t				fAppViews;
69 
70 			BString					fStatusText;
71 			BString					fMessageText;
72 
73 			float					fWidth;
74 			icon_size				fIconSize;
75 			int32					fTimeout;
76 
77 			appfilter_t				fAppFilters;
78 };
79 
80 extern property_info main_prop_list[];
81 
82 #endif	// _NOTIFICATION_WINDOW_H
83