1 /* 2 * Copyright 2010, 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 16 enum notification_type { 17 B_INFORMATION_NOTIFICATION, 18 B_IMPORTANT_NOTIFICATION, 19 B_ERROR_NOTIFICATION, 20 B_PROGRESS_NOTIFICATION 21 }; 22 23 class BBitmap; 24 25 26 class BNotification : public BArchivable { 27 public: 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 notification_type Type() const; 38 39 const char* Group() const; 40 void SetGroup(const BString& group); 41 42 const char* Title() const; 43 void SetTitle(const BString& title); 44 45 const char* Content() const; 46 void SetContent(const BString& content); 47 48 const char* MessageID() const; 49 void SetMessageID(const BString& id); 50 51 float Progress() const; 52 void SetProgress(float progress); 53 54 const char* OnClickApp() const; 55 void SetOnClickApp(const BString& app); 56 57 const entry_ref* OnClickFile() const; 58 status_t SetOnClickFile(const entry_ref* file); 59 60 status_t AddOnClickRef(const entry_ref* ref); 61 int32 CountOnClickRefs() const; 62 const entry_ref* OnClickRefAt(int32 index) const; 63 64 status_t AddOnClickArg(const BString& arg); 65 int32 CountOnClickArgs() const; 66 const char* OnClickArgAt(int32 index) const; 67 68 const BBitmap* Icon() const; 69 status_t SetIcon(const BBitmap* icon); 70 71 status_t Send(bigtime_t timeout = -1); 72 73 private: 74 status_t fInitStatus; 75 76 notification_type fType; 77 BString fGroup; 78 BString fTitle; 79 BString fContent; 80 BString fID; 81 float fProgress; 82 83 BString fApp; 84 entry_ref* fFile; 85 BList fRefs; 86 BList fArgv; 87 BBitmap* fBitmap; 88 }; 89 90 91 #endif // _NOTIFICATION_H 92