1 /*****************************************************************************
2  * dialogs.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id: 1a65c040f1973720458d3ef8e0d27d29282dc19a $
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
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 along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24 
25 #ifndef DIALOGS_HPP
26 #define DIALOGS_HPP
27 
28 #include "skin_common.hpp"
29 #include <string>
30 
31 struct interaction_dialog_t ;
32 
33 // Dialogs provider
34 class Dialogs: public SkinObject
35 {
36 public:
37     /// Get the instance of Dialogs (or NULL if initialization failed)
38     static Dialogs *instance( intf_thread_t *pIntf );
39 
40     /// Delete the instance of Dialogs
41     static void destroy( intf_thread_t *pIntf );
42 
43     /// Show the Change Skin dialog
44     void showChangeSkin();
45 
46     /// Show the Load Playlist dialog
47     void showPlaylistLoad();
48 
49     /// Show the Save Playlist dialog
50     void showPlaylistSave();
51 
52     /** Show the Quick Open File dialog.
53      *  If play is false, just add the item in the playlist
54      */
55     void showFileSimple( bool play );
56 
57     /** Show the Open File dialog
58      *  If play is false, just add the item in the playlist
59      */
60     void showFile( bool play );
61 
62     /** Show the Open Directory dialog
63      *  If play is false, just add the item in the playlist
64      */
65     void showDirectory( bool play );
66 
67     /** Show the Open Disc dialog
68      *  If play is false, just add the item in the playlist
69      */
70     void showDisc( bool play );
71 
72     /** Show the Open Network Stream dialog
73      *  If play is false, just add the item in the playlist
74      */
75     void showNet( bool play );
76 
77     /// Show the Messages dialog
78     void showMessages();
79 
80     /// Show the Preferences dialog
81     void showPrefs();
82 
83     /// Show the FileInfo dialog
84     void showFileInfo();
85 
86     /// Show the Streaming Wizard dialog
87     void showStreamingWizard();
88 
89     /// Show the Playlist
90     void showPlaylist();
91 
92     /// Show a popup menu
93     void showPopupMenu( bool bShow, int popupType );
94 
95     /// Show an interaction dialog
96     void showInteraction( interaction_dialog_t * );
97 
98     /// Send hotkeys (key accelerators)
99     void sendKey( int key );
100 
101 private:
102     // Private because it's a singleton
103     Dialogs( intf_thread_t *pIntf );
104     ~Dialogs();
105 
106     /// DlgCallback is the type of the callbacks of the open/save dialog
107     typedef void DlgCallback( intf_dialog_args_t *pArg );
108 
109     /// Possible flags for the open/save dialog
110     enum flags_t
111     {
112         kOPEN     = 0x01,
113         kSAVE     = 0x02,
114         kMULTIPLE = 0x04
115     };
116 
117     /// Initialization method
118     bool init();
119 
120     /** Show a generic open/save dialog, initialized with the given
121      *  parameters
122      *  The 'flags' parameter is a logical or of the flags_t values
123      */
124     void showFileGeneric( const std::string &rTitle, const std::string &rExtensions,
125                           DlgCallback callback, int flags );
126 
127     /// Callback for the Change Skin dialog
128     static void showChangeSkinCB( intf_dialog_args_t *pArg );
129 
130     /// Callback for the Load Playlist dialog
131     static void showPlaylistLoadCB( intf_dialog_args_t *pArg );
132 
133     /// Callback for the Save Playlist dialog
134     static void showPlaylistSaveCB( intf_dialog_args_t *pArg );
135 
136     /// Dialogs provider module
137     intf_thread_t *m_pProvider;
138     module_t *m_pModule;
139 };
140 
141 
142 #endif
143