⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window_manager.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    {        for( it = m_resizeMovingS.begin(); it != m_resizeMovingS.end(); it++ )        {            (*it)->move( (*it)->getLeft(),                         (*it)->getTop( )+ yNewOffset );        }    }    if( m_direction == kResizeE ||        m_direction == kResizeS ||        m_direction == kResizeSE )    {        for( it = m_resizeMovingSE.begin(); it != m_resizeMovingSE.end(); it++ )        {            (*it)->move( (*it)->getLeft() + xNewOffset,                         (*it)->getTop() + yNewOffset );        }    }}void WindowManager::synchVisibility() const{    WinSet_t::const_iterator it;    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        // Show the window if it has to be visible        if( (*it)->getVisibleVar().get() )        {            (*it)->innerShow();        }    }}void WindowManager::saveVisibility(){    WinSet_t::const_iterator it;    m_savedWindows.clear();    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        // Remember the window if it is visible        if( (*it)->getVisibleVar().get() )        {            m_savedWindows.insert( *it );        }    }}void WindowManager::restoreVisibility() const{    // Warning in case we never called saveVisibility()    if( m_savedWindows.size() == 0 )    {        msg_Warn( getIntf(), "restoring visibility for no window" );    }    WinSet_t::const_iterator it;    for( it = m_savedWindows.begin(); it != m_savedWindows.end(); it++)    {        (*it)->show();    }}void WindowManager::raiseAll() const{    // Raise all the windows    WinSet_t::const_iterator it;    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        (*it)->raise();    }}void WindowManager::showAll( bool firstTime ) const{    // Show all the windows    WinSet_t::const_iterator it;    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        // When the theme is opened for the first time,        // only show the window if set as visible in the XML        if( (*it)->isVisible() || !firstTime )        {            (*it)->show();        }        (*it)->setOpacity( m_alpha );    }}void WindowManager::hideAll() const{    WinSet_t::const_iterator it;    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        (*it)->hide();    }}void WindowManager::toggleOnTop(){    // Update the boolean variable    VarBoolImpl *pVarOnTop = (VarBoolImpl*)m_cVarOnTop.get();    pVarOnTop->set( !pVarOnTop->get() );    // Toggle the "on top" status    WinSet_t::const_iterator it;    for( it = m_allWindows.begin(); it != m_allWindows.end(); it++ )    {        (*it)->toggleOnTop( pVarOnTop->get() );    }}void WindowManager::buildDependSet( WinSet_t &rWinSet,                                    TopWindow *pWindow ){    // pWindow is in the set    rWinSet.insert( pWindow );    // Iterate through the anchored windows    const WinSet_t &anchored = m_dependencies[pWindow];    WinSet_t::const_iterator iter;    for( iter = anchored.begin(); iter != anchored.end(); iter++ )    {        // Check that the window isn't already in the set before adding it        if( rWinSet.find( *iter ) == rWinSet.end() )        {            buildDependSet( rWinSet, *iter );        }    }}void WindowManager::checkAnchors( TopWindow *pWindow,                                  int &xOffset, int &yOffset ) const{    WinSet_t::const_iterator itMov, itSta;    AncList_t::const_iterator itAncMov, itAncSta;    // Check magnetism with screen edges first (actually it is the work area)    Rect workArea = OSFactory::instance( getIntf() )->getWorkArea();    // Iterate through the moving windows    for( itMov = m_movingWindows.begin();         itMov != m_movingWindows.end(); itMov++ )    {        // Skip the invisible windows        if( ! (*itMov)->getVisibleVar().get() )        {            continue;        }        int newLeft = (*itMov)->getLeft() + xOffset;        int newTop = (*itMov)->getTop() + yOffset;        if( newLeft > workArea.getLeft() - m_magnet &&            newLeft < workArea.getLeft() + m_magnet )        {            xOffset = workArea.getLeft() - (*itMov)->getLeft();        }        if( newTop > workArea.getTop() - m_magnet &&            newTop < workArea.getTop() + m_magnet )        {            yOffset = workArea.getTop() - (*itMov)->getTop();        }        if( newLeft + (*itMov)->getWidth() > workArea.getRight() - m_magnet &&            newLeft + (*itMov)->getWidth() < workArea.getRight() + m_magnet )        {            xOffset = workArea.getRight() - (*itMov)->getLeft()                      - (*itMov)->getWidth();        }        if( newTop + (*itMov)->getHeight() > workArea.getBottom() - m_magnet &&            newTop + (*itMov)->getHeight() <  workArea.getBottom() + m_magnet )        {            yOffset =  workArea.getBottom() - (*itMov)->getTop()                       - (*itMov)->getHeight();        }    }    // Iterate through the moving windows    for( itMov = m_movingWindows.begin();         itMov != m_movingWindows.end(); itMov++ )    {        // Skip the invisible windows        if( ! (*itMov)->getVisibleVar().get() )        {            continue;        }        // Get the anchors in the main layout of this moving window        const AncList_t &movAnchors =            (*itMov)->getActiveLayout().getAnchorList();        // Iterate through the static windows        for( itSta = m_allWindows.begin();             itSta != m_allWindows.end(); itSta++ )        {            // Skip the moving windows and the invisible ones            if( m_movingWindows.find( (*itSta) ) != m_movingWindows.end() ||                ! (*itSta)->getVisibleVar().get() )            {                continue;            }            // Get the anchors in the main layout of this static window            const AncList_t &staAnchors =                (*itSta)->getActiveLayout().getAnchorList();            // Check if there is an anchoring between one of the movAnchors            // and one of the staAnchors            for( itAncMov = movAnchors.begin();                 itAncMov != movAnchors.end(); itAncMov++ )            {                for( itAncSta = staAnchors.begin();                     itAncSta != staAnchors.end(); itAncSta++ )                {                    if( (*itAncSta)->canHang( **itAncMov, xOffset, yOffset ) )                    {                        // We have found an anchoring!                        // There is nothing to do here, since xOffset and                        // yOffset are automatically modified by canHang()                        // Don't check the other anchors, one is enough...                        return;                    }                    else                    {                        // Temporary variables                        int xOffsetTemp = -xOffset;                        int yOffsetTemp = -yOffset;                        if( (*itAncMov)->canHang( **itAncSta, xOffsetTemp,                                                  yOffsetTemp ) )                        {                            // We have found an anchoring!                            // xOffsetTemp and yOffsetTemp have been updated,                            // we just need to change xOffset and yOffset                            xOffset = -xOffsetTemp;                            yOffset = -yOffsetTemp;                            // Don't check the other anchors, one is enough...                            return;                        }                    }                }            }        }    }}void WindowManager::createTooltip( const GenericFont &rTipFont ){    // Create the tooltip window    if( !m_pTooltip )    {        m_pTooltip = new Tooltip( getIntf(), rTipFont, 500 );    }    else    {        msg_Warn( getIntf(), "tooltip already created!" );    }}void WindowManager::showTooltip(){    if( m_pTooltip )    {        m_pTooltip->show();    }}void WindowManager::hideTooltip(){    if( m_pTooltip )    {        m_pTooltip->hide();    }}void WindowManager::addLayout( TopWindow &rWindow, GenericLayout &rLayout ){    rWindow.setActiveLayout( &rLayout );}void WindowManager::setActiveLayout( TopWindow &rWindow,                                     GenericLayout &rLayout ){    rWindow.setActiveLayout( &rLayout );    // Rebuild the dependencies    stopMove();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -