1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
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.
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.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef GENERIC_WINDOW_HPP
26 #define GENERIC_WINDOW_HPP
28 #include "skin_common.hpp"
29 #include "../utils/var_bool.hpp"
30 #include "vlc_vout_window.h"
49 /// Generic window class
50 class GenericWindow
: public SkinObject
, public Observer
<VarBool
>
53 friend class WindowManager
;
54 friend class VoutManager
;
55 friend class CtrlVideo
;
66 GenericWindow( intf_thread_t
*pIntf
, int xPos
, int yPos
,
67 bool dragDrop
, bool playOnDrop
,
68 GenericWindow
*pParent
= NULL
,
69 WindowType_t type
= TopWindow
);
70 virtual ~GenericWindow();
72 /// Methods to process OS events.
73 virtual void processEvent( EvtFocus
&rEvtFocus
) { (void)rEvtFocus
; }
74 virtual void processEvent( EvtMenu
&rEvtMenu
) { (void)rEvtMenu
; }
75 virtual void processEvent( EvtMotion
&rEvtMotion
) { (void)rEvtMotion
; }
76 virtual void processEvent( EvtMouse
&rEvtMouse
) { (void)rEvtMouse
; }
77 virtual void processEvent( EvtLeave
&rEvtLeave
) { (void)rEvtLeave
; }
78 virtual void processEvent( EvtKey
&rEvtKey
) { (void)rEvtKey
; }
79 virtual void processEvent( EvtScroll
&rEvtScroll
) { (void)rEvtScroll
; }
81 virtual void processEvent( EvtDragEnter
&rEvtDragEnter
)
82 { (void)rEvtDragEnter
; }
83 virtual void processEvent( EvtDragLeave
&rEvtDragLeave
)
84 { (void)rEvtDragLeave
; }
85 virtual void processEvent( EvtDragOver
&rEvtDragOver
)
86 { (void)rEvtDragOver
; }
87 virtual void processEvent( EvtDragDrop
&rEvtDragDrop
)
88 { (void)rEvtDragDrop
; }
90 virtual void processEvent( EvtRefresh
&rEvtRefresh
);
93 virtual void resize( int width
, int height
);
95 /// Refresh an area of the window
96 virtual void refresh( int left
, int top
, int width
, int height
)
97 { (void)left
; (void)top
; (void)width
; (void)height
; }
99 /// Invalidate an area of the window
100 virtual void invalidateRect( int left
, int top
, int width
, int height
);
102 /// Get the coordinates of the window
103 int getLeft() const { return m_left
; }
104 int getTop() const { return m_top
; }
105 int getWidth() const { return m_width
; }
106 int getHeight() const { return m_height
; }
107 void getMonitorInfo( int* x
, int* y
, int* width
, int* height
) const;
109 /// Give access to the visibility variable
110 VarBool
&getVisibleVar() { return *m_pVarVisible
; }
112 /// Window type, mainly useful when overloaded (for VoutWindow)
113 virtual std::string
getType() const { return "Generic"; }
116 void updateWindowConfiguration( vout_window_t
*pWnd
) const;
119 WindowType_t
getType() { return m_type
; }
122 void setParent( GenericWindow
* pParent
,
123 int x
= 0, int y
= 0, int w
= -1, int h
= -1 );
125 /// Get the OS window
126 OSWindow
*getOSWindow() const { return m_pOsWindow
; }
130 /// These methods do not need to be public since they are accessed
131 /// only by the window manager or by inheritant classes.
134 virtual void show() const;
137 virtual void hide() const;
140 virtual void move( int left
, int top
);
142 /// Bring the window on top
143 virtual void raise() const;
145 /// Set the opacity of the window (0 = transparent, 255 = opaque)
146 virtual void setOpacity( uint8_t value
);
148 /// Toggle the window on top
149 virtual void toggleOnTop( bool onTop
) const;
152 /// Actually show the window
153 virtual void innerShow();
155 /// Actually hide the window
156 virtual void innerHide();
159 bool isVisible() const { return m_pVarVisible
->get(); }
161 /// Method called when the observed variable is modified
162 virtual void onUpdate( Subject
<VarBool
> &rVariable
, void*);
166 /// Window position and size
167 int m_left
, m_top
, m_width
, m_height
;
168 /// OS specific implementation
169 OSWindow
*m_pOsWindow
;
170 /// Variable for the visibility of the window
171 mutable VarBoolImpl
*m_pVarVisible
;