~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/extra/gtk2/glib/gmain.inc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
{$ifndef __G_MAIN_H__}
 
3
{$define __G_MAIN_H__}
 
4
 
 
5
//{$include gslist.inc}
 
6
//{$include gthread.inc}
 
7
 
 
8
  type
 
9
    PGMainContext = pointer;
 
10
    PGMainLoop    = pointer;
 
11
 
 
12
    PGSourceFunc = ^TGSourceFunc;
 
13
    TGSourceFunc = function (data:gpointer):gboolean;cdecl;
 
14
 
 
15
    {< private > }
 
16
    PGSourceCallbackFuncs = ^TGSourceCallbackFuncs;
 
17
 
 
18
    PGSource = ^TGSource;
 
19
    PGSourceFuncs = ^TGSourceFuncs;
 
20
 
 
21
    TGSource = record
 
22
            callback_data  : gpointer;
 
23
            callback_funcs : PGSourceCallbackFuncs;
 
24
            source_funcs   : PGSourceFuncs;
 
25
            ref_count      : guint;
 
26
            context        : PGMainContext;
 
27
            priority       : gint;
 
28
            flags          : guint;
 
29
            source_id      : guint;
 
30
            poll_fds       : PGSList;
 
31
            prev           : PGSource;
 
32
            next           : PGSource;
 
33
            reserved1      : gpointer;
 
34
            reserved2      : gpointer;
 
35
         end;
 
36
 
 
37
    TGSourceCallbackFuncs = record
 
38
            ref   : procedure (cb_data:gpointer); cdecl;
 
39
            unref : procedure (cb_data:gpointer); cdecl;
 
40
            get   : procedure (cb_data:gpointer; source:PGSource; func:PGSourceFunc; data:Pgpointer); cdecl;
 
41
         end;
 
42
 
 
43
    TGSourceDummyMarshal = procedure {no parameters} ;cdecl;
 
44
    { Can be NULL  }
 
45
    { For use by g_source_set_closure  }
 
46
    { Really is of type GClosureMarshal  }
 
47
 
 
48
    TGSourceFuncs = record
 
49
            prepare  : function  (source:PGSource; timeout:gint):gboolean; cdecl;
 
50
            check    : function  (source:PGSource):gboolean; cdecl;
 
51
            dispatch : function  (source:PGSource; callback:TGSourceFunc; user_data:gpointer):gboolean; cdecl;
 
52
            finalize : procedure (source:PGSource); cdecl;
 
53
            closure_callback : TGSourceFunc;
 
54
            closure_marshal  : TGSourceDummyMarshal;
 
55
         end;
 
56
 
 
57
    { Any definitions using GPollFD or GPollFunc are primarily
 
58
       for Unix and not guaranteed to be the compatible on all
 
59
       operating systems on which GLib runs. Right now, the
 
60
       GLib does use these functions on Win32 as well, but interprets
 
61
       them in a fairly different way than on Unix. If you use
 
62
       these definitions, you are should be prepared to recode
 
63
       for different operating systems.
 
64
 
 
65
 
 
66
       On Win32, the fd in a GPollFD should be Win32 HANDLE ( not  a file
 
67
       descriptor as provided by the C runtime) that can be used by
 
68
       MsgWaitForMultipleObjects. This does  not  include file handles
 
69
       from CreateFile, SOCKETs, nor pipe handles. (But you can use
 
70
       WSAEventSelect to signal events when a SOCKET is readable).
 
71
 
 
72
       On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to
 
73
       indicate polling for messages. These message queue GPollFDs should
 
74
       be added with the g_main_poll_win32_msg_add function.
 
75
 
 
76
       But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK
 
77
       (GTK) programs, as GDK itself wants to read messages and convert them
 
78
       to GDK events.
 
79
 
 
80
       So, unless you really know what you are doing, it's best not to try
 
81
       to use the main loop polling stuff for your own needs on
 
82
       Win32. It's really only written for the GIMP's needs so
 
83
       far.
 
84
      }
 
85
 
 
86
       PGPollFD = ^TGPollFD;
 
