cmd_dialogs.hpp
上传用户:riyaled888
上传日期:2009-03-27
资源大小:7338k
文件大小:4k
源码类别:

多媒体

开发平台:

MultiPlatform

  1. /*****************************************************************************
  2.  * cmd_dialogs.hpp
  3.  *****************************************************************************
  4.  * Copyright (C) 2003 VideoLAN
  5.  * $Id: cmd_dialogs.hpp 8524 2004-08-25 21:32:15Z ipkiss $
  6.  *
  7.  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  8.  *          Olivier Teuli鑢e <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
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  23.  *****************************************************************************/
  24. #ifndef CMD_DIALOGS_HPP
  25. #define CMD_DIALOGS_HPP
  26. #include "cmd_generic.hpp"
  27. #include "../src/dialogs.hpp"
  28. #include "cmd_change_skin.hpp"
  29. template<int TYPE = 0> class CmdDialogs;
  30. // XXX use an enum instead
  31. typedef CmdDialogs<1> CmdDlgChangeSkin;
  32. typedef CmdDialogs<2> CmdDlgFileSimple;
  33. typedef CmdDialogs<3> CmdDlgFile;
  34. typedef CmdDialogs<4> CmdDlgDisc;
  35. typedef CmdDialogs<5> CmdDlgNet;
  36. typedef CmdDialogs<6> CmdDlgMessages;
  37. typedef CmdDialogs<7> CmdDlgPrefs;
  38. typedef CmdDialogs<8> CmdDlgFileInfo;
  39. typedef CmdDialogs<9> CmdDlgShowPopupMenu;
  40. typedef CmdDialogs<10> CmdDlgHidePopupMenu;
  41. typedef CmdDialogs<11> CmdDlgAdd;
  42. typedef CmdDialogs<12> CmdDlgPlaylistLoad;
  43. typedef CmdDialogs<13> CmdDlgPlaylistSave;
  44. /// Generic "Open dialog" command
  45. template<int TYPE>
  46. class CmdDialogs: public CmdGeneric
  47. {
  48.     public:
  49.         CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
  50.         virtual ~CmdDialogs() {}
  51.         /// This method does the real job of the command
  52.         virtual void execute()
  53.         {
  54.             /// Get the dialogs provider
  55.             Dialogs *pDialogs = Dialogs::instance( getIntf() );
  56.             if( pDialogs == NULL )
  57.             {
  58.                 return;
  59.             }
  60.             switch( TYPE )
  61.             {
  62.                 case 1:
  63.                     pDialogs->showChangeSkin();
  64.                     break;
  65.                 case 2:
  66.                     pDialogs->showFileSimple( true );
  67.                     break;
  68.                 case 3:
  69.                     pDialogs->showFile( true );
  70.                     break;
  71.                 case 4:
  72.                     pDialogs->showDisc( true );
  73.                     break;
  74.                 case 5:
  75.                     pDialogs->showNet( true );
  76.                     break;
  77.                 case 6:
  78.                     pDialogs->showMessages();
  79.                     break;
  80.                 case 7:
  81.                     pDialogs->showPrefs();
  82.                     break;
  83.                 case 8:
  84.                     pDialogs->showFileInfo();
  85.                     break;
  86.                 case 9:
  87.                     pDialogs->showPopupMenu( true );
  88.                     break;
  89.                 case 10:
  90.                     pDialogs->showPopupMenu( false );
  91.                     break;
  92.                 case 11:
  93.                     pDialogs->showFile( false );
  94.                     break;
  95.                 case 12:
  96.                     pDialogs->showPlaylistLoad();
  97.                     break;
  98.                 case 13:
  99.                     pDialogs->showPlaylistSave();
  100.                     break;
  101.                 default:
  102.                     msg_Warn( getIntf(), "Unknown dialog type" );
  103.                     break;
  104.             }
  105.         }
  106.         /// Return the type of the command
  107.         virtual string getType() const { return "dialog"; }
  108. };
  109. #endif