skins2: fix RadialSlider
[vlc/asuraparaju-public.git] / modules / gui / skins2 / src / generic_window.hpp
blob4f6523981181c5aa7edae28201cce1e93ceaa2b0
1 /*****************************************************************************
2 * generic_window.hpp
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
5 * $Id$
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"
31 class OSWindow;
32 class EvtGeneric;
33 class EvtFocus;
34 class EvtLeave;
35 class EvtMenu;
36 class EvtMotion;
37 class EvtMouse;
38 class EvtKey;
39 class EvtRefresh;
40 class EvtScroll;
41 class WindowManager;
44 /// Generic window class
45 class GenericWindow: public SkinObject, public Observer<VarBool>
47 private:
48 friend class WindowManager;
49 friend class VoutManager;
50 friend class CtrlVideo;
51 public:
53 enum WindowType_t
55 TopWindow,
56 VoutWindow,
57 FullscreenWindow,
60 GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
61 bool dragDrop, bool playOnDrop,
62 GenericWindow *pParent = NULL,
63 WindowType_t type = TopWindow );
64 virtual ~GenericWindow();
66 /// Methods to process OS events.
67 virtual void processEvent( EvtFocus &rEvtFocus ) { }
68 virtual void processEvent( EvtMenu &rEvtMenu ) { }
69 virtual void processEvent( EvtMotion &rEvtMotion ) { }
70 virtual void processEvent( EvtMouse &rEvtMouse ) { }
71 virtual void processEvent( EvtLeave &rEvtLeave ) { }
72 virtual void processEvent( EvtKey &rEvtKey ) { }
73 virtual void processEvent( EvtScroll &rEvtScroll ) { }
75 virtual void processEvent( EvtRefresh &rEvtRefresh );
77 /// Resize the window
78 virtual void resize( int width, int height );
80 /// Refresh an area of the window
81 virtual void refresh( int left, int top, int width, int height ) { }
83 /// Get the coordinates of the window
84 int getLeft() const { return m_left; }
85 int getTop() const { return m_top; }
86 int getWidth() const { return m_width; }
87 int getHeight() const { return m_height; }
89 /// Give access to the visibility variable
90 VarBool &getVisibleVar() { return *m_pVarVisible; }
92 /// Window type, mainly useful when overloaded (for VoutWindow)
93 virtual string getType() const { return "Generic"; }
95 /// windows handle
96 void* getOSHandle() const;
98 /// reparent
99 void setParent( GenericWindow* pParent,
100 int x = 0, int y = 0, int w = -1, int h = -1 );
102 protected:
103 /// Get the OS window
104 OSWindow *getOSWindow() const { return m_pOsWindow; }
106 /// These methods do not need to be public since they are accessed
107 /// only by the window manager or by inheritant classes.
108 //@{
109 /// Show the window
110 virtual void show() const;
112 /// Hide the window
113 virtual void hide() const;
115 /// Move the window
116 virtual void move( int left, int top );
118 /// Bring the window on top
119 virtual void raise() const;
121 /// Set the opacity of the window (0 = transparent, 255 = opaque)
122 virtual void setOpacity( uint8_t value );
124 /// Toggle the window on top
125 virtual void toggleOnTop( bool onTop ) const;
126 //@}
128 /// Actually show the window
129 virtual void innerShow();
131 /// Actually hide the window
132 virtual void innerHide();
134 private:
135 /// Window position and size
136 int m_left, m_top, m_width, m_height;
137 /// OS specific implementation
138 OSWindow *m_pOsWindow;
139 /// Variable for the visibility of the window
140 mutable VarBoolImpl *m_pVarVisible;
142 /// Method called when the observed variable is modified
143 virtual void onUpdate( Subject<VarBool> &rVariable , void*);
147 #endif