x11 factory: use vlc_readdir
[vlc/solaris.git] / include / vlc_dialog.h
blob7c46d66a60b820cf5751c663c5740e1b1d4cd29c
1 /*****************************************************************************
2 * vlc_dialog.h: user interaction dialogs
3 *****************************************************************************
4 * Copyright (C) 2009 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_DIALOG_H_
22 #define VLC_DIALOG_H_
23 # include <stdarg.h>
25 /**
26 * \file vlc_dialog.h
27 * User interaction dialog APIs
30 /**
31 * A fatal error dialog.
32 * No response expected from the user.
34 typedef struct dialog_fatal_t
36 const char *title;
37 const char *message;
38 } dialog_fatal_t;
40 VLC_API void dialog_VFatal(vlc_object_t *, bool, const char *, const char *, va_list);
42 static inline VLC_FORMAT(3, 4)
43 void dialog_Fatal (vlc_object_t *obj, const char *title, const char *fmt, ...)
45 va_list ap;
47 va_start (ap, fmt);
48 dialog_VFatal(obj, false, title, fmt, ap);
49 va_end (ap);
51 #define dialog_Fatal(o, t, ...) \
52 dialog_Fatal(VLC_OBJECT(o), t, __VA_ARGS__)
54 static inline VLC_FORMAT(3, 4)
55 void dialog_FatalWait (vlc_object_t *obj, const char *title,
56 const char *fmt, ...){
57 va_list ap;
59 va_start (ap, fmt);
60 dialog_VFatal(obj, true, title, fmt, ap);
61 va_end (ap);
63 #define dialog_FatalWait(o, t, ...) \
64 dialog_FatalWait(VLC_OBJECT(o), t, __VA_ARGS__)
66 /**
67 * A login dialog.
69 typedef struct dialog_login_t
71 const char *title;
72 const char *message;
73 char **username;
74 char **password;
75 } dialog_login_t;
77 VLC_API void dialog_Login(vlc_object_t *, char **, char **, const char *, const char *, ...) VLC_FORMAT (5, 6);
78 #define dialog_Login(o, u, p, t, ...) \
79 dialog_Login(VLC_OBJECT(o), u, p, t, __VA_ARGS__)
81 /**
82 * A question dialog.
84 typedef struct dialog_question_t
86 const char *title;
87 const char *message;
88 const char *yes;
89 const char *no;
90 const char *cancel;
91 int answer;
92 } dialog_question_t;
94 VLC_API int dialog_Question(vlc_object_t *, const char *, const char *, const char *, const char *, const char *);
95 #define dialog_Question(o, t, m, y, n, c) \
96 dialog_Question(VLC_OBJECT(o), t, m, y, n, c)
98 typedef struct dialog_progress_bar_t
99 { /* Request-time parameters */
100 const char *title;
101 const char *message;
102 const char *cancel;
103 /* Permanent parameters */
104 void (*pf_update) (void *, const char *, float);
105 bool (*pf_check) (void *);
106 void (*pf_destroy) (void *);
107 void *p_sys;
108 } dialog_progress_bar_t;
110 VLC_API dialog_progress_bar_t * dialog_ProgressCreate(vlc_object_t *, const char *, const char *, const char *) VLC_USED;
111 #define dialog_ProgressCreate(o, t, m, c) \
112 dialog_ProgressCreate(VLC_OBJECT(o), t, m, c)
113 VLC_API void dialog_ProgressDestroy(dialog_progress_bar_t *);
114 VLC_API void dialog_ProgressSet(dialog_progress_bar_t *, const char *, float);
115 VLC_API bool dialog_ProgressCancelled(dialog_progress_bar_t *);
117 VLC_API int dialog_Register(vlc_object_t *);
118 VLC_API int dialog_Unregister(vlc_object_t *);
119 #define dialog_Register(o) dialog_Register(VLC_OBJECT(o))
120 #define dialog_Unregister(o) dialog_Unregister(VLC_OBJECT(o))
122 #endif