1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/gmain.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/gmain.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,330 @@
1.4 -gmain.h
1.5 +/* gmain.h - the GLib Main loop
1.6 + * Copyright (C) 1998-2000 Red Hat, Inc.
1.7 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.8 + *
1.9 + * This library is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU Library General Public
1.11 + * License as published by the Free Software Foundation; either
1.12 + * version 2 of the License, or (at your option) any later version.
1.13 + *
1.14 + * This library is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.17 + * Library General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU Library General Public
1.20 + * License along with this library; if not, write to the
1.21 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.22 + * Boston, MA 02111-1307, USA.
1.23 + */
1.24 +
1.25 +#ifndef __G_MAIN_H__
1.26 +#define __G_MAIN_H__
1.27 +
1.28 +#include <_ansi.h>
1.29 +#include <glib/gslist.h>
1.30 +#include <glib/gthread.h>
1.31 +
1.32 +G_BEGIN_DECLS
1.33 +
1.34 +typedef struct _GMainContext GMainContext; /* Opaque */
1.35 +typedef struct _GMainLoop GMainLoop; /* Opaque */
1.36 +typedef struct _GSource GSource;
1.37 +typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs;
1.38 +typedef struct _GSourceFuncs GSourceFuncs;
1.39 +
1.40 +typedef gboolean (*GSourceFunc) (gpointer data);
1.41 +typedef void (*GChildWatchFunc) (GPid pid,
1.42 + gint status,
1.43 + gpointer data);
1.44 +struct _GSource
1.45 +{
1.46 + /*< private >*/
1.47 + gpointer callback_data;
1.48 + GSourceCallbackFuncs *callback_funcs;
1.49 +
1.50 + GSourceFuncs *source_funcs;
1.51 + guint ref_count;
1.52 +
1.53 + GMainContext *context;
1.54 +
1.55 + gint priority;
1.56 + guint flags;
1.57 + guint source_id;
1.58 +
1.59 + GSList *poll_fds;
1.60 +
1.61 + GSource *prev;
1.62 + GSource *next;
1.63 +
1.64 + gpointer reserved1;
1.65 + gpointer reserved2;
1.66 +};
1.67 +
1.68 +struct _GSourceCallbackFuncs
1.69 +{
1.70 + void (*ref) (gpointer cb_data);
1.71 + void (*unref) (gpointer cb_data);
1.72 + void (*get) (gpointer cb_data,
1.73 + GSource *source,
1.74 + GSourceFunc *func,
1.75 + gpointer *data);
1.76 +};
1.77 +
1.78 +typedef void (*GSourceDummyMarshal) (void);
1.79 +
1.80 +struct _GSourceFuncs
1.81 +{
1.82 + gboolean (*prepare) (GSource *source,
1.83 + gint *timeout_);
1.84 + gboolean (*check) (GSource *source);
1.85 + gboolean (*dispatch) (GSource *source,
1.86 + GSourceFunc callback,
1.87 + gpointer user_data);
1.88 + void (*finalize) (GSource *source); /* Can be NULL */
1.89 +
1.90 + /* For use by g_source_set_closure */
1.91 + GSourceFunc closure_callback;
1.92 + GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
1.93 +};
1.94 +
1.95 +/* Any definitions using GPollFD or GPollFunc are primarily
1.96 + * for Unix and not guaranteed to be the compatible on all
1.97 + * operating systems on which GLib runs. Right now, the
1.98 + * GLib does use these functions on Win32 as well, but interprets
1.99 + * them in a fairly different way than on Unix. If you use
1.100 + * these definitions, you are should be prepared to recode
1.101 + * for different operating systems.
1.102 + *
1.103 + *
1.104 + * On Win32, the fd in a GPollFD should be Win32 HANDLE (*not* a file
1.105 + * descriptor as provided by the C runtime) that can be used by
1.106 + * MsgWaitForMultipleObjects. This does *not* include file handles
1.107 + * from CreateFile, SOCKETs, nor pipe handles. (But you can use
1.108 + * WSAEventSelect to signal events when a SOCKET is readable).
1.109 + *
1.110 + * On Win32, fd can also be the special value G_WIN32_MSG_HANDLE to
1.111 + * indicate polling for messages.
1.112 + *
1.113 + * But note that G_WIN32_MSG_HANDLE GPollFDs should not be used by GDK
1.114 + * (GTK) programs, as GDK itself wants to read messages and convert them
1.115 + * to GDK events.
1.116 + *
1.117 + * So, unless you really know what you are doing, it's best not to try
1.118 + * to use the main loop polling stuff for your own needs on
1.119 + * Win32. It's really only written for the GIMP's needs so
1.120 + * far.
1.121 + */
1.122 +typedef struct _GPollFD GPollFD;
1.123 +typedef gint (*GPollFunc) (GPollFD *ufds,
1.124 + guint nfsd,
1.125 + gint timeout_);
1.126 +
1.127 +struct _GPollFD
1.128 +{
1.129 + gint fd;
1.130 + gushort events;
1.131 + gushort revents;
1.132 +};
1.133 +
1.134 +/* Standard priorities */
1.135 +
1.136 +#define G_PRIORITY_HIGH -100
1.137 +#define G_PRIORITY_DEFAULT 0
1.138 +#define G_PRIORITY_HIGH_IDLE 100
1.139 +#define G_PRIORITY_DEFAULT_IDLE 200
1.140 +#define G_PRIORITY_LOW 300
1.141 +
1.142 +/* GMainContext: */
1.143 +
1.144 +IMPORT_C GMainContext *g_main_context_new (void);
1.145 +IMPORT_C GMainContext *g_main_context_ref (GMainContext *context);
1.146 +IMPORT_C void g_main_context_unref (GMainContext *context);
1.147 +IMPORT_C GMainContext *g_main_context_default (void);
1.148 +
1.149 +IMPORT_C gboolean g_main_context_iteration (GMainContext *context,
1.150 + gboolean may_block);
1.151 +IMPORT_C gboolean g_main_context_pending (GMainContext *context);
1.152 +
1.153 +/* For implementation of legacy interfaces
1.154 + */
1.155 +IMPORT_C GSource *g_main_context_find_source_by_id (GMainContext *context,
1.156 + guint source_id);
1.157 +IMPORT_C GSource *g_main_context_find_source_by_user_data (GMainContext *context,
1.158 + gpointer user_data);
1.159 +IMPORT_C GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context,
1.160 + GSourceFuncs *funcs,
1.161 + gpointer user_data);
1.162 +
1.163 +/* Low level functions for implementing custom main loops.
1.164 + */
1.165 +IMPORT_C void g_main_context_wakeup (GMainContext *context);
1.166 +IMPORT_C gboolean g_main_context_acquire (GMainContext *context);
1.167 +IMPORT_C void g_main_context_release (GMainContext *context);
1.168 +IMPORT_C gboolean g_main_context_is_owner (GMainContext *context);
1.169 +IMPORT_C gboolean g_main_context_wait (GMainContext *context,
1.170 + GCond *cond,
1.171 + GMutex *mutex);
1.172 +
1.173 +IMPORT_C gboolean g_main_context_prepare (GMainContext *context,
1.174 + gint *priority);
1.175 +IMPORT_C gint g_main_context_query (GMainContext *context,
1.176 + gint max_priority,
1.177 + gint *timeout_,
1.178 + GPollFD *fds,
1.179 + gint n_fds);
1.180 +IMPORT_C gint g_main_context_check (GMainContext *context,
1.181 + gint max_priority,
1.182 + GPollFD *fds,
1.183 + gint n_fds);
1.184 +IMPORT_C void g_main_context_dispatch (GMainContext *context);
1.185 +
1.186 +IMPORT_C void g_main_context_set_poll_func (GMainContext *context,
1.187 + GPollFunc func);
1.188 +IMPORT_C GPollFunc g_main_context_get_poll_func (GMainContext *context);
1.189 +
1.190 +/* Low level functions for use by source implementations
1.191 + */
1.192 +IMPORT_C void g_main_context_add_poll (GMainContext *context,
1.193 + GPollFD *fd,
1.194 + gint priority);
1.195 +IMPORT_C void g_main_context_remove_poll (GMainContext *context,
1.196 + GPollFD *fd);
1.197 +
1.198 +IMPORT_C int g_main_depth (void);
1.199 +
1.200 +/* GMainLoop: */
1.201 +
1.202 +IMPORT_C GMainLoop *g_main_loop_new (GMainContext *context,
1.203 + gboolean is_running);
1.204 +IMPORT_C void g_main_loop_run (GMainLoop *loop);
1.205 +IMPORT_C void g_main_loop_quit (GMainLoop *loop);
1.206 +IMPORT_C GMainLoop *g_main_loop_ref (GMainLoop *loop);
1.207 +IMPORT_C void g_main_loop_unref (GMainLoop *loop);
1.208 +IMPORT_C gboolean g_main_loop_is_running (GMainLoop *loop);
1.209 +IMPORT_C GMainContext *g_main_loop_get_context (GMainLoop *loop);
1.210 +
1.211 +/* GSource: */
1.212 +
1.213 +IMPORT_C GSource *g_source_new (GSourceFuncs *source_funcs,
1.214 + guint struct_size);
1.215 +IMPORT_C GSource *g_source_ref (GSource *source);
1.216 +IMPORT_C void g_source_unref (GSource *source);
1.217 +
1.218 +IMPORT_C guint g_source_attach (GSource *source,
1.219 + GMainContext *context);
1.220 +IMPORT_C void g_source_destroy (GSource *source);
1.221 +
1.222 +IMPORT_C void g_source_set_priority (GSource *source,
1.223 + gint priority);
1.224 +IMPORT_C gint g_source_get_priority (GSource *source);
1.225 +IMPORT_C void g_source_set_can_recurse (GSource *source,
1.226 + gboolean can_recurse);
1.227 +IMPORT_C gboolean g_source_get_can_recurse (GSource *source);
1.228 +IMPORT_C guint g_source_get_id (GSource *source);
1.229 +
1.230 +IMPORT_C GMainContext *g_source_get_context (GSource *source);
1.231 +
1.232 +IMPORT_C void g_source_set_callback (GSource *source,
1.233 + GSourceFunc func,
1.234 + gpointer data,
1.235 + GDestroyNotify notify);
1.236 +
1.237 +
1.238 +/* Used to implement g_source_connect_closure and internally*/
1.239 +IMPORT_C void g_source_set_callback_indirect (GSource *source,
1.240 + gpointer callback_data,
1.241 + GSourceCallbackFuncs *callback_funcs);
1.242 +
1.243 +IMPORT_C void g_source_add_poll (GSource *source,
1.244 + GPollFD *fd);
1.245 +IMPORT_C void g_source_remove_poll (GSource *source,
1.246 + GPollFD *fd);
1.247 +
1.248 +IMPORT_C void g_source_get_current_time (GSource *source,
1.249 + GTimeVal *timeval);
1.250 +
1.251 + /* void g_source_connect_closure (GSource *source,
1.252 + GClosure *closure);
1.253 + */
1.254 +
1.255 +/* Specific source types
1.256 + */
1.257 +IMPORT_C GSource *g_idle_source_new (void);
1.258 +IMPORT_C GSource *g_child_watch_source_new (GPid pid);
1.259 +IMPORT_C GSource *g_timeout_source_new (guint interval);
1.260 +
1.261 +/* Miscellaneous functions
1.262 + */
1.263 +IMPORT_C void g_get_current_time (GTimeVal *result);
1.264 +
1.265 +/* ============== Compat main loop stuff ================== */
1.266 +
1.267 +#ifndef G_DISABLE_DEPRECATED
1.268 +
1.269 +/* Legacy names for GMainLoop functions
1.270 + */
1.271 +#define g_main_new(is_running) g_main_loop_new (NULL, is_running);
1.272 +#define g_main_run(loop) g_main_loop_run(loop)
1.273 +#define g_main_quit(loop) g_main_loop_quit(loop)
1.274 +#define g_main_destroy(loop) g_main_loop_unref(loop)
1.275 +#define g_main_is_running(loop) g_main_loop_is_running(loop)
1.276 +
1.277 +/* Functions to manipulate the default main loop
1.278 + */
1.279 +
1.280 +#define g_main_iteration(may_block) g_main_context_iteration (NULL, may_block)
1.281 +#define g_main_pending() g_main_context_pending (NULL)
1.282 +
1.283 +#define g_main_set_poll_func(func) g_main_context_set_poll_func (NULL, func)
1.284 +
1.285 +#endif /* G_DISABLE_DEPRECATED */
1.286 +
1.287 +/* Source manipulation by ID */
1.288 +IMPORT_C gboolean g_source_remove (guint tag);
1.289 +IMPORT_C gboolean g_source_remove_by_user_data (gpointer user_data);
1.290 +IMPORT_C gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs,
1.291 + gpointer user_data);
1.292 +
1.293 +/* Idles, child watchers and timeouts */
1.294 +IMPORT_C guint g_timeout_add_full (gint priority,
1.295 + guint interval,
1.296 + GSourceFunc function,
1.297 + gpointer data,
1.298 + GDestroyNotify notify);
1.299 +IMPORT_C guint g_timeout_add (guint interval,
1.300 + GSourceFunc function,
1.301 + gpointer data);
1.302 +IMPORT_C guint g_child_watch_add_full (gint priority,
1.303 + GPid pid,
1.304 + GChildWatchFunc function,
1.305 + gpointer data,
1.306 + GDestroyNotify notify);
1.307 +IMPORT_C guint g_child_watch_add (GPid pid,
1.308 + GChildWatchFunc function,
1.309 + gpointer data);
1.310 +IMPORT_C guint g_idle_add (GSourceFunc function,
1.311 + gpointer data);
1.312 +IMPORT_C guint g_idle_add_full (gint priority,
1.313 + GSourceFunc function,
1.314 + gpointer data,
1.315 + GDestroyNotify notify);
1.316 +IMPORT_C gboolean g_idle_remove_by_data (gpointer data);
1.317 +
1.318 +/* Hook for GClosure / GSource integration. Don't touch */
1.319 +#ifdef __SYMBIAN32__
1.320 +IMPORT_C GSourceFuncs * _g_timeout_funcs();
1.321 +#endif /*__SYMBIAN32__ */
1.322 +GLIB_VAR GSourceFuncs g_timeout_funcs;
1.323 +#ifdef __SYMBIAN32__
1.324 +IMPORT_C GSourceFuncs * _g_child_watch_funcs();
1.325 +#endif /* __SYMBIAN32__ */
1.326 +GLIB_VAR GSourceFuncs g_child_watch_funcs;
1.327 +#ifdef __SYMBIAN32__
1.328 +IMPORT_C GSourceFuncs * _g_idle_funcs();
1.329 +#endif/* __SYMBIAN32__ */
1.330 +GLIB_VAR GSourceFuncs g_idle_funcs;
1.331 +
1.332 +G_END_DECLS
1.333 +
1.334 +#endif /* __G_MAIN_H__ */