NvDialog 0.10.1
A cross-platform modal dialogs library for C/C++ that uses the native OS theme.
Loading...
Searching...
No Matches
nvdialog_notification.h File Reference

Go to the source code of this file.

Macros

#define __nvdialog_notification_h__   1

Typedefs

typedef struct _NvdNotification NvdNotification
 The base notification type used by NvDialog.

Enumerations

enum  NvdNotifyType { NVD_NOTIFICATION_SIMPLE , NVD_NOTIFICATION_WARNING , NVD_NOTIFICATION_ERROR }
 Possible types of NvDialog notifications. Each field will create a slightly different dialog matching the requested type. More...

Functions

NVD_API NvdNotificationnvd_notification_new (const char *title, const char *msg, NvdNotifyType type)
 Creates a new notification object and returns it.
NVD_API void nvd_send_notification (NvdNotification *notification)
 Sends the notification to the system. It's safe to assume that the same notification can be sent multiple times. Just make sure the notification is still valid (Not freed yet).
NVD_API void nvd_delete_notification (NvdNotification *notification)
 Deletes a notification object from NvDialog.
NVD_API void nvd_add_notification_action (NvdNotification *notification, const char *action, int value_to_set, int *value_to_return)
 Adds another button with a specified action to do when it is clicked.

Macro Definition Documentation

◆ __nvdialog_notification_h__

#define __nvdialog_notification_h__   1

Typedef Documentation

◆ NvdNotification

typedef struct _NvdNotification NvdNotification

The base notification type used by NvDialog.

NvDialog offers since v0.5.0 support for basic notifications that add an extra cross-platform solution. The notification API is cross-platform and should reduce the required setup to send a simple notification. On GNU/Linux and other Unix-like platforms, the DBus interface for notifications is used, making it desktop-agnostic and only requiring libdbus and related daemons to be available.

See also
nvd_notification_new
Since
v0.5.0

Enumeration Type Documentation

◆ NvdNotifyType

Possible types of NvDialog notifications. Each field will create a slightly different dialog matching the requested type.

Note
Some systems may not provide compatible icons "out-of-the-box", usually minimalist Linux distros.
Since
v0.5.0
See also
NvdNotification
Enumerator
NVD_NOTIFICATION_SIMPLE 

A simple notification eg. to notify of something new in the app.

NVD_NOTIFICATION_WARNING 

A warning notification.

NVD_NOTIFICATION_ERROR 

An error notification, preferably used before crashing.

Function Documentation

◆ nvd_add_notification_action()

NVD_API void nvd_add_notification_action ( NvdNotification * notification,
const char * action,
int value_to_set,
int * value_to_return )

Adds another button with a specified action to do when it is clicked.

Deprecated
This function no longer works since v0.10.0. It was only limited to some platforms before so it has become a no-op.
Parameters
notificationThe notification to add the said action to.
actionA string defining the action as well as the label of the button for the action.
value_to_setThe value to set when the action is triggered.
value_to_returnA pointer to an integer to save the value passed to value_to_set .

◆ nvd_delete_notification()

NVD_API void nvd_delete_notification ( NvdNotification * notification)

Deletes a notification object from NvDialog.

Note
You should only use this to free notifications. Do not use nvd_free_object please.
Parameters
notificationThe notification object to delete.

◆ nvd_notification_new()

NVD_API NvdNotification * nvd_notification_new ( const char * title,
const char * msg,
NvdNotifyType type )

Creates a new notification object and returns it.

Parameters
titleThe title of the notification, can be NULL if no title is desired.
msgThe message to show (Required, can't be NULL).
typeThe type of the notification, see NvdNotifyType. Example:
#include <nvdialog/nvdialog.h>
int main(int argc, char** argv) {
nvd_init(argv[0]);
NvdNotification *notif = nvd_notification_new("Notification",
"A notification for your
app.", NVD_NOTIFICATION_SIMPLE); if (!notif) return -1;
return 0;
}
NVD_API int nvd_init()
Initializes NvDialog.
struct _NvdNotification NvdNotification
The base notification type used by NvDialog.
Definition nvdialog_notification.h:61
NVD_API void nvd_delete_notification(NvdNotification *notification)
Deletes a notification object from NvDialog.
@ NVD_NOTIFICATION_SIMPLE
Definition nvdialog_notification.h:41
NVD_API NvdNotification * nvd_notification_new(const char *title, const char *msg, NvdNotifyType type)
Creates a new notification object and returns it.
NVD_API void nvd_send_notification(NvdNotification *notification)
Sends the notification to the system. It's safe to assume that the same notification can be sent mult...
Returns
An empty notification object.

◆ nvd_send_notification()

NVD_API void nvd_send_notification ( NvdNotification * notification)

Sends the notification to the system. It's safe to assume that the same notification can be sent multiple times. Just make sure the notification is still valid (Not freed yet).

Parameters
notificationThe notification object to use.
Since
v0.5.0