]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/generic_window.hpp
Skins: missing include, makes skins2 on Windows fail to build.
[vlc] / modules / gui / skins2 / src / generic_window.hpp
index 8a62165326624144d1007a9fc62c5a233e685c4a..f3c5bfece01e6b56bb9f1e72d60277cecb1732e2 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
  *
  * 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
 #define GENERIC_WINDOW_HPP
 
 #include "skin_common.hpp"
-#include "../utils/pointer.hpp"
 #include "../utils/var_bool.hpp"
-#include <list>
 
-class Anchor;
 class OSWindow;
-class OSGraphics;
-class GenericLayout;
-class CtrlGeneric;
 class EvtGeneric;
 class EvtFocus;
 class EvtLeave;
+class EvtMenu;
 class EvtMotion;
 class EvtMouse;
 class EvtKey;
@@ -49,39 +44,59 @@ class WindowManager;
 /// Generic window class
 class GenericWindow: public SkinObject, public Observer<VarBool>
 {
+    private:
+        friend class WindowManager;
     public:
         GenericWindow( intf_thread_t *pIntf, int xPos, int yPos,
-                       WindowManager &rWindowManager,
-                       bool dragDrop, bool playOnDrop );
+                       bool dragDrop, bool playOnDrop,
+                       GenericWindow *pParent = NULL );
         virtual ~GenericWindow();
 
         /// Methods to process OS events.
-        virtual void processEvent( EvtFocus &rEvtFocus );
-        virtual void processEvent( EvtMotion &rEvtMotion );
-        virtual void processEvent( EvtMouse &rEvtMouse );
-        virtual void processEvent( EvtLeave &rEvtLeave );
-        virtual void processEvent( EvtKey &rEvtKey );
+        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 ) {}
+        virtual void processEvent( EvtKey &rEvtKey ) {}
+        virtual void processEvent( EvtScroll &rEvtScroll ) {}
+
         virtual void processEvent( EvtRefresh &rEvtRefresh );
-        virtual void processEvent( EvtScroll &rEvtScroll );
 
-        /// Forward an event to a control
-        virtual void forwardEvent( EvtGeneric &rEvt, CtrlGeneric &rCtrl );
+        /// Resize the window
+        virtual void resize( int width, int height );
+
+        /// 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"; }
 
-        // Show the window
-        virtual void show();
+    protected:
+        /// Get the OS window
+        OSWindow *getOSWindow() const { return m_pOsWindow; }
 
-        // Hide the window
-        virtual void hide();
+        /// 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;
 
-        // Refresh an area of the window
-        virtual void refresh( int left, int top, int width, int height );
+        /// 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;
 
@@ -90,76 +105,25 @@ class GenericWindow: public SkinObject, public Observer<VarBool>
 
         /// Toggle the window on top
         virtual void toggleOnTop( bool onTop ) const;
+        //@}
 
-        /// Change the active layout
-        virtual void setActiveLayout( GenericLayout *pLayout );
-
-        /// Update the shape of the window from the active layout
-        virtual void updateShape();
-
-        /// Called by a control that wants to capture the mouse
-        virtual void onControlCapture( const CtrlGeneric &rCtrl );
-
-        /// Called by a control that wants to release the mouse
-        virtual void onControlRelease( const CtrlGeneric &rCtrl );
-
-        /// Called by a control when its tooltip changed
-        virtual void onTooltipChange( const CtrlGeneric &rCtrl );
-
-        /// 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; }
-
-        /// Get the list of the anchors of this window
-        virtual const list<Anchor*> getAnchorList() const;
+        /// Actually show the window
+        virtual void innerShow();
 
-        /// Add an anchor to this window
-        virtual void addAnchor( Anchor *pAnchor );
+        /// Actually hide the window
+        virtual void innerHide();
 
     private:
-        /// Window manager
-        WindowManager &m_rWindowManager;
         /// Window position and size
         int m_left, m_top, m_width, m_height;
         /// OS specific implementation
         OSWindow *m_pOsWindow;
-        /// Current active layout of the window
-        GenericLayout *m_pActiveLayout;
-        /// Last control on which the mouse was over
-        CtrlGeneric *m_pLastHitControl;
-        /// Control that has captured the mouse
-        CtrlGeneric *m_pCapturingControl;
-        /// Control that has the focus
-        CtrlGeneric *m_pFocusControl;
-        /// List of the anchors of this window
-        list<Anchor*> m_anchorList;
         /// 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 );
-
-        // Actually show the window
-        virtual void innerShow();
-
-        // Actually hide the window
-        virtual void innerHide();
-
-        /// Find the uppest control in the layout hit by the mouse, and send
-        /// it an enter event if needed
-        CtrlGeneric *findHitControl( int xPos, int yPos );
-
-        /// Update the lastHitControl pointer and send a leave event to the
-        /// right control
-        void setLastHit( CtrlGeneric *pNewHitControl );
+        virtual void onUpdate( Subject<VarBool> &rVariable , void*);
 };
 
-typedef CountedPtr<GenericWindow> GenericWindowPtr;
-
 
 #endif