vlc_dialog.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_dialog.h: user interaction dialogs
00003  *****************************************************************************
00004  * Copyright (C) 2009 Rémi Denis-Courmont
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00019  *****************************************************************************/
00020 
00021 #ifndef VLC_DIALOG_H_
00022 #define VLC_DIALOG_H_
00023 # include <stdarg.h>
00024 
00025 /**
00026  * \file vlc_dialog.h
00027  * User interaction dialog APIs
00028  */
00029 
00030 /**
00031  * A fatal error dialog.
00032  * No response expected from the user.
00033  */
00034 typedef struct dialog_fatal_t
00035 {
00036     const char *title;
00037     const char *message;
00038 } dialog_fatal_t;
00039 
00040 VLC_EXPORT( void, dialog_VFatal, (vlc_object_t *, bool, const char *, const char *, va_list) );
00041 
00042 static inline LIBVLC_FORMAT(3, 4)
00043 void dialog_Fatal (vlc_object_t *obj, const char *title, const char *fmt, ...)
00044 {
00045      va_list ap;
00046 
00047      va_start (ap, fmt);
00048      dialog_VFatal(obj, false, title, fmt, ap);
00049      va_end (ap);
00050 }
00051 #define dialog_Fatal(o, t, ...) \
00052         dialog_Fatal(VLC_OBJECT(o), t, __VA_ARGS__)
00053 
00054 static inline LIBVLC_FORMAT(3, 4)
00055 void dialog_FatalWait (vlc_object_t *obj, const char *title,
00056                        const char *fmt, ...){
00057      va_list ap;
00058 
00059      va_start (ap, fmt);
00060      dialog_VFatal(obj, true, title, fmt, ap);
00061      va_end (ap);
00062 }
00063 #define dialog_FatalWait(o, t, ...) \
00064         dialog_FatalWait(VLC_OBJECT(o), t, __VA_ARGS__)
00065 
00066 /**
00067  * A login dialog.
00068  */
00069 typedef struct dialog_login_t
00070 {
00071     const char *title;
00072     const char *message;
00073     char **username;
00074     char **password;
00075 } dialog_login_t;
00076 
00077 VLC_EXPORT( void, dialog_Login, (vlc_object_t *, char **, char **, const char *, const char *, ...) ) LIBVLC_FORMAT (5, 6);
00078 #define dialog_Login(o, u, p, t, ...) \
00079         dialog_Login(VLC_OBJECT(o), u, p, t, __VA_ARGS__)
00080 
00081 /**
00082  * A question dialog.
00083  */
00084 typedef struct dialog_question_t
00085 {
00086     const char *title;
00087     const char *message;
00088     const char *yes;
00089     const char *no;
00090     const char *cancel;
00091     int answer;
00092 } dialog_question_t;
00093 
00094 VLC_EXPORT( int, dialog_Question, (vlc_object_t *, const char *, const char *, const char *, const char *, const char *) );
00095 #define dialog_Question(o, t, m, y, n, c) \
00096         dialog_Question(VLC_OBJECT(o), t, m, y, n, c)
00097 
00098 typedef struct dialog_progress_bar_t
00099 {   /* Request-time parameters */
00100     const char *title;
00101     const char *message;
00102     const char *cancel;
00103     /* Permanent parameters */
00104     void (*pf_update) (void *, const char *, float);
00105     bool (*pf_check) (void *);
00106     void (*pf_destroy) (void *);
00107     void *p_sys;
00108 } dialog_progress_bar_t;
00109 
00110 VLC_EXPORT( dialog_progress_bar_t *, dialog_ProgressCreate, (vlc_object_t *, const char *, const char *, const char *) LIBVLC_USED );
00111 #define dialog_ProgressCreate(o, t, m, c) \
00112         dialog_ProgressCreate(VLC_OBJECT(o), t, m, c)
00113 VLC_EXPORT( void, dialog_ProgressDestroy, (dialog_progress_bar_t *) );
00114 VLC_EXPORT( void, dialog_ProgressSet, (dialog_progress_bar_t *, const char *, float) );
00115 VLC_EXPORT( bool, dialog_ProgressCancelled, (dialog_progress_bar_t *) );
00116 
00117 VLC_EXPORT( int, dialog_Register, (vlc_object_t *) );
00118 VLC_EXPORT( int, dialog_Unregister, (vlc_object_t *) );
00119 #define dialog_Register(o) dialog_Register(VLC_OBJECT(o))
00120 #define dialog_Unregister(o) dialog_Unregister(VLC_OBJECT(o))
00121 
00122 #endif

Generated on Mon Nov 22 07:55:19 2010 for VLC by  doxygen 1.5.6