2010-05-27 18:48:27 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _NOTIFICATION_H
|
|
|
|
#define _NOTIFICATION_H
|
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
|
2011-11-02 18:57:43 +04:00
|
|
|
#include <Archivable.h>
|
2010-05-27 18:48:27 +04:00
|
|
|
#include <Entry.h>
|
2010-05-27 21:50:12 +04:00
|
|
|
#include <List.h>
|
|
|
|
#include <String.h>
|
2010-05-27 19:53:35 +04:00
|
|
|
|
|
|
|
|
2010-05-27 18:48:27 +04:00
|
|
|
// notification types
|
|
|
|
enum notification_type {
|
|
|
|
B_INFORMATION_NOTIFICATION,
|
|
|
|
B_IMPORTANT_NOTIFICATION,
|
|
|
|
B_ERROR_NOTIFICATION,
|
|
|
|
B_PROGRESS_NOTIFICATION
|
|
|
|
};
|
|
|
|
|
2010-05-27 21:50:12 +04:00
|
|
|
class BBitmap;
|
|
|
|
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2011-11-02 18:57:43 +04:00
|
|
|
class BNotification : public BArchivable {
|
2010-05-27 18:48:27 +04:00
|
|
|
public:
|
2010-05-27 19:53:35 +04:00
|
|
|
BNotification(notification_type type);
|
2011-11-02 18:57:43 +04:00
|
|
|
BNotification(BMessage* archive);
|
|
|
|
virtual ~BNotification();
|
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
|
|
|
virtual status_t Archive(BMessage* archive, bool deep = true) const;
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
notification_type Type() const;
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2011-11-02 18:57:43 +04:00
|
|
|
const char* Group() const;
|
|
|
|
void SetGroup(const BString& group);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
const char* Title() const;
|
2010-05-28 01:13:11 +04:00
|
|
|
void SetTitle(const BString& title);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
const char* Content() const;
|
2010-05-28 01:13:11 +04:00
|
|
|
void SetContent(const BString& content);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
const char* MessageID() const;
|
2010-05-28 01:13:11 +04:00
|
|
|
void SetMessageID(const BString& id);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
float Progress() const;
|
|
|
|
void SetProgress(float progress);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
const char* OnClickApp() const;
|
2010-05-28 01:13:11 +04:00
|
|
|
void SetOnClickApp(const BString& app);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 21:50:12 +04:00
|
|
|
const entry_ref* OnClickFile() const;
|
|
|
|
status_t SetOnClickFile(const entry_ref* file);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 21:50:12 +04:00
|
|
|
status_t AddOnClickRef(const entry_ref* ref);
|
|
|
|
int32 CountOnClickRefs() const;
|
|
|
|
const entry_ref* OnClickRefAt(int32 index) const;
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-28 01:13:11 +04:00
|
|
|
status_t AddOnClickArg(const BString& arg);
|
2010-05-27 21:50:12 +04:00
|
|
|
int32 CountOnClickArgs() const;
|
|
|
|
const char* OnClickArgAt(int32 index) const;
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2010-05-27 21:50:12 +04:00
|
|
|
const BBitmap* Icon() const;
|
|
|
|
status_t SetIcon(const BBitmap* icon);
|
2010-05-27 18:48:27 +04:00
|
|
|
|
2011-11-02 18:57:43 +04:00
|
|
|
status_t Send(bigtime_t timeout = -1);
|
|
|
|
|
2010-05-27 18:48:27 +04:00
|
|
|
private:
|
2011-11-02 18:57:43 +04:00
|
|
|
status_t fInitStatus;
|
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
notification_type fType;
|
2011-11-02 18:57:43 +04:00
|
|
|
BString fGroup;
|
2010-05-27 21:50:12 +04:00
|
|
|
BString fTitle;
|
|
|
|
BString fContent;
|
|
|
|
BString fID;
|
2010-05-27 19:53:35 +04:00
|
|
|
float fProgress;
|
2010-05-27 21:50:12 +04:00
|
|
|
|
|
|
|
BString fApp;
|
2010-05-27 19:53:35 +04:00
|
|
|
entry_ref* fFile;
|
2010-05-27 21:50:12 +04:00
|
|
|
BList fRefs;
|
|
|
|
BList fArgv;
|
2010-05-27 19:53:35 +04:00
|
|
|
BBitmap* fBitmap;
|
2010-05-27 18:48:27 +04:00
|
|
|
};
|
|
|
|
|
2010-05-27 19:53:35 +04:00
|
|
|
|
2010-05-27 18:48:27 +04:00
|
|
|
#endif // _NOTIFICATION_H
|