Notification.h revision 8856b518
1/*
2 * Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _NOTIFICATION_H
6#define _NOTIFICATION_H
7
8
9#include <Archivable.h>
10#include <Entry.h>
11#include <List.h>
12#include <String.h>
13
14
15// notification types
16enum notification_type {
17	B_INFORMATION_NOTIFICATION,
18	B_IMPORTANT_NOTIFICATION,
19	B_ERROR_NOTIFICATION,
20	B_PROGRESS_NOTIFICATION
21};
22
23class BBitmap;
24
25
26class BNotification : public BArchivable {
27public:
28								BNotification(notification_type type);
29								BNotification(BMessage* archive);
30	virtual						~BNotification();
31
32			status_t			InitCheck() const;
33
34	static	BArchivable*		Instantiate(BMessage* archive);
35	virtual	status_t			Archive(BMessage* archive, bool deep = true) const;
36
37			const char*			SourceSignature() const;
38			const char*			SourceName() const;
39
40			notification_type	Type() const;
41
42			const char*			Group() const;
43			void				SetGroup(const BString& group);
44
45			const char*			Title() const;
46			void				SetTitle(const BString& title);
47
48			const char*			Content() const;
49			void				SetContent(const BString& content);
50
51			const char*			MessageID() const;
52			void				SetMessageID(const BString& id);
53
54			float				Progress() const;
55			void				SetProgress(float progress);
56
57			const char*			OnClickApp() const;
58			void				SetOnClickApp(const BString& app);
59
60			const entry_ref*	OnClickFile() const;
61			status_t			SetOnClickFile(const entry_ref* file);
62
63			status_t			AddOnClickRef(const entry_ref* ref);
64			int32				CountOnClickRefs() const;
65			const entry_ref*	OnClickRefAt(int32 index) const;
66
67			status_t			AddOnClickArg(const BString& arg);
68			int32				CountOnClickArgs() const;
69			const char*			OnClickArgAt(int32 index) const;
70
71			const BBitmap*		Icon() const;
72			status_t			SetIcon(const BBitmap* icon);
73
74			status_t			Send(bigtime_t timeout = -1);
75
76private:
77	virtual	void _ReservedNotification1();
78	virtual	void _ReservedNotification2();
79	virtual	void _ReservedNotification3();
80	virtual	void _ReservedNotification4();
81	virtual	void _ReservedNotification5();
82	virtual	void _ReservedNotification6();
83	virtual	void _ReservedNotification7();
84	virtual	void _ReservedNotification8();
85
86			status_t			fInitStatus;
87
88			BString				fSourceSignature;
89			BString				fSourceName;
90			notification_type	fType;
91			BString				fGroup;
92			BString				fTitle;
93			BString				fContent;
94			BString				fID;
95			float				fProgress;
96
97			BString				fApp;
98			entry_ref*			fFile;
99			BList				fRefs;
100			BList				fArgv;
101			BBitmap*			fBitmap;
102
103			uint32				_reserved[8];
104};
105
106
107#endif	// _NOTIFICATION_H
108