Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

gphoto2-context.h

00001 /* gphoto2-context.h
00002  *
00003  * Copyright © 2001 Lutz Müller <lutz@users.sourceforge.net>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful, 
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details. 
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef __GPHOTO2_CONTEXT_H__
00022 #define __GPHOTO2_CONTEXT_H__
00023 
00024 #include <stdarg.h>
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif /* __cplusplus */
00029 
00030 typedef struct _GPContext GPContext;
00031 
00032 GPContext *gp_context_new (void);
00033 
00034 void gp_context_ref   (GPContext *context);
00035 void gp_context_unref (GPContext *context);
00036 
00037 enum _GPContextFeedback {
00038         GP_CONTEXT_FEEDBACK_OK,
00039         GP_CONTEXT_FEEDBACK_CANCEL
00040 };
00041 typedef enum _GPContextFeedback GPContextFeedback;
00042 
00043 /* Functions */
00044 typedef void (* GPContextIdleFunc)     (GPContext *context, void *data);
00045 typedef void (* GPContextErrorFunc)    (GPContext *context, const char *format,
00046                                         va_list args, void *data)
00047 #if (__GNUC__ >= 3)
00048         __attribute__((__format__(printf,2,0)))
00049 #endif
00050 ;
00051 typedef void (* GPContextStatusFunc)   (GPContext *context, const char *format,
00052                                         va_list args, void *data)
00053 #if (__GNUC__ >= 3)
00054         __attribute__((__format__(printf,2,0)))
00055 #endif
00056 ;
00057 typedef void (* GPContextMessageFunc)  (GPContext *context, const char *format,
00058                                         va_list args, void *data)
00059 #if (__GNUC__ >= 3)
00060         __attribute__((__format__(printf,2,0)))
00061 #endif
00062 ;
00063 typedef GPContextFeedback (* GPContextQuestionFunc) (GPContext *context,
00064                                                      const char *format,
00065                                                      va_list args, void *data)
00066 #if (__GNUC__ >= 3)
00067         __attribute__((__format__(printf,2,0)))
00068 #endif
00069 ;
00070 typedef GPContextFeedback (* GPContextCancelFunc)   (GPContext *context,
00071                                                      void *data);
00072 typedef unsigned int (* GPContextProgressStartFunc)  (GPContext *context,
00073                                                       float target,
00074                                                       const char *format,
00075                                                       va_list args, void *data)
00076 #if (__GNUC__ >= 3)
00077         __attribute__((__format__(printf,3,0)))
00078 #endif
00079 ;
00080 typedef void         (* GPContextProgressUpdateFunc) (GPContext *context,
00081                                                       unsigned int id,
00082                                                       float current,
00083                                                       void *data);
00084 typedef void         (* GPContextProgressStopFunc)   (GPContext *context,
00085                                                       unsigned int id,
00086                                                       void *data);
00087 
00088 /* Setting those functions (frontends) */
00089 void gp_context_set_idle_func      (GPContext *context,
00090                                     GPContextIdleFunc func,     void *data);
00091 void gp_context_set_progress_funcs (GPContext *context,
00092                                     GPContextProgressStartFunc  start_func,
00093                                     GPContextProgressUpdateFunc update_func,
00094                                     GPContextProgressStopFunc   stop_func,
00095                                     void *data);
00096 void gp_context_set_error_func     (GPContext *context,
00097                                     GPContextErrorFunc func,    void *data);
00098 void gp_context_set_status_func    (GPContext *context,
00099                                     GPContextStatusFunc func,   void *data);
00100 void gp_context_set_question_func  (GPContext *context,
00101                                     GPContextQuestionFunc func, void *data);
00102 void gp_context_set_cancel_func    (GPContext *context,
00103                                     GPContextCancelFunc func,   void *data);
00104 void gp_context_set_message_func   (GPContext *context,
00105                                     GPContextMessageFunc func,  void *data);
00106 
00107 /* Calling those functions (backends) */
00108 void gp_context_idle     (GPContext *context);
00109 void gp_context_error    (GPContext *context, const char *format, ...)
00110 #ifdef __GNUC__
00111         __attribute__((__format__(printf,2,3)))
00112 #endif
00113 ;
00114 void gp_context_status   (GPContext *context, const char *format, ...)
00115 #ifdef __GNUC__
00116         __attribute__((__format__(printf,2,3)))
00117 #endif
00118 ;
00119 void gp_context_message  (GPContext *context, const char *format, ...)
00120 #ifdef __GNUC__
00121         __attribute__((__format__(printf,2,3)))
00122 #endif
00123 ;
00124 GPContextFeedback gp_context_question (GPContext *context, const char *format,
00125                                        ...)
00126 #ifdef __GNUC__
00127         __attribute__((__format__(printf,2,3)))
00128 #endif
00129 ;
00130 GPContextFeedback gp_context_cancel   (GPContext *context);
00131 unsigned int gp_context_progress_start  (GPContext *context, float target,
00132                                          const char *format, ...)
00133 #ifdef __GNUC__
00134         __attribute__((__format__(printf,3,4)))
00135 #endif
00136 ;
00137 void         gp_context_progress_update (GPContext *context, unsigned int id,
00138                                          float current);
00139 void         gp_context_progress_stop   (GPContext *context, unsigned int id);
00140 
00141 #ifdef __cplusplus
00142 }
00143 #endif /* __cplusplus */
00144 
00145 #endif /* __GPHOTO2_CONTEXT_H__ */

Generated on Thu Jun 14 21:43:51 2007 for libgphoto2 (libgphoto2) by  doxygen 1.4.2