Files
haiku-beta6/headers/os/app/Notification.h
T
Brian Hill 6aa0587222 Notifications preflet and notification_server
Notifications preflet:
-Use sliders instead of text fields for width and timeout
-Remove icon size choice (mini icon looks horrible)
-Consolidate both "Enable" checkboxes into one
-Fix Revert button, remove Apply button, add Defaults button
-All changes to settings saved immediately
-Live example notification message shown when settings changes are made
-Add setting for individual apps to specify whether their notifications
	should be muted
-Remove history list (to be implemented later)

BNotification class:
-BNotification records the signature and name of application that
	created it
-New functions to get source application signature and name

Notification Server:
-Notification pop up view layout fixes and bold font size fix
-Remove notifications history from AppUsage class (will be saved in
	cache instead)
-Remove vector of NotificationView objects which isn't needed
-Get source application info from notification object, not the received
	message which is not reliable
2017-09-23 11:41:33 -04:00

97 lines
2.2 KiB
C++

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