]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/generic_window.hpp
skins2 vout manager
[vlc] / modules / gui / skins2 / src / generic_window.hpp
index 53a9712fa016dbaf5704442a4e9c4397fd16a218..e75b733b7fda3ab91e12375263596ea5d900be59 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * generic_window.hpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulière <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef GENERIC_WINDOW_HPP
@@ -32,16 +32,22 @@ class OSWindow;
 class EvtGeneric;
 class EvtFocus;
 class EvtLeave;
+class EvtMenu;
 class EvtMotion;
 class EvtMouse;
 class EvtKey;
 class EvtRefresh;
 class EvtScroll;
+class WindowManager;
 
 
 /// Generic window class
 class GenericWindow: public SkinObject, public Observer<VarBool>
 {
+    private:
+        friend class WindowManager;
+        friend class VoutManager;
+        friend class CtrlVideo;
     public:
         GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
                        bool dragDrop, bool playOnDrop,
@@ -50,6 +56,7 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
 
         /// Methods to process OS events.
         virtual void processEvent( EvtFocus &rEvtFocus ) {}
+        virtual void processEvent( EvtMenu &rEvtMenu ) {}
         virtual void processEvent( EvtMotion &rEvtMotion ) {}
         virtual void processEvent( EvtMouse &rEvtMouse ) {}
         virtual void processEvent( EvtLeave &rEvtLeave ) {}
@@ -58,21 +65,46 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
 
         virtual void processEvent( EvtRefresh &rEvtRefresh );
 
-        // Show the window
-        virtual void show();
-
-        // Hide the window
-        virtual void hide();
+        /// Resize the window
+        virtual void resize( int width, int height );
 
-        // Refresh an area of the window
+        /// Refresh an area of the window
         virtual void refresh( int left, int top, int width, int height ) {}
 
+        /// Get the coordinates of the window
+        int getLeft() const { return m_left; }
+        int getTop() const { return m_top; }
+        int getWidth() const { return m_width; }
+        int getHeight() const { return m_height; }
+
+        /// Give access to the visibility variable
+        VarBool &getVisibleVar() { return *m_pVarVisible; }
+
+        /// Window type, mainly useful when overloaded (for VoutWindow)
+        virtual string getType() const { return "Generic"; }
+
+        /// windows handle
+        void* getOSHandle() const;
+
+        /// reparent
+        void setParent( GenericWindow* pParent, int x, int y, int w, int h );
+
+    protected:
+        /// Get the OS window
+        OSWindow *getOSWindow() const { return m_pOsWindow; }
+
+        /// These methods do not need to be public since they are accessed
+        /// only by the window manager or by inheritant classes.
+        //@{
+        /// Show the window
+        virtual void show() const;
+
+        /// Hide the window
+        virtual void hide() const;
+
         /// Move the window
         virtual void move( int left, int top );
 
-        /// Resize the window
-        virtual void resize( int width, int height );
-
         /// Bring the window on top
         virtual void raise() const;
 
@@ -81,36 +113,24 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
 
         /// Toggle the window on top
         virtual void toggleOnTop( bool onTop ) const;
+        //@}
 
-        /// Get the coordinates of the window
-        virtual int getLeft() const { return m_left; }
-        virtual int getTop() const { return m_top; }
-        virtual int getWidth() const { return m_width; }
-        virtual int getHeight() const { return m_height; }
-
-        /// Give access to the visibility variable
-        VarBool &getVisibleVar() { return m_varVisible; }
-
-    protected:
         /// Actually show the window
         virtual void innerShow();
 
         /// Actually hide the window
         virtual void innerHide();
 
-        /// Get the OS window
-        OSWindow *getOSWindow() const { return m_pOsWindow; }
-
     private:
         /// Window position and size
         int m_left, m_top, m_width, m_height;
         /// OS specific implementation
         OSWindow *m_pOsWindow;
         /// Variable for the visibility of the window
-        VarBoolImpl m_varVisible;
+        mutable VarBoolImpl *m_pVarVisible;
 
         /// Method called when the observed variable is modified
-        virtual void onUpdate( Subject<VarBool> &rVariable );
+        virtual void onUpdate( Subject<VarBool> &rVariable , void*);
 };