]> git.sesse.net Git - vlc/blob - include/vlc_interaction.h
* additional interaction enhancements
[vlc] / include / vlc_interaction.h
1 /*****************************************************************************
2  * vlc_interaction.h: structures and function for user interaction
3  *****************************************************************************
4  * Copyright (C) 2005-2006 VideoLAN
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Felix Kühne <fkuehne@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /**
26  * This structure describes an interaction widget
27  * WIDGETS ARE OUTDATED! THIS IS ONLY A STUB TO KEEP WX COMPILING!
28  */
29 struct user_widget_t
30 {
31     int             i_type;             ///< Type identifier;
32     char           *psz_text;           ///< Free text
33
34     vlc_value_t     val;
35 };
36
37 /**
38  * Possible widget types
39  * WIDGETS ARE OUTDATED! THIS IS ONLY A STUB TO KEEP WX COMPILING!
40  */
41 enum
42 {
43     WIDGET_TEXT,                        ///< Text display
44     WIDGET_PROGRESS,                    ///< A progress bar
45     WIDGET_INPUT_TEXT                   ///< Input (backed up by a variable)
46 };
47
48 /**
49  * This structure describes a piece of interaction with the user
50  */
51 struct interaction_dialog_t
52 {
53     int             i_id;               ///< Unique ID
54     int             i_type;             ///< Type identifier
55     char           *psz_title;          ///< Title
56     char           *psz_description;    ///< Descriptor string
57     char           *psz_defaultButton;  ///< default button title (~OK)
58     char           *psz_alternateButton;///< alternate button title (~NO)
59     char           *psz_otherButton;    ///< other button title (optional,~Cancel)
60
61     char           *psz_returned[1];    ///< returned responses from the user
62
63     vlc_value_t     val;                ///< a value coming from core for dialogue
64     int             i_timeToGo;         ///< time (in sec) until shown progress is finished
65     vlc_bool_t      b_cancelled;        ///< was the dialogue cancelled by the user?
66
67     int             i_widgets;          ///< Number of dialog widgets
68     user_widget_t **pp_widgets;         ///< Dialog widgets
69
70     void *          p_private;          ///< Private interface data
71
72     int             i_status;           ///< Dialog status;
73     int             i_action;           ///< Action to perform;
74     int             i_flags;            ///< Misc flags
75     int             i_return;           ///< Return status
76
77     interaction_t  *p_interaction;      ///< Parent interaction object
78     vlc_object_t   *p_parent;           ///< The vlc object that asked
79                                         //for interaction
80 };
81
82 /**
83  * Possible flags . Reusable and button types
84  */
85 #define DIALOG_REUSABLE             0x01
86 #define DIALOG_YES_NO_CANCEL        0x04
87 #define DIALOG_CLEAR_NOSHOW         0x08
88 #define DIALOG_GOT_ANSWER           0x10
89 #define DIALOG_LOGIN_PW_OK_CANCEL   0x20
90 #define DIALOG_BLOCKING_ERROR       0x24
91 #define DIALOG_NONBLOCKING_ERROR    0x200
92 #define DIALOG_USER_PROGRESS        0x40
93 #define DIALOG_PSZ_INPUT_OK_CANCEL      0x80
94 #define DIALOG_INTF_PROGRESS        0x100
95 #define DIALOG_WARNING              0x400
96
97 /**
98  * Possible return codes
99  */
100 enum
101 {
102     DIALOG_DEFAULT,
103     DIALOG_OK_YES,
104     DIALOG_NO,
105     DIALOG_CANCELLED
106 };
107
108 /**
109  * Possible status
110  */
111 enum
112 {
113     NEW_DIALOG,                 ///< Just created
114     SENT_DIALOG,                ///< Sent to interface
115     UPDATED_DIALOG,             ///< Update to send
116     ANSWERED_DIALOG,            ///< Got "answer"
117     HIDING_DIALOG,              ///< Hiding requested
118     HIDDEN_DIALOG,              ///< Now hidden. Requesting destruction
119     DESTROYED_DIALOG,           ///< Interface has destroyed it
120 };
121
122 /**
123  * Possible interaction types
124  */
125 enum
126 {
127     INTERACT_DIALOG_ONEWAY,     ///< Dialog box without feedback
128     INTERACT_DIALOG_TWOWAY,     ///< Dialog box with feedback
129 };
130
131 /**
132  * Predefined reusable dialogs
133  */
134 enum
135 {
136     DIALOG_FIRST,
137
138     DIALOG_LAST_PREDEFINED,
139 };
140
141 /**
142  * This structure contains the active interaction dialogs, and is
143  * used by the manager
144  */
145 struct interaction_t
146 {
147     VLC_COMMON_MEMBERS
148
149     int                         i_dialogs;      ///< Number of dialogs
150     interaction_dialog_t      **pp_dialogs;     ///< Dialogs
151
152     intf_thread_t              *p_intf;         ///< Interface to use
153
154     int                         i_last_id;      ///< Last attributed ID
155 };
156 /**
157  * Possible actions
158  */
159 enum
160 {
161     INTERACT_NEW,
162     INTERACT_UPDATE,
163     INTERACT_HIDE,
164     INTERACT_DESTROY
165 };
166
167 /***************************************************************************
168  * Exported symbols
169  ***************************************************************************/
170
171 #define intf_Interact( a,b ) __intf_Interact( VLC_OBJECT(a), b )
172 VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) );
173
174 #define intf_UserFatal( a, b, c, d, e... ) __intf_UserFatal( VLC_OBJECT(a),b,c,d, ## e )
175 VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, vlc_bool_t, const char*, const char*, ...) );
176 #define intf_UserWarn( a, c, d, e... ) __intf_UserWarn( VLC_OBJECT(a),c,d, ## e )
177 VLC_EXPORT( void, __intf_UserWarn,( vlc_object_t*, const char*, const char*, ...) );
178 #define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( VLC_OBJECT(a),b,c,d,e)
179 VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) );
180 #define intf_UserYesNo( a, b, c, d, e, f ) __intf_UserYesNo( VLC_OBJECT(a),b,c, d, e, f )
181 VLC_EXPORT( int, __intf_UserYesNo,( vlc_object_t*, const char*, const char*, const char*, const char*, const char*) );
182
183 #define intf_UserProgress( a, b, c, d, e ) __intf_UserProgress( VLC_OBJECT(a),b,c,d,e )
184 VLC_EXPORT( int, __intf_UserProgress,( vlc_object_t*, const char*, const char*, float, int) );
185 #define intf_UserProgressUpdate( a, b, c, d, e ) __intf_UserProgressUpdate( VLC_OBJECT(a),b,c,d,e )
186 VLC_EXPORT( void, __intf_UserProgressUpdate,( vlc_object_t*, int, const char*, float, int) );
187 #define intf_UserProgressIsCancelled( a, b ) __intf_UserProgressIsCancelled( VLC_OBJECT(a),b )
188 VLC_EXPORT( vlc_bool_t, __intf_UserProgressIsCancelled,( vlc_object_t*, int ) );
189
190 #define intf_UserStringInput( a, b, c, d ) __intf_UserStringInput( VLC_OBJECT(a),b,c,d )
191 VLC_EXPORT( int, __intf_UserStringInput,(vlc_object_t*, const char*, const char*, char **) );
192
193 #define intf_IntfProgress( a, b, c ) __intf_IntfProgress( VLC_OBJECT(a),b,c )
194 VLC_EXPORT( int, __intf_IntfProgress,( vlc_object_t*, const char*, float) );
195 #define intf_IntfProgressUpdate( a, b, c, d ) __intf_IntfProgressUpdate( VLC_OBJECT(a),b,c,d )
196 VLC_EXPORT( void, __intf_IntfProgressUpdate,( vlc_object_t*, int, const char*, float) );
197
198 #define intf_UserHide( a, b ) __intf_UserHide( VLC_OBJECT(a), b )
199 VLC_EXPORT( void, __intf_UserHide,( vlc_object_t *, int ));
200
201 VLC_EXPORT( void, intf_InteractionManage,( playlist_t *) );
202 VLC_EXPORT( void, intf_InteractionDestroy,( interaction_t *) );