ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Data Structures | Functions | Variables
Notification.h File Reference
#include <ObjectivelyMVC/Types.h>

Go to the source code of this file.

Data Structures

struct  Notification
 The Notification type. More...
 

Functions

OBJECTIVELYMVC_EXPORT void MVC_PostNotification (const Notification *notification)
 Posts the Notification to all ViewControllers in the current window. More...
 

Variables

OBJECTIVELYMVC_EXPORT Uint32 MVC_NOTIFICATION_EVENT
 The custom event type for notifications. More...
 

Function Documentation

◆ MVC_PostNotification()

OBJECTIVELYMVC_EXPORT void MVC_PostNotification ( const Notification notification)

Posts the Notification to all ViewControllers in the current window.

Parameters
notificationThe Notification.
See also
ViewController::handleNotification

Definition at line 32 of file Notification.c.

32 {
33 static Once once;
34
35 do_once(&once, {
36 MVC_NOTIFICATION_EVENT = SDL_RegisterEvents(1);
37 assert(MVC_NOTIFICATION_EVENT != (Uint32) -1);
38 });
39
40 assert(notification);
41
42 SDL_PushEvent(&(SDL_Event) {
43 .user.type = MVC_NOTIFICATION_EVENT,
44 .user.code = notification->name,
45 .user.data1 = notification->sender,
46 .user.data2 = notification->data
47 });
48}
Uint32 MVC_NOTIFICATION_EVENT
Definition: Notification.c:30
int name
The notification name.
Definition: Notification.h:39
ident data
The data.
Definition: Notification.h:49
ident sender
The sender.
Definition: Notification.h:44

Variable Documentation

◆ MVC_NOTIFICATION_EVENT

OBJECTIVELYMVC_EXPORT Uint32 MVC_NOTIFICATION_EVENT

The custom event type for notifications.

Definition at line 55 of file Notification.h.