#include "anchor.hpp"
#include "tooltip.hpp"
#include "var_manager.hpp"
-#include "../utils/position.hpp"
WindowManager::WindowManager( intf_thread_t *pIntf ):
SkinObject( pIntf ), m_magnet( 0 ), m_direction( kNone ),
+ m_maximizeRect(0, 0, 50, 50),
m_pTooltip( NULL ), m_pPopup( NULL )
{
// Create and register a variable for the "on top" status
m_movingWindows.clear();
buildDependSet( m_movingWindows, &rWindow );
-#ifdef WIN32
if( config_GetInt( getIntf(), "skins2-transparency" ) )
{
// Change the opacity of the moving windows
(*it)->refresh( 0, 0, (*it)->getWidth(), (*it)->getHeight() );
}
}
-#endif
}
WinSet_t::const_iterator itWin1, itWin2;
AncList_t::const_iterator itAnc1, itAnc2;
-#ifdef WIN32
if( config_GetInt( getIntf(), "skins2-transparency" ) )
{
// Restore the opacity of the moving windows
(*it)->setOpacity( m_alpha );
}
}
-#endif
// Delete the dependencies
m_dependencies.clear();
}
+void WindowManager::maximize( TopWindow &rWindow )
+{
+ // Save the current position/size of the window, to be able to restore it
+ m_maximizeRect = SkinsRect( rWindow.getLeft(), rWindow.getTop(),
+ rWindow.getLeft() + rWindow.getWidth(),
+ rWindow.getTop() + rWindow.getHeight() );
+
+ SkinsRect workArea = OSFactory::instance( getIntf() )->getWorkArea();
+ // Move the window
+ startMove( rWindow );
+ move( rWindow, workArea.getLeft(), workArea.getTop() );
+ stopMove();
+ // Now resize it
+ // FIXME: Ugly const_cast
+ GenericLayout &rLayout = (GenericLayout&)rWindow.getActiveLayout();
+ startResize( rLayout, kResizeSE );
+ resize( rLayout, workArea.getWidth(), workArea.getHeight() );
+ stopResize();
+ rWindow.m_pVarMaximized->set( true );
+
+ // Make the window unmovable by unregistering it
+// unregisterWindow( rWindow );
+}
+
+
+void WindowManager::unmaximize( TopWindow &rWindow )
+{
+ // Register the window to allow moving it
+// registerWindow( rWindow );
+
+ // Resize the window
+ // FIXME: Ugly const_cast
+ GenericLayout &rLayout = (GenericLayout&)rWindow.getActiveLayout();
+ startResize( rLayout, kResizeSE );
+ resize( rLayout, m_maximizeRect.getWidth(), m_maximizeRect.getHeight() );
+ stopResize();
+ // Now move it
+ startMove( rWindow );
+ move( rWindow, m_maximizeRect.getLeft(), m_maximizeRect.getTop() );
+ stopMove();
+ rWindow.m_pVarMaximized->set( false );
+}
+
+
void WindowManager::synchVisibility() const
{
WinSet_t::const_iterator it;
{
(*it)->show();
}
- (*it)->setOpacity( m_alpha );
}
}
AncList_t::const_iterator itAncMov, itAncSta;
// Check magnetism with screen edges first (actually it is the work area)
- Rect workArea = OSFactory::instance( getIntf() )->getWorkArea();
+ SkinsRect workArea = OSFactory::instance( getIntf() )->getWorkArea();
// Iterate through the moving windows
for( itMov = m_movingWindows.begin();
itMov != m_movingWindows.end(); itMov++ )
{
yOffset = workArea.getTop() - (*itMov)->getTop();
}
- if( newLeft + (*itMov)->getWidth() > workArea.getRight() - m_magnet &&
- newLeft + (*itMov)->getWidth() < workArea.getRight() + m_magnet )
+ int right = workArea.getLeft() + workArea.getWidth();
+ if( newLeft + (*itMov)->getWidth() > right - m_magnet &&
+ newLeft + (*itMov)->getWidth() < right + m_magnet )
{
- xOffset = workArea.getRight() - (*itMov)->getLeft()
- - (*itMov)->getWidth();
+ xOffset = right - (*itMov)->getLeft() - (*itMov)->getWidth();
}
- if( newTop + (*itMov)->getHeight() > workArea.getBottom() - m_magnet &&
- newTop + (*itMov)->getHeight() < workArea.getBottom() + m_magnet )
+ int bottom = workArea.getTop() + workArea.getHeight();
+ if( newTop + (*itMov)->getHeight() > bottom - m_magnet &&
+ newTop + (*itMov)->getHeight() < bottom + m_magnet )
{
- yOffset = workArea.getBottom() - (*itMov)->getTop()
- - (*itMov)->getHeight();
+ yOffset = bottom - (*itMov)->getTop() - (*itMov)->getHeight();
}
}
// Rebuild the dependencies
stopMove();
}
+