Ejemplo n.º 1
0
void setBarState(bool bAnimate = false)
{
    if ((dock->getState() == ABE_FLOAT) || !pMain->isVisible()){
        appBarMessage(ABM_SETPOS, ABE_FLOAT, FALSE);
    }else{
        if (dock->getAutoHide() && !appBarMessage(ABM_SETAUTOHIDEBAR, dock->getState(), TRUE, NULL)){
            dock->setAutoHide(false);
            QMessageBox::warning(NULL, i18n("Error"),
                                 i18n("There is already an auto hidden window on this edge.\nOnly one auto hidden window is allowed on each edge."),
                                 QMessageBox::Ok, 0);
        }
        QRect rc;
        getBarRect(dock->getState(), rc);
        if (dock->getAutoHide()){
            QRect rcAutoHide = rc;
            int w = 4 * GetSystemMetrics(SM_CXBORDER);
            if (dock->getState() == ABE_LEFT){
                rcAutoHide.setRight(rcAutoHide.left() + w);
            }else{
                rcAutoHide.setLeft(rcAutoHide.right() - w);
            }
            appBarMessage(ABM_SETPOS, dock->getState(), FALSE, &rcAutoHide);
            if (!bAutoHideVisible){
                if (bOldVisible)
                    dock->setWidth(rc.width() - GetSystemMetrics(SM_CXBORDER) * 2);
                MINMAXINFO mmInfo;
                rc = rcAutoHide;
                SendMessageA(pMain->winId(), WM_GETMINMAXINFO, 0, (LPARAM)&mmInfo);
                if (dock->getState() == ABE_LEFT){
                    rc.setLeft(rc.right() - mmInfo.ptMinTrackSize.x);
                }else{
                    rc.setRight(rc.left() + mmInfo.ptMinTrackSize.x);
                }
            }else{
                if (dock->getState() == ABE_LEFT){
                    rc.setRight(rc.left() + dock->getWidth());
                }else{
                    rc.setLeft(rc.right() - dock->getWidth());
                }
            }
            bOldVisible = bAutoHideVisible;
        }else{
            appBarMessage(ABM_SETPOS, dock->getState(), FALSE, &rc);
        }
        slideWindow(rc, bAnimate);
    }
    if (pMain->isVisible()){
        Event eOnTop(EventOnTop, (void*)bFullScreen);
        eOnTop.process();
        if (!bFullScreen && (qApp->activeWindow() == pMain))
            appBarMessage(ABM_ACTIVATE);
    }
}
Ejemplo n.º 2
0
void setBarState(bool bAnimate = false)
{
    if ((dock->getState() == ABE_FLOAT) || !pMain->isVisible()){
        appBarMessage(ABM_SETPOS, dock->getState(), FALSE);
    }else{
        if (dock->getAutoHide() && !appBarMessage(ABM_SETAUTOHIDEBAR, dock->getState(), TRUE, NULL)){
            dock->setAutoHide(false);
            QMessageBox::warning(NULL, i18n("Error"),
                                 i18n("There is already an auto hidden window on this edge.\nOnly one auto hidden window is allowed on each edge."),
                                 QMessageBox::Ok, 0);
        }
        QRect rc;
        getBarRect(dock->getState(), rc);
        if (dock->getAutoHide()){
            QRect rcAutoHide = rc;
            int w = 4 * GetSystemMetrics(SM_CXBORDER);
            if (dock->getState() == ABE_LEFT){
                rcAutoHide.setRight(rcAutoHide.left() + w);
            }else{
                rcAutoHide.setLeft(rcAutoHide.right() - w);
            }
            appBarMessage(ABM_SETPOS, dock->getState(), FALSE, &rcAutoHide);
            if (!bAutoHideVisible)
                rc = rcAutoHide;
        }else{
            appBarMessage(ABM_SETPOS, dock->getState(), FALSE, &rc);
        }
        slideWindow(rc, bAnimate);
    }
    if (pMain->isVisible()){
        Event eOnTop(EventOnTop, (void*)bFullScreen);
        eOnTop.process();
        if (!bFullScreen && (qApp->activeWindow() == pMain))
            appBarMessage(ABM_ACTIVATE);
    }
}