xref: /haiku/headers/os/app/Notification.h (revision 8856b51897defc5d5766f4453af8b3122ca4e112)
1de9dcd41SStephan Aßmus /*
26aa05872SBrian Hill  * Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
3de9dcd41SStephan Aßmus  * Distributed under the terms of the MIT License.
4de9dcd41SStephan Aßmus  */
5de9dcd41SStephan Aßmus #ifndef _NOTIFICATION_H
6de9dcd41SStephan Aßmus #define _NOTIFICATION_H
7de9dcd41SStephan Aßmus 
80cf96104SAxel Dörfler 
94ec6c3a0SAdrien Destugues #include <Archivable.h>
10de9dcd41SStephan Aßmus #include <Entry.h>
11f33637d9SStephan Aßmus #include <List.h>
12f33637d9SStephan Aßmus #include <String.h>
130cf96104SAxel Dörfler 
140cf96104SAxel Dörfler 
15de9dcd41SStephan Aßmus // notification types
16de9dcd41SStephan Aßmus enum notification_type {
17de9dcd41SStephan Aßmus 	B_INFORMATION_NOTIFICATION,
18de9dcd41SStephan Aßmus 	B_IMPORTANT_NOTIFICATION,
19de9dcd41SStephan Aßmus 	B_ERROR_NOTIFICATION,
20de9dcd41SStephan Aßmus 	B_PROGRESS_NOTIFICATION
21de9dcd41SStephan Aßmus };
22de9dcd41SStephan Aßmus 
23f33637d9SStephan Aßmus class BBitmap;
24f33637d9SStephan Aßmus 
25de9dcd41SStephan Aßmus 
264ec6c3a0SAdrien Destugues class BNotification : public BArchivable {
27de9dcd41SStephan Aßmus public:
28de9dcd41SStephan Aßmus 								BNotification(notification_type type);
294ec6c3a0SAdrien Destugues 								BNotification(BMessage* archive);
304ec6c3a0SAdrien Destugues 	virtual						~BNotification();
314ec6c3a0SAdrien Destugues 
324ec6c3a0SAdrien Destugues 			status_t			InitCheck() const;
334ec6c3a0SAdrien Destugues 
344ec6c3a0SAdrien Destugues 	static	BArchivable*		Instantiate(BMessage* archive);
354ec6c3a0SAdrien Destugues 	virtual	status_t			Archive(BMessage* archive, bool deep = true) const;
36de9dcd41SStephan Aßmus 
376aa05872SBrian Hill 			const char*			SourceSignature() const;
386aa05872SBrian Hill 			const char*			SourceName() const;
396aa05872SBrian Hill 
40de9dcd41SStephan Aßmus 			notification_type	Type() const;
41de9dcd41SStephan Aßmus 
424ec6c3a0SAdrien Destugues 			const char*			Group() const;
434ec6c3a0SAdrien Destugues 			void				SetGroup(const BString& group);
44de9dcd41SStephan Aßmus 
45de9dcd41SStephan Aßmus 			const char*			Title() const;
46908967a1SStephan Aßmus 			void				SetTitle(const BString& title);
47de9dcd41SStephan Aßmus 
48de9dcd41SStephan Aßmus 			const char*			Content() const;
49908967a1SStephan Aßmus 			void				SetContent(const BString& content);
50de9dcd41SStephan Aßmus 
51de9dcd41SStephan Aßmus 			const char*			MessageID() const;
52908967a1SStephan Aßmus 			void				SetMessageID(const BString& id);
53de9dcd41SStephan Aßmus 
54de9dcd41SStephan Aßmus 			float				Progress() const;
55de9dcd41SStephan Aßmus 			void				SetProgress(float progress);
56de9dcd41SStephan Aßmus 
57de9dcd41SStephan Aßmus 			const char*			OnClickApp() const;
58908967a1SStephan Aßmus 			void				SetOnClickApp(const BString& app);
59de9dcd41SStephan Aßmus 
60f33637d9SStephan Aßmus 			const entry_ref*	OnClickFile() const;
61f33637d9SStephan Aßmus 			status_t			SetOnClickFile(const entry_ref* file);
62de9dcd41SStephan Aßmus 
63f33637d9SStephan Aßmus 			status_t			AddOnClickRef(const entry_ref* ref);
64f33637d9SStephan Aßmus 			int32				CountOnClickRefs() const;
65f33637d9SStephan Aßmus 			const entry_ref*	OnClickRefAt(int32 index) const;
66de9dcd41SStephan Aßmus 
67908967a1SStephan Aßmus 			status_t			AddOnClickArg(const BString& arg);
68f33637d9SStephan Aßmus 			int32				CountOnClickArgs() const;
69f33637d9SStephan Aßmus 			const char*			OnClickArgAt(int32 index) const;
70de9dcd41SStephan Aßmus 
71f33637d9SStephan Aßmus 			const BBitmap*		Icon() const;
72f33637d9SStephan Aßmus 			status_t			SetIcon(const BBitmap* icon);
73de9dcd41SStephan Aßmus 
744ec6c3a0SAdrien Destugues 			status_t			Send(bigtime_t timeout = -1);
754ec6c3a0SAdrien Destugues 
76de9dcd41SStephan Aßmus private:
77*8856b518SBrian Hill 	virtual	void _ReservedNotification1();
78*8856b518SBrian Hill 	virtual	void _ReservedNotification2();
79*8856b518SBrian Hill 	virtual	void _ReservedNotification3();
80*8856b518SBrian Hill 	virtual	void _ReservedNotification4();
81*8856b518SBrian Hill 	virtual	void _ReservedNotification5();
82*8856b518SBrian Hill 	virtual	void _ReservedNotification6();
83*8856b518SBrian Hill 	virtual	void _ReservedNotification7();
84*8856b518SBrian Hill 	virtual	void _ReservedNotification8();
85*8856b518SBrian Hill 
864ec6c3a0SAdrien Destugues 			status_t			fInitStatus;
874ec6c3a0SAdrien Destugues 
886aa05872SBrian Hill 			BString				fSourceSignature;
896aa05872SBrian Hill 			BString				fSourceName;
90de9dcd41SStephan Aßmus 			notification_type	fType;
914ec6c3a0SAdrien Destugues 			BString				fGroup;
92f33637d9SStephan Aßmus 			BString				fTitle;
93f33637d9SStephan Aßmus 			BString				fContent;
94f33637d9SStephan Aßmus 			BString				fID;
95de9dcd41SStephan Aßmus 			float				fProgress;
96f33637d9SStephan Aßmus 
97f33637d9SStephan Aßmus 			BString				fApp;
98de9dcd41SStephan Aßmus 			entry_ref*			fFile;
99f33637d9SStephan Aßmus 			BList				fRefs;
100f33637d9SStephan Aßmus 			BList				fArgv;
101de9dcd41SStephan Aßmus 			BBitmap*			fBitmap;
102*8856b518SBrian Hill 
103*8856b518SBrian Hill 			uint32				_reserved[8];
104de9dcd41SStephan Aßmus };
105de9dcd41SStephan Aßmus 
1060cf96104SAxel Dörfler 
107de9dcd41SStephan Aßmus #endif	// _NOTIFICATION_H
108