87
       TGPollFD = record
 
88
            fd      : gint;
 
89
            events  : gushort;
 
90
            revents : gushort;
 
91
         end;
 
92
 
 
93
       TGPollFunc = function (ufds:PGPollFD; nfsd:guint; timeout:gint):gint;cdecl;
 
94
 
 
95
    { Standard priorities  }
 
96
 
 
97
    const
 
98
       G_PRIORITY_HIGH         = -(100);
 
99
       G_PRIORITY_DEFAULT      = 0;
 
100
       G_PRIORITY_HIGH_IDLE    = 100;
 
101
       G_PRIORITY_DEFAULT_IDLE = 200;
 
102
       G_PRIORITY_LOW          = 300;
 
103
    { GMainContext:  }
 
104
 
 
105
    function g_main_context_new:PGMainContext;cdecl;external gliblib name 'g_main_context_new';
 
106
 
 
107
    procedure g_main_context_ref(context:PGMainContext);cdecl;external gliblib name 'g_main_context_ref';
 
108
 
 
109
    procedure g_main_context_unref(context:PGMainContext);cdecl;external gliblib name 'g_main_context_unref';
 
110
 
 
111
    function g_main_context_default:PGMainContext;cdecl;external gliblib name 'g_main_context_default';
 
112
 
 
113
    function g_main_context_iteration(context:PGMainContext; may_block:gboolean):gboolean;cdecl;external gliblib name 'g_main_context_iteration';
 
114
 
 
115
    function g_main_context_pending(context:PGMainContext):gboolean;cdecl;external gliblib name 'g_main_context_pending';
 
116
 
 
117
    { For implementation of legacy interfaces
 
118
      }
 
119
    function g_main_context_find_source_by_id(context:PGMainContext; source_id:guint):PGSource;cdecl;external gliblib name 'g_main_context_find_source_by_id';
 
120
 
 
121
    function g_main_context_find_source_by_user_data(context:PGMainContext; user_data:gpointer):PGSource;cdecl;external gliblib name 'g_main_context_find_source_by_user_data';
 
122
 
 
123
    function g_main_context_find_source_by_funcs_user_data(context:PGMainContext; funcs:PGSourceFuncs; user_data:gpointer):PGSource;cdecl;external gliblib name 'g_main_context_find_source_by_funcs_user_data';
 
124
 
 
125
    { Low level functions for implementing custom main loops.
 
126
      }
 
127
    procedure g_main_context_wakeup(context:PGMainContext);cdecl;external gliblib name 'g_main_context_wakeup';
 
128
 
 
129
    function g_main_context_acquire(context:PGMainContext):gboolean;cdecl;external gliblib name 'g_main_context_acquire';
 
130
 
 
131
    procedure g_main_context_release(context:PGMainContext);cdecl;external gliblib name 'g_main_context_release';
 
132
 
 
133
    function g_main_context_wait(context:PGMainContext; cond:PGCond; mutex:PGMutex):gboolean;cdecl;external gliblib name 'g_main_context_wait';
 
134
 
 
135
    function g_main_context_prepare(context:PGMainContext; priority:Pgint):gboolean;cdecl;external gliblib name 'g_main_context_prepare';
 
136
 
 
137
    function g_main_context_query(context:PGMainContext; max_priority:gint; timeout:Pgint; fds:PGPollFD; n_fds:gint):gint;cdecl;external gliblib name 'g_main_context_query';
 
138
 
 
139
    function g_main_context_check(context:PGMainContext; max_priority:gint; fds:PGPollFD; n_fds:gint):gint;cdecl;external gliblib name 'g_main_context_check';
 
140
 
 
141
    procedure g_main_context_dispatch(context:PGMainContext);cdecl;external gliblib name 'g_main_context_dispatch';
 
142
 
 
143
    procedure g_main_context_set_poll_func(context:PGMainContext; func:TGPollFunc);cdecl;external gliblib name 'g_main_context_set_poll_func';
 
144
 
 
145
    function g_main_context_get_poll_func(context:PGMainContext):TGPollFunc;cdecl;external gliblib name 'g_main_context_get_poll_func';
 
