00001 /***************************************************************************** 00002 * window_manager.hpp 00003 ***************************************************************************** 00004 * Copyright (C) 2003 the VideoLAN team 00005 * $Id: window_manager.hpp 12912 2005-10-22 11:57:29Z asmax $ 00006 * 00007 * Authors: Cyril Deguet <[email protected]> 00008 * Olivier Teulière <[email protected]> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00023 *****************************************************************************/ 00024 00025 #ifndef WINDOW_MANAGER_HPP 00026 #define WINDOW_MANAGER_HPP 00027 00028 #include "skin_common.hpp" 00029 #include "top_window.hpp" 00030 #include <list> 00031 #include <map> 00032 #include <set> 00033 #include <utility> 00034 00035 00036 class GenericFont; 00037 class GenericLayout; 00038 class Anchor; 00039 class Tooltip; 00040 00041 00043 class WindowManager: public SkinObject 00044 { 00045 public: 00047 WindowManager( intf_thread_t *pIntf); 00048 00050 virtual ~WindowManager(); 00051 00054 void registerWindow( TopWindow &rWindow ); 00055 00057 void unregisterWindow( TopWindow &rWindow ); 00058 00060 void startMove( TopWindow &rWindow ); 00061 00063 void stopMove(); 00064 00068 void move( TopWindow &rWindow, int left, int top ) const; 00069 00071 void raiseAll() const; 00072 00074 void showAll(bool firstTime = false) const; 00075 00077 void hideAll() const; 00078 00080 void synchVisibility() const; 00081 00083 void raise( TopWindow &rWindow ) const { rWindow.raise(); } 00084 00086 void show( TopWindow &rWindow ) const { rWindow.show(); } 00087 00089 void hide( TopWindow &rWindow ) const { rWindow.hide(); } 00090 00092 void toggleOnTop(); 00093 00095 void setMagnetValue( int magnet ) { m_magnet = magnet; } 00096 00098 void setAlphaValue( int alpha ) { m_alpha = alpha; } 00099 00101 void setMoveAlphaValue( int moveAlpha ) { m_moveAlpha = moveAlpha; } 00102 00104 void createTooltip( const GenericFont &rTipFont ); 00105 00107 void showTooltip(); 00108 00110 void hideTooltip(); 00111 00114 void addLayout( TopWindow &rWindow, GenericLayout &rLayout ); 00115 00117 void setActiveLayout( TopWindow &rWindow, GenericLayout &rLayout ); 00118 00119 private: 00121 typedef set<TopWindow*> WinSet_t; 00122 typedef list<Anchor*> AncList_t; 00123 00129 map<TopWindow*, WinSet_t> m_dependencies; 00131 WinSet_t m_allWindows; 00134 WinSet_t m_movingWindows; 00136 VariablePtr m_cVarOnTop; 00138 int m_magnet; 00140 int m_alpha; 00142 int m_moveAlpha; 00144 Tooltip *m_pTooltip; 00145 00147 void buildDependSet( WinSet_t &rWinSet, TopWindow *pWindow ); 00148 00151 void checkAnchors( TopWindow *pWindow, 00152 int &xOffset, int &yOffset ) const; 00153 }; 00154 00155 00156 #endif