ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Action.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for OpenGL, SDL2 and GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
26#include <Objectively/Object.h>
27
29
35typedef struct Action Action;
36typedef struct ActionInterface ActionInterface;
37
38typedef struct Control Control;
39
43typedef void (*ActionFunction)(Control *control, const SDL_Event *event, ident sender, ident data);
44
50struct Action {
51
55 Object object;
56
61 ActionInterface *interface;
62
66 ident data;
67
71 SDL_EventType eventType;
72
77
81 ident sender;
82};
83
87struct ActionInterface {
88
92 ObjectInterface objectInterface;
93
105 Action *(*initWithEventType)(Action *self, SDL_EventType eventType, ActionFunction function, ident sender, ident data);
106};
107
114OBJECTIVELYMVC_EXPORT Class *_Action(void);
void(* ActionFunction)(Control *control, const SDL_Event *event, ident sender, ident data)
The ActionFunction callback.
Definition: Action.h:43
ObjectivelyMVC base types.
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
Actions bind event-driven behavior to Controls.
Definition: Action.h:50
Class * _Action(void)
The Action archetype.
Definition: Action.c:67
SDL_EventType eventType
The event type.
Definition: Action.h:71
ActionInterface * interface
The interface.
Definition: Action.h:61
ident data
The user data.
Definition: Action.h:66
ActionFunction function
The function.
Definition: Action.h:76
Object object
The superclass.
Definition: Action.h:55
ident sender
The sender.
Definition: Action.h:81
Controls are Views which capture events and dispatch Actions.
Definition: Control.h:83