]> git.sesse.net Git - vlc/blob - include/vlc_interaction.h
e2891016860251aa2cd7ede95d447fb17155e7c1
[vlc] / include / vlc_interaction.h
1 /*****************************************************************************
2  * vlc_interaction.h: structures and function for user interaction
3  *****************************************************************************
4  * Copyright (C) 1999-2004 VideoLAN
5  * $Id: vlc_interaction.h 7954 2004-06-07 22:19:12Z fenrir $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /**
25  * This structure describes an interaction widget
26  */
27 struct user_widget_t
28 {
29     int             i_type;             //< Type identifier;
30     char           *psz_text;           //< Free text
31
32     vlc_value_t     val;
33 };
34
35 /**
36  * Possible widget types
37  */
38 enum
39 {
40     WIDGET_TEXT,                        //< Text display
41     WIDGET_PROGRESS,                    //< A progress bar
42     WIDGET_INPUT                       //< Input (backed up by a variable)
43 };
44
45 /**
46  * This structure describes a piece of interaction with the user
47  */
48 struct interaction_dialog_t
49 {
50     int             i_id;               //< Unique ID
51     int             i_type;             //< Type identifier
52     char           *psz_title;          //< Title
53     char           *psz_description;    //< Descriptor string
54
55     /* For dialogs */
56     int             i_widgets;          //< Nu,ber of dialog widgets
57     user_widget_t **pp_widgets;         //< Dialog widgets
58
59     vlc_bool_t      b_reusable;         //< Do we have to reuse this ?
60
61     void *          p_private;          //< Private interface data
62     int             i_status;           //< Dialog status;
63
64     int             i_action;           //< Action to perform;
65 };
66
67 /**
68  * Possible status
69  */
70 enum
71 {
72     NEW_DIALOG,
73     SENT_DIALOG,
74     UPDATED_DIALOG,
75     ANSWERED_DIALOG,
76     HIDING_DIALOG,
77     HIDDEN_DIALOG,
78 };
79
80 /**
81  * Possible interaction types
82  */
83 enum
84 {
85     INTERACT_PROGRESS,          //< Progress bar
86     INTERACT_WARNING,           //< Warning message ("codec not supported")
87     INTERACT_FATAL,             //< Fatal message ("File not found")
88     INTERACT_FATAL_LIST,        //< List of fatal messages ("File not found")
89     INTERACT_ASK,               //< Full-featured dialog box (password)
90 };
91
92 /**
93  * Predefined reusable dialogs
94  */
95 enum
96 {
97     DIALOG_FIRST,
98     DIALOG_NOACCESS,
99     DIALOG_NOCODEC,
100     DIALOG_NOAUDIO,
101
102     DIALOG_LAST_PREDEFINED,
103 };
104
105 /**
106  * This structure contains the active interaction dialogs, and is
107  * used by teh manager
108  */
109 struct interaction_t
110 {
111     VLC_COMMON_MEMBERS
112
113     int                         i_dialogs;      //< Number of dialogs
114     interaction_dialog_t      **pp_dialogs;     //< Dialogs
115
116     intf_thread_t              *p_intf;         //< Interface to use
117
118     int                         i_last_id;      //< Last attributed ID
119 };
120 /**
121  * Possible actions
122  */
123 enum
124 {
125     INTERACT_NEW,
126     INTERACT_UPDATE,
127     INTERACT_HIDE
128 };
129
130 /***************************************************************************
131  * Exported symbols
132  ***************************************************************************/
133
134 #define intf_Interact( a,b ) __intf_Interact( VLC_OBJECT(a), b )
135 VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) );
136
137 #define intf_UserFatal( a,b, c, d, e... ) __intf_UserFatal( a,b,c,d, ## e )
138 VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, int, const char*, const char*, ...) );
139
140 VLC_EXPORT( void, intf_InteractionManage,( playlist_t *) );
141 VLC_EXPORT( void, intf_InteractionDestroy,( interaction_t *) );