cmd_show_window.hpp 3.93 KB
Newer Older
1 2 3
/*****************************************************************************
 * cmd_show_window.hpp
 *****************************************************************************
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 11 12 13 14 15 16 17 18 19 20 21
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
dionoea's avatar
dionoea committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24 25 26 27 28
 *****************************************************************************/

#ifndef CMD_SHOW_WINDOW_HPP
#define CMD_SHOW_WINDOW_HPP

#include "cmd_generic.hpp"
29
#include "../src/os_factory.hpp"
30
#include "../src/top_window.hpp"
31
#include "../src/window_manager.hpp"
32
#include "../src/popup.hpp"
33 34


35 36 37 38
/// Command to show a window
class CmdShowWindow: public CmdGeneric
{
    public:
39
        CmdShowWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
40
                       TopWindow &rWin ):
41
            CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
42
        virtual ~CmdShowWindow() {}
43

44
        /// This method does the real job of the command
45
        virtual void execute() { m_rWinManager.show( m_rWin ); }
46

47 48
        /// Return the type of the command
        virtual string getType() const { return "show window"; }
49

50
    private:
51 52
        /// Reference to the window manager
        WindowManager &m_rWinManager;
53
        /// Reference to the window
54
        TopWindow &m_rWin;
55 56 57 58 59
};


/// Command to hide a window
class CmdHideWindow: public CmdGeneric
60 61
{
    public:
62
        CmdHideWindow( intf_thread_t *pIntf, WindowManager &rWinManager,
63
                       TopWindow &rWin ):
64
            CmdGeneric( pIntf ), m_rWinManager( rWinManager ), m_rWin( rWin ) {}
65
        virtual ~CmdHideWindow() {}
66 67

        /// This method does the real job of the command
68
        virtual void execute() { m_rWinManager.hide( m_rWin ); }
69 70

        /// Return the type of the command
71
        virtual string getType() const { return "hide window"; }
72 73

    private:
74 75
        /// Reference to the window manager
        WindowManager &m_rWinManager;
76
        /// Reference to the window
77
        TopWindow &m_rWin;
78 79
};

80

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/// Command to raise all windows
class CmdRaiseAll: public CmdGeneric
{
    public:
        CmdRaiseAll( intf_thread_t *pIntf, WindowManager &rWinManager ):
            CmdGeneric( pIntf ), m_rWinManager( rWinManager ) {}
        virtual ~CmdRaiseAll() {}

        /// This method does the real job of the command
        virtual void execute() { m_rWinManager.raiseAll(); }

        /// Return the type of the command
        virtual string getType() const { return "raise all windows"; }

    private:
        /// Reference to the window manager
        WindowManager &m_rWinManager;
};

100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

/// Command to show a popup menu
class CmdShowPopup: public CmdGeneric
{
    public:
        CmdShowPopup( intf_thread_t *pIntf, Popup &rPopup ):
            CmdGeneric( pIntf ), m_rPopup( rPopup ) {}
        virtual ~CmdShowPopup() {}

        /// This method does the real job of the command
        virtual void execute()
        {
            int x, y;
            OSFactory::instance( getIntf() )->getMousePos( x, y );
            m_rPopup.show( x, y );
        }

        /// Return the type of the command
        virtual string getType() const { return "show popup"; }

    private:
        /// Reference to the popup
        Popup &m_rPopup;
};


126
#endif