]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/window_manager.hpp
* skins2: support for custom popup menus, and win32 implementation.
[vlc] / modules / gui / skins2 / src / window_manager.hpp
index fb14f6a5afcb746f4e07edda7ecb73ae41cff37f..0737b90b46cd52065787a1824719e4df48b56733 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * window_manager.hpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
@@ -37,6 +37,7 @@ class GenericFont;
 class GenericLayout;
 class Anchor;
 class Tooltip;
+class Popup;
 
 
 /// Window manager for skin windows
@@ -67,20 +68,26 @@ class WindowManager: public SkinObject
         /// If a new anchoring is detected, the windows will move accordingly.
         void move( TopWindow &rWindow, int left, int top ) const;
 
-        /// Raise all the windows, rWindow being above the others
-        void raiseAll( TopWindow &rWindow ) const;
+        /// Raise all the registered windows
+        void raiseAll() const;
 
         /// Show all the registered windows
-        void showAll() const;
+        void showAll(bool firstTime = false) const;
 
         /// Hide all the registered windows
         void hideAll() const;
 
+        /// Synchronize the windows with their visibility variable
+        void synchVisibility() const;
+
+        /// Raise the given window
+        void raise( TopWindow &rWindow ) const { rWindow.raise(); }
+
         /// Show the given window
-        void show( TopWindow &rWindow ) { rWindow.show(); }
+        void show( TopWindow &rWindow ) const { rWindow.show(); }
 
         /// Hide the given window
-        void hide( TopWindow &rWindow ) { rWindow.hide(); }
+        void hide( TopWindow &rWindow ) const { rWindow.hide(); }
 
         /// Toggle all the windows on top
         void toggleOnTop();
@@ -110,16 +117,25 @@ class WindowManager: public SkinObject
         /// Change the active layout of the given window
         void setActiveLayout( TopWindow &rWindow, GenericLayout &rLayout );
 
+        /// Mark the given popup as active
+        void setActivePopup( Popup &rPopup ) { m_pPopup = &rPopup; }
+
+        /// Return the active popup, or NULL if none is active
+        Popup * getActivePopup() const { return m_pPopup; }
+
     private:
         /// Some useful typedefs for lazy people like me
         typedef set<TopWindow*> WinSet_t;
         typedef list<Anchor*> AncList_t;
 
-        /// This map represents the graph of anchored windows: it associates
-        /// to a given window all the windows that are directly anchored by it.
-        /// This is not transitive, i.e. if a is in m_dep[b] and if b is in
-        /// m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
-        /// would be extremely rare...)
+        /// Dependencies map
+        /**
+         * This map represents the graph of anchored windows: it associates
+         * to a given window all the windows that are directly anchored by it.
+         * This is not transitive, i.e. if a is in m_dep[b] and if b is in
+         * m_dep[c], it doesn't mean that a is in m_dep[c] (in fact, it
+         * would be extremely rare...)
+         */
         map<TopWindow*, WinSet_t> m_dependencies;
         /// Store all the windows
         WinSet_t m_allWindows;
@@ -127,7 +143,7 @@ class WindowManager: public SkinObject
         /// move.
         WinSet_t m_movingWindows;
         /// Indicate whether the windows are currently on top
-        bool m_isOnTop;
+        VariablePtr m_cVarOnTop;
         /// Magnetism of the screen edges (= scope of action)
         int m_magnet;
         /// Alpha value of the static windows
@@ -136,12 +152,17 @@ class WindowManager: public SkinObject
         int m_moveAlpha;
         /// Tooltip
         Tooltip *m_pTooltip;
+        /// Active popup, if any
+        Popup *m_pPopup;
 
         /// Recursively build a set of windows anchored to the one given.
         void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow );
 
-        /// Check anchoring: this function updates xOffset and yOffset,
-        /// to take care of a new anchoring (if any)
+        /// Check anchoring
+        /**
+         * This function updates xOffset and yOffset, to take care of a new
+         * anchoring (if any)
+         */
         void checkAnchors( TopWindow *pWindow,
                            int &xOffset, int &yOffset ) const;
 };