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
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 *****************************************************************************/
25 #ifndef GENERIC_WINDOW_HPP
26 #define GENERIC_WINDOW_HPP
28 #include "skin_common.hpp"
29 #include "../utils/var_bool.hpp"
44 /// Generic window class
45 class GenericWindow: public SkinObject, public Observer<VarBool, void*>
48 friend class WindowManager;
50 GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
51 bool dragDrop, bool playOnDrop,
52 GenericWindow *pParent = NULL );
53 virtual ~GenericWindow();
55 /// Methods to process OS events.
56 virtual void processEvent( EvtFocus &rEvtFocus ) {}
57 virtual void processEvent( EvtMenu &rEvtMenu ) {}
58 virtual void processEvent( EvtMotion &rEvtMotion ) {}
59 virtual void processEvent( EvtMouse &rEvtMouse ) {}
60 virtual void processEvent( EvtLeave &rEvtLeave ) {}
61 virtual void processEvent( EvtKey &rEvtKey ) {}
62 virtual void processEvent( EvtScroll &rEvtScroll ) {}
64 virtual void processEvent( EvtRefresh &rEvtRefresh );
67 virtual void resize( int width, int height );
69 /// Refresh an area of the window
70 virtual void refresh( int left, int top, int width, int height ) {}
72 /// Get the coordinates of the window
73 int getLeft() const { return m_left; }
74 int getTop() const { return m_top; }
75 int getWidth() const { return m_width; }
76 int getHeight() const { return m_height; }
78 /// Give access to the visibility variable
79 VarBool &getVisibleVar() { return m_varVisible; }
81 /// Window type, mainly useful when overloaded (for VoutWindow)
82 virtual string getType() const { return "Generic"; }
86 OSWindow *getOSWindow() const { return m_pOsWindow; }
88 /// These methods do not need to be public since they are accessed
89 /// only by the window manager or by inheritant classes.
92 virtual void show() const;
95 virtual void hide() const;
98 virtual void move( int left, int top );
100 /// Bring the window on top
101 virtual void raise() const;
103 /// Set the opacity of the window (0 = transparent, 255 = opaque)
104 virtual void setOpacity( uint8_t value );
106 /// Toggle the window on top
107 virtual void toggleOnTop( bool onTop ) const;
110 /// Actually show the window
111 virtual void innerShow();
113 /// Actually hide the window
114 virtual void innerHide();
117 /// Window position and size
118 int m_left, m_top, m_width, m_height;
119 /// OS specific implementation
120 OSWindow *m_pOsWindow;
121 /// Variable for the visibility of the window
122 mutable VarBoolImpl m_varVisible;
124 /// Method called when the observed variable is modified
125 virtual void onUpdate( Subject<VarBool, void*> &rVariable , void*);