xref: /haiku/src/servers/notification/NotificationWindow.h (revision 579f1dbca962a2a03df54f69fdc6e9423f91f20e)
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	BHandler*				ResolveSpecifier(BMessage*, int32, BMessage*,
50 										int32, const char*);
51 
52 			icon_size				IconSize();
53 			int32					Timeout();
54 			float					Width();
55 
56 			void					_ShowHide();
57 
58 private:
59 	friend class AppGroupView;
60 
61 			void					NotificationViewSwapped(
62 										NotificationView* stale,
63 										NotificationView* fresh);
64 
65 			void					SetPosition();
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 			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