/*****************************************************************************
* window_manager.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 WINDOW_MANAGER_HPP
#define WINDOW_MANAGER_HPP
#include "skin_common.hpp"
-#include "generic_window.hpp"
+#include "top_window.hpp"
+#include "../utils/position.hpp"
#include <list>
#include <map>
#include <set>
class GenericFont;
+class GenericLayout;
class Anchor;
class Tooltip;
+class Popup;
/// Window manager for skin windows
class WindowManager: public SkinObject
{
public:
+ /// Direction of the resizing
+ enum Direction_t
+ {
+ kResizeE, // East
+ kResizeSE, // South-East
+ kResizeS, // South
+ kNone // Reserved for internal use
+ };
+
/// Constructor
WindowManager( intf_thread_t *pIntf);
/// Destructor
virtual ~WindowManager();
- /// Add a window to the list of known windows. Necessary if you want
- /// your window to be movable...
- void registerWindow( GenericWindow &rWindow );
+ /**
+ * Add a window to the list of known windows. Necessary if you want
+ * your window to be movable...
+ */
+ void registerWindow( TopWindow &rWindow );
/// Remove a previously registered window
- void unregisterWindow( GenericWindow &rWindow );
+ void unregisterWindow( TopWindow &rWindow );
- /// Tell the window manager that a move is initiated for pWindow.
- void startMove( GenericWindow &rWindow );
+ /// Tell the window manager that a move is initiated for rWindow
+ void startMove( TopWindow &rWindow );
- /// Tell the window manager that the current move ended.
+ /// Tell the window manager that the current move ended
void stopMove();
- /// Move the pWindow window to (left, top), and move all its
- /// anchored windows.
- /// If a new anchoring is detected, the windows will move accordingly.
- void move( GenericWindow &rWindow, int left, int top ) const;
+ /**
+ * Move the rWindow window to (left, top), and move all its
+ * anchored windows.
+ * If a new anchoring is detected, the windows will move accordingly.
+ */
+ void move( TopWindow &rWindow, int left, int top ) const;
+
+ /// Tell the window manager that a resize is initiated for rLayout
+ void startResize( GenericLayout &rLayout, Direction_t direction );
+
+ /// Tell the window manager that the current resizing ended
+ void stopResize();
+
+ /**
+ * Resize the rLayout layout to (width, height), and move all its
+ * anchored windows, if some anchors are moved during the resizing.
+ * If a new anchoring is detected, the windows will move (or resize)
+ * accordingly.
+ */
+ void resize( GenericLayout &rLayout, int width, int height ) const;
- /// Raise all the windows, rWindow being above the others
- void raiseAll( GenericWindow &rWindow ) const;
+ /// Maximize the given window
+ void maximize( TopWindow &rWindow );
+
+ /// Unmaximize the given window
+ void unmaximize( TopWindow &rWindow );
+
+ /// 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;
+
+ /// Save the current visibility of the windows
+ void saveVisibility();
+
+ /// Restore the saved visibility of the windows
+ void restoreVisibility() const;
+
+ /// Raise the given window
+ void raise( TopWindow &rWindow ) const { rWindow.raise(); }
+
/// Show the given window
- void show( GenericWindow &rWindow ) { rWindow.show(); }
+ void show( TopWindow &rWindow ) const { rWindow.show(); }
/// Hide the given window
- void hide( GenericWindow &rWindow ) { rWindow.hide(); }
+ void hide( TopWindow &rWindow ) const { rWindow.hide(); }
/// Toggle all the windows on top
void toggleOnTop();
/// Hide the tooltip window
void hideTooltip();
+ /// Add a layout of the given window. This new layout will be the
+ /// active one.
+ void addLayout( TopWindow &rWindow, GenericLayout &rLayout );
+
+ /// 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<GenericWindow*> WinSet_t;
+ 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...)
- map<GenericWindow*, WinSet_t> m_dependencies;
+ /// 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;
- /// Store the moving windows; this set is updated at every start of
- /// move.
+ /**
+ * Store the windows that were visible when saveVisibility() was
+ * last called.
+ */
+ WinSet_t m_savedWindows;
+ /// Store the moving windows
+ /**
+ * This set is updated at every start of move.
+ */
WinSet_t m_movingWindows;
+ /**
+ * Store the moving windows in the context of resizing
+ * These sets are updated at every start of move
+ */
+ //@{
+ WinSet_t m_resizeMovingE;
+ WinSet_t m_resizeMovingS;
+ WinSet_t m_resizeMovingSE;
+ //@}
/// 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
int m_alpha;
/// Alpha value of the moving windows
int m_moveAlpha;
+ /// Direction of the current resizing
+ Direction_t m_direction;
+ /// Rect of the last maximized window
+ SkinsRect m_maximizeRect;
/// 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, GenericWindow *pWindow );
-
- /// Check anchoring: this function updates xOffset and yOffset,
- /// to take care of a new anchoring (if any)
- void checkAnchors( GenericWindow *pWindow,
+ void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow );
+
+ /// 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;
};