Example #1
0
void FxWidget::setSystemTitleBar(bool flag)
{
    FX_FUNCTION
    bool isvisible = isVisible();

#ifdef Q_OS_MAC
    setWindowFlags(windowFlags() ^ Qt::FramelessWindowHint);
    setWindowFlags(windowFlags() ^ Qt::WindowSystemMenuHint);

    enableAutoHide(false);
    titleBar->hide();
    sideBarRL->hide();
    sideBarTB->hide();
    if (isvisible)
    {
	    showNormal();
    }
    return;
#endif

    if (_isSetSystemTitleBar == flag)
    {
        setBackground(backgroundPixmap);
        return;
    }

    _isSetSystemTitleBar = flag;
    if (flag)
    {
        setWindowFlags(windowFlags() ^ Qt::FramelessWindowHint);
        setWindowFlags(windowFlags() ^ Qt::WindowSystemMenuHint);

        enableAutoHide(false);
        titleBar->hide();
        sideBarRL->hide();
        sideBarTB->hide();
    }
    else
    {
        //setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
        //setWindowFlags(windowFlags() | Qt::WindowSystemMenuHint);
        /** I don't know why need to do as following... */
        setWindowFlags(Qt::Window | Qt::FramelessWindowHint
                | Qt::WindowSystemMenuHint);

        enableAutoHide(true);
        titleBar->show();
        sideBarRL->show();
        sideBarTB->show();
    }

    if (isvisible)
    {
        showNormal();
    }
    setBackground(backgroundPixmap);
}
Example #2
0
void *WinDockPlugin::processEvent(Event *e)
{
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdAutoHide){
            dock->setAutoHide((cmd->flags & COMMAND_CHECKED) != 0);
            bAutoHideVisible = true;
            setBarState();
            enableAutoHide(getAutoHide());
            return cmd;
        }
    }
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdAutoHide) && (dock->getState() != ABE_FLOAT)){
            cmd->flags &= ~COMMAND_CHECKED;
            if (dock->getAutoHide())
                cmd->flags |= COMMAND_CHECKED;
            return cmd;
        }
    }
    if ((e->type() == EventInit) && !m_bInit)
        init();
    if (e->type() == EventInTaskManager){
        if ((dock->getState() != ABE_FLOAT) && e->param()){
            Event eMy(EventInTaskManager, (void*)false);
            eMy.process();
            return e->param();
        }
    }
    return NULL;
}
Example #3
0
void WinDockPlugin::slotAutoHide()
{
    if (pMain->isActiveWindow())
        return;
    DWORD pos = GetMessagePos();
    int x = GET_X_LPARAM(pos);
    int y = GET_Y_LPARAM(pos);
    RECT rc;
    GetWindowRect(pMain->winId(), &rc);
    rc.left  -= GetSystemMetrics(SM_CXDOUBLECLK) * 2;
    rc.right += GetSystemMetrics(SM_CXDOUBLECLK) * 2;
    if ((x >= rc.left) && (x <= rc.right) && (y >= rc.top) && (y <= rc.bottom)) return;
    if ((getState() != ABE_FLOAT) && getAutoHide() && bAutoHideVisible){
        bAutoHideVisible = false;
        setBarState(true);
        enableAutoHide(false);
    }
}