/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
1
#ifndef __H_CALLBACK__
2
#define __H_CALLBACK__
3
4
#include "baseobject.h"
5
#include "defs.h"
6
#include "Func.h"
7
8
BEGIN_DECLS
9
10
/**
11
 * @file
12
 * @defgroup SCallback SCallback
13
 * @addtogroup SCallback
14
 * @{
15
 * Callbacks are used to signals one part of the a program to an other.
16
 * It is manly used in SObject s and its children.
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
17
 *
18
 * Please note that this is the best way to implement an "interface".
19
 *
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
20
 * @sa GlobalNotify
21
 */
22
23
/**
24
 * An SCallbackEntry is used for convinience when installing callbacks into
25
 * SObjects. It may also be used in 
26
 */
27
typedef struct SCallbackEntry SCallbackEntry;
28
29
/**
30
 * The types for callbacks.
31
 */
32
typedef enum {
33
  S_CALLBACK_NULL,
34
  S_CALLBACK_CALLBACK,
35
  S_CALLBACK_NOTIFY,
36
  S_CALLBACK_NOTIFY_CHANGE
37
} SCallbackType;
38
39
/**
40
 * A list containing the names of the callback types.
41
 */
42
static char * SCallbackTypeNames[] __attribute__((unused)) = {
43
  "NULL",
44
  "CALLBACK",
45
  "NOTIFY",
46
  "NOTIFY_CHANGE",
47
  0x0,
48
  0x0,
49
};
50
51
52
struct SCallbackEntry {
53
  char * name; /**< The name that is used to invoke the callback. */
54
  SCallbackType type; /**< The type of the callback, is it a standard callback
55
                       * or a notify? */
56
  Callback callback; /**< The callback that will be invoked.*/
57
};
58
59
60
61
/**
62
 * @}
63
 * @addtogroup SObject
64
 * @{
65
 */
66
67
/**
68
 * Installs an array of callcackentries into an SObject.
69
 * 
70
 * @param obj The object to install the callback entries into.
71
 * @param callbackentries an array containing the callback entries.
72
 */
73
void s_object_install_callbacks (SObject * obj, SCallbackEntry ** callcackentries);
74
75
/**
76
 * Installs a singel callback into an SObject.
77
 *
78
 * @param obj The object to install the callback into.
79
 * @param callbackentry The callback entry to install.
80
 */
81
void s_object_install_callback (SObject * obj, SCallbackEntry * callbackentry);
82
47 by Gustav Hartvigsson
* Added a few skeletal functions to Callback.h
83
/**
84
 * 
85
 */
86
spointer s_object_notify (SObject * self, char * name, spointer * data);
87
88
/**
89
 * Alias to s_object_notify()
90
 */
91
#define s_object_call(o, n, d) s_object_notify (o, n, d)
92
44 by Gustav Hartvigsson
* Started to structuce the dectumentation a little better.
93
/**@}*/
94
95
END_DECLS
96
97
#endif