]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_dialogs.hpp
Skins2: Remove need for enum, and remove switch-o-literals.
[vlc] / modules / gui / skins2 / commands / cmd_dialogs.hpp
1 /*****************************************************************************
2  * cmd_dialogs.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
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 CMD_DIALOGS_HPP
26 #define CMD_DIALOGS_HPP
27
28 #include "cmd_generic.hpp"
29 #include "../src/dialogs.hpp"
30 #include "cmd_change_skin.hpp"
31
32 #include <vlc_interface.h>
33
34 #define DEFINE_DIALOGS \
35     DEF( ChangeSkin,         showChangeSkin() ) \
36     DEF( FileSimple,         showFileSimple( true ) ) \
37     DEF( File,               showFile( true ) ) \
38     DEF( Disc,               showDisc( true ) ) \
39     DEF( Net,                showNet( true ) ) \
40     DEF( Messages,           showMessages() ) \
41     DEF( Prefs,              showPrefs() ) \
42     DEF( FileInfo,           showFileInfo() ) \
43     \
44     DEF( Add,                showFile( false ) ) \
45     DEF( PlaylistLoad,       showPlaylistLoad() ) \
46     DEF( PlaylistSave,       showPlaylistSave() ) \
47     DEF( Directory,          showDirectory( true ) ) \
48     DEF( StreamingWizard,    showStreamingWizard() ) \
49     DEF( Playlist,           showPlaylist() ) \
50     \
51     DEF( ShowPopupMenu,      showPopupMenu(true,INTF_DIALOG_POPUPMENU) ) \
52     DEF( HidePopupMenu,      showPopupMenu(false,INTF_DIALOG_POPUPMENU) ) \
53     DEF( ShowAudioPopupMenu, showPopupMenu(true,INTF_DIALOG_AUDIOPOPUPMENU) ) \
54     DEF( HideAudioPopupMenu, showPopupMenu(false,INTF_DIALOG_AUDIOPOPUPMENU) ) \
55     DEF( ShowVideoPopupMenu, showPopupMenu(true,INTF_DIALOG_VIDEOPOPUPMENU) ) \
56     DEF( HideVideoPopupMenu, showPopupMenu(false,INTF_DIALOG_VIDEOPOPUPMENU) ) \
57     DEF( ShowMiscPopupMenu,  showPopupMenu(true,INTF_DIALOG_MISCPOPUPMENU) ) \
58     DEF( HideMiscPopupMenu,  showPopupMenu(false,INTF_DIALOG_MISCPOPUPMENU) )
59
60 #define DEF( a, c ) \
61 class CmdDlg##a: public CmdGeneric                              \
62 {   public:                                                     \
63     CmdDlg##a( intf_thread_t *pIntf ): CmdGeneric( pIntf ) { }  \
64     virtual ~CmdDlg##a() { }                                    \
65     virtual void execute()                                      \
66     {                                                           \
67         Dialogs *dlg = Dialogs::instance( getIntf() );          \
68         if( dlg ) dlg->c;                                       \
69     }                                                           \
70     virtual string getType() const { return #a" dialog"; }      \
71 };
72
73 DEFINE_DIALOGS
74
75 class CmdInteraction: public CmdGeneric
76 {
77 public:
78     CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t * p_dialog )
79                   : CmdGeneric( pIntf ), m_pDialog( p_dialog ) { }
80     virtual ~CmdInteraction() { }
81
82     virtual void execute()
83     {
84         Dialogs *pDialogs = Dialogs::instance( getIntf() );
85         if( pDialogs != NULL )
86             pDialogs->showInteraction( m_pDialog );
87     }
88     virtual string getType() const { return "interaction"; }
89 private:
90     interaction_dialog_t *m_pDialog;
91 };
92
93 #endif