]> git.sesse.net Git - vlc/blob - modules/gui/skins2/controls/ctrl_video.hpp
skins2 vout manager
[vlc] / modules / gui / skins2 / controls / ctrl_video.hpp
1 /*****************************************************************************
2  * ctrl_video.hpp
3  *****************************************************************************
4  * Copyright (C) 2004 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 #ifndef CTRL_VIDEO_HPP
25 #define CTRL_VIDEO_HPP
26
27 #include "ctrl_generic.hpp"
28 #include "../utils/position.hpp"
29 #include "../src/vout_window.hpp"
30 #include <vlc_vout.h>
31
32
33 /// Control video
34 class CtrlVideo: public CtrlGeneric, public Observer<VarBox>
35 {
36     public:
37         CtrlVideo( intf_thread_t *pIntf, GenericLayout &rLayout,
38                    bool autoResize, const UString &rHelp, VarBool *pVisible );
39         virtual ~CtrlVideo();
40
41         /// Handle an event on the control
42         virtual void handleEvent( EvtGeneric &rEvent );
43
44         /// Check whether coordinates are inside the control
45         virtual bool mouseOver( int x, int y ) const;
46
47         /// Callback for layout resize
48         virtual void onResize();
49
50         /// Called when the Position is set
51         virtual void onPositionChange();
52
53         /// Draw the control on the given graphics
54         virtual void draw( OSGraphics &rImage, int xDest, int yDest );
55
56         /// Get the type of control (custom RTTI)
57         virtual string getType() const { return "video"; }
58
59         /// Method called when the vout size is updated
60         virtual void onUpdate( Subject<VarBox> &rVoutSize, void* );
61
62         /// Method called when visibility or ActiveLayout is updated
63         virtual void onUpdate( Subject<VarBool> &rVariable , void* );
64
65         // Attach a voutWindow to a Video Control
66         void attachVoutWindow( VoutWindow* pVoutWindow );
67
68         // Detach a voutWindow from a Video Control
69         void detachVoutWindow( );
70
71         // Update the inner part of the Video Control
72         void resizeInnerVout( );
73
74         // Get TopWindow associated with the video control
75         virtual TopWindow* getWindow() { return CtrlGeneric::getWindow(); }
76
77         // Get the VoutWindow associated with the video control
78         virtual VoutWindow* getVoutWindow() { return m_pVoutWindow; }
79
80         /// Set the position and the associated layout of the control
81         virtual void setLayout( GenericLayout *pLayout,
82                                 const Position &rPosition );
83
84         // resize the video Control
85         virtual void resizeControl( int width, int height );
86
87         // Is this control useable (visibility requirements)
88         virtual bool isUseable() { return m_bIsUseable; }
89
90         // Is this control used
91         virtual bool isUsed() { return m_pVoutWindow ? true : false; }
92
93     private:
94         /// Associated layout
95         GenericLayout &m_rLayout;
96
97         /// Autoresize parameter
98         bool m_bAutoResize;
99
100         /// Difference between layout size and video size
101         int m_xShift, m_yShift;
102
103         /// Is the video Control useable
104         bool m_bIsUseable;
105
106         /// Vout window
107         VoutWindow *m_pVoutWindow;
108 };
109
110 #endif