]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/vout_window.cpp
skins2: first proposal for a skinnable fullscreen controller (fsc)
[vlc] / modules / gui / skins2 / src / vout_window.cpp
1 /*****************************************************************************
2  * vout_window.cpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include "vout_window.hpp"
25 #include "vout_manager.hpp"
26 #include "vlcproc.hpp"
27 #include "theme.hpp"
28 #include "os_factory.hpp"
29 #include "os_graphics.hpp"
30 #include "os_window.hpp"
31 #include "../events/evt_key.hpp"
32
33 #include <vlc_keys.h>
34
35
36
37 int VoutWindow::count = 0;
38
39 VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
40                         int width, int height, GenericWindow* pParent ) :
41       GenericWindow( pIntf, 0, 0, false, false, pParent,
42                      GenericWindow::VoutWindow ),
43       m_pWnd( pWnd ), original_width( width ), original_height( height ),
44       m_pParentWindow( pParent ), m_pCtrlVideo( NULL ), m_bFullscreen( false )
45 {
46     // counter for debug
47     count++;
48
49     if( m_pWnd )
50         vlc_object_hold( m_pWnd );
51 }
52
53
54 VoutWindow::~VoutWindow()
55 {
56     if( m_pWnd )
57         vlc_object_release( m_pWnd );
58
59     count--;
60     msg_Dbg( getIntf(), "VoutWindow count = %d", count );
61 }
62
63
64 void VoutWindow::setCtrlVideo( CtrlVideo* pCtrlVideo )
65 {
66     if( pCtrlVideo )
67     {
68         hide();
69         const Position *pPos = pCtrlVideo->getPosition();
70         int x = pPos->getLeft();
71         int y = pPos->getTop();
72         int w = pPos->getWidth();
73         int h = pPos->getHeight();
74
75         setParent( pCtrlVideo->getWindow(), x, y, w, h );
76         m_pParentWindow = pCtrlVideo->getWindow();
77
78         show();
79     }
80     else
81     {
82         hide();
83         int w = VoutManager::instance( getIntf() )->getVoutMainWindow()->getWidth();
84         int h = VoutManager::instance( getIntf() )->getVoutMainWindow()->getHeight();
85
86         setParent( VoutManager::instance( getIntf() )->getVoutMainWindow(),
87                    0, 0, w, h );
88         m_pParentWindow =
89                   VoutManager::instance( getIntf() )->getVoutMainWindow();
90         show();
91     }
92
93     m_pCtrlVideo = pCtrlVideo;
94 }
95
96
97 void VoutWindow::setFullscreen( bool b_fullscreen )
98 {
99     /*TODO: fullscreen implementation */
100 }
101
102
103 void VoutWindow::processEvent( EvtKey &rEvtKey )
104 {
105     // Only do the action when the key is down
106     if( rEvtKey.getKeyState() == EvtKey::kDown )
107         var_SetInteger( getIntf()->p_libvlc, "key-pressed",
108                          rEvtKey.getModKey() );
109 }
110