]> git.sesse.net Git - vlc/blob - modules/gui/skins2/commands/cmd_show_window.hpp
* skins2: support for custom popup menus, and win32 implementation.
[vlc] / modules / gui / skins2 / commands / cmd_show_window.hpp
1 /*****************************************************************************
2  * cmd_show_window.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
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
25 #ifndef CMD_SHOW_WINDOW_HPP
26 #define CMD_SHOW_WINDOW_HPP
27
28 #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 /// Command to show a window
36 class CmdShowWindow: public CmdGeneric
37 {
38     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         /// Return the type of the command
48         virtual string getType() const { return "show window"; }
49
50     private:
51         /// Reference to the window manager
52         WindowManager &m_rWinManager;
53         /// Reference to the window
54         TopWindow &m_rWin;
55 };
56
57
58 /// Command to hide a window
59 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         /// Reference to the window manager
75         WindowManager &m_rWinManager;
76         /// Reference to the window
77         TopWindow &m_rWin;
78 };
79
80
81 /// Command to raise all windows
82 class CmdRaiseAll: public CmdGeneric
83 {
84     public:
85         CmdRaiseAll( intf_thread_t *pIntf, WindowManager &rWinManager ):
86             CmdGeneric( pIntf ), m_rWinManager( rWinManager ) {}
87         virtual ~CmdRaiseAll() {}
88
89         /// This method does the real job of the command
90         virtual void execute() { m_rWinManager.raiseAll(); }
91
92         /// Return the type of the command
93         virtual string getType() const { return "raise all windows"; }
94
95     private:
96         /// Reference to the window manager
97         WindowManager &m_rWinManager;
98 };
99
100
101 /// Command to show a popup menu
102 class CmdShowPopup: public CmdGeneric
103 {
104     public:
105         CmdShowPopup( intf_thread_t *pIntf, Popup &rPopup ):
106             CmdGeneric( pIntf ), m_rPopup( rPopup ) {}
107         virtual ~CmdShowPopup() {}
108
109         /// This method does the real job of the command
110         virtual void execute()
111         {
112             int x, y;
113             OSFactory::instance( getIntf() )->getMousePos( x, y );
114             m_rPopup.show( x, y );
115         }
116
117         /// Return the type of the command
118         virtual string getType() const { return "show popup"; }
119
120     private:
121         /// Reference to the popup
122         Popup &m_rPopup;
123 };
124
125
126 #endif