146
 
 
147
    { Low level functions for use by source implementations
 
148
      }
 
149
    procedure g_main_context_add_poll(context:PGMainContext; fd:PGPollFD; priority:gint);cdecl;external gliblib name 'g_main_context_add_poll';
 
150
 
 
151
    procedure g_main_context_remove_poll(context:PGMainContext; fd:PGPollFD);cdecl;external gliblib name 'g_main_context_remove_poll';
 
152
 
 
153
    { GMainLoop:  }
 
154
    function g_main_loop_new(context:PGMainContext; is_running:gboolean):PGMainLoop;cdecl;external gliblib name 'g_main_loop_new';
 
155
 
 
156
    procedure g_main_loop_run(loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_run';
 
157
 
 
158
    procedure g_main_loop_quit(loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_quit';
 
159
 
 
160
    function g_main_loop_ref(loop:PGMainLoop):PGMainLoop;cdecl;external gliblib name 'g_main_loop_ref';
 
161
 
 
162
    procedure g_main_loop_unref(loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_unref';
 
163
 
 
164
    function g_main_loop_is_running(loop:PGMainLoop):gboolean;cdecl;external gliblib name 'g_main_loop_is_running';
 
165
 
 
166
    function g_main_loop_get_context(loop:PGMainLoop):PGMainContext;cdecl;external gliblib name 'g_main_loop_get_context';
 
167
 
 
168
    { GSource:  }
 
169
    function g_source_new(source_funcs:PGSourceFuncs; struct_size:guint):PGSource;cdecl;external gliblib name 'g_source_new';
 
170
 
 
171
    function g_source_ref(source:PGSource):PGSource;cdecl;external gliblib name 'g_source_ref';
 
172
 
 
173
    procedure g_source_unref(source:PGSource);cdecl;external gliblib name 'g_source_unref';
 
174
 
 
175
    function g_source_attach(source:PGSource; context:PGMainContext):guint;cdecl;external gliblib name 'g_source_attach';
 
176
 
 
177
    procedure g_source_destroy(source:PGSource);cdecl;external gliblib name 'g_source_destroy';
 
178
 
 
179
    procedure g_source_set_priority(source:PGSource; priority:gint);cdecl;external gliblib name 'g_source_set_priority';
 
180
 
 
181
    function g_source_get_priority(source:PGSource):gint;cdecl;external gliblib name 'g_source_get_priority';
 
182
 
 
183
    procedure g_source_set_can_recurse(source:PGSource; can_recurse:gboolean);cdecl;external gliblib name 'g_source_set_can_recurse';
 
184
 
 
185
    function g_source_get_can_recurse(source:PGSource):gboolean;cdecl;external gliblib name 'g_source_get_can_recurse';
 
186
 
 
187
    function g_source_get_id(source:PGSource):guint;cdecl;external gliblib name 'g_source_get_id';
 
188
 
 
189
    function g_source_get_context(source:PGSource):PGMainContext;cdecl;external gliblib name 'g_source_get_context';
 
190
 
 
191
    procedure g_source_set_callback(source:PGSource; func:TGSourceFunc; data:gpointer; notify:TGDestroyNotify);cdecl;external gliblib name 'g_source_set_callback';
 
192
 
 
193
    { Used to implement g_source_connect_closure and internally }
 
194
    procedure g_source_set_callback_indirect(source:PGSource; callback_data:gpointer; callback_funcs:PGSourceCallbackFuncs);cdecl;external gliblib name 'g_source_set_callback_indirect';
 
195
 
 
196
    procedure g_source_add_poll(source:PGSource; fd:PGPollFD);cdecl;external gliblib name 'g_source_add_poll';
 
197
 
 
198
    procedure g_source_remove_poll(source:PGSource; fd:PGPollFD);cdecl;external gliblib name 'g_source_remove_poll';
 
199
 
 
200
    procedure g_source_get_current_time(source:PGSource; timeval:PGTimeVal);cdecl;external gliblib name 'g_source_get_current_time';
 
201
 
 
202
    { void g_source_connect_closure (GSource         source,
 
203
                                      GClosure        closure);
 
204
      }
 
205
    { Specific source types
 
206
      }
 
207
    function g_idle_source_new:PGSource;cdecl;external gliblib name 'g_idle_source_new';
 
208
 
 
209
    function g_timeout_source_new(interval:guint):PGSource;cdecl;external gliblib name 'g_timeout_source_new';
 
210
 
 
211
    { Miscellaneous functions
 
212
      }
 
213
    procedure g_get_current_time(result:PGTimeVal);cdecl;external gliblib name 'g_get_current_time';
 
214
 
 
215
    { ============== Compat main loop stuff ==================  }
 
216
 
 
217
    function g_main_new(is_running: gboolean): PGMainLoop;
 
218
 
 
219
 
 
220
    { these functions are maped to their newer versions }
 
221
    procedure g_main_run        (loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_run';
 
222
    procedure g_main_quit       (loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_quit';
 
223
    procedure g_main_destroy    (loop:PGMainLoop);cdecl;external gliblib name 'g_main_loop_unref';
 
224
    function  g_main_is_running (loop:PGMainLoop):gboolean;cdecl;external gliblib name 'g_main_loop_is_running';
 
225
 
 
226
 
 
227
    { Functions to manipulate the default main loop}
 
228
    function  g_main_iteration  (may_block: gboolean): gboolean;
 
229
    function  g_main_pending: gboolean;
 
230
    //             g_main_context_pending        (NULL)
 
231
    procedure g_main_set_poll_func(func:  TGPollFunc);
 
232
    //   g_main_context_set_poll_func (NULL, func)
 
233
 
 
234
    { ======= end of Compat main loop stuff ==================  }
 
235
 
 
236
    { Source manipulation by ID  }
 
237
 
 
238
    function g_source_remove(tag:guint):gboolean;cdecl;external gliblib name 'g_source_remove';
 
239
 
 
240
    function g_source_remove_by_user_data(user_data:gpointer):gboolean;cdecl;external gliblib name 'g_source_remove_by_user_data';
 
241
 
 
242
    function g_source_remove_by_funcs_user_data(funcs:PGSourceFuncs; user_data:gpointer):gboolean;cdecl;external gliblib name 'g_source_remove_by_funcs_user_data';
 
243
 
 
244
    { Idles and timeouts  }
 
245
    function g_timeout_add_full(priority:gint; interval:guint; _function:TGSourceFunc; data:gpointer; notify:TGDestroyNotify):guint;cdecl;external gliblib name 'g_timeout_add_full';
 
246
 
 
247
    function g_timeout_add(interval:guint; _function:TGSourceFunc; data:gpointer):guint;cdecl;external gliblib name 'g_timeout_add';
 
248
 
 
249
    function g_idle_add(_function:TGSourceFunc; data:gpointer):guint;cdecl;external gliblib name 'g_idle_add';
 
250
 
 
251
    function g_idle_add_full(priority:gint; _function:TGSourceFunc; data:gpointer; notify:TGDestroyNotify):guint;cdecl;external gliblib name 'g_idle_add_full';
 
252
 
 
253
    function g_idle_remove_by_data(data:gpointer):gboolean;cdecl;external gliblib name 'g_idle_remove_by_data';
 
254
 
 
255
    { Hook for GClosure / GSource integration. Don't touch  }
 
256
// GLIB_VAR GSourceFuncs g_timeout_funcs;
 
257
// GLIB_VAR GSourceFuncs g_idle_funcs;
 
258
 
 
259
{$ifdef win32}
 
260
    { This is used to add polling for Windows messages. GDK (GTK+) programs
 
261
       should  not  use this.
 
262
      }
 
263
 
 
264
    procedure g_main_poll_win32_msg_add(priority:gint; fd:PGPollFD; hwnd:guint);cdecl;external gliblib name 'g_main_poll_win32_msg_add';
 
265
{$endif}
 
266
 
 
267
{$endif}
 
268