void UserTabBar::mousePressEvent(QMouseEvent *e)
{
    if (e->button() == RightButton){
        QTab *t = selectTab(e->pos());
        if (t == NULL) return;
        UserTab *tab = static_cast<UserTab*>(t);

        EventMenuProcess eMenu(MenuContact, (void*)tab->wnd()->id());
        eMenu.process();
        QPopupMenu *menu = eMenu.menu();
        if (menu)
            menu->popup(e->globalPos());
        return;
    }
    if (e->button() == MidButton){
        //Close tab on middle button pressed
        QTab *t = selectTab(e->pos());
        if (t == NULL) return;
        UserTab *tab = static_cast<UserTab*>(t);
        Command cmd;
        cmd->id = CmdClose;
        cmd->param = (void*)tab->wnd()->id();
        EventCommandExec(cmd).process();
    }
    QTabBar::mousePressEvent(e);
}
Beispiel #2
0
bool UserTabBar::isBold(UserWnd *wnd)
{
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab->wnd() == wnd)
            return tab->isBold();
    }
    return false;
}
Beispiel #3
0
void UserTabBar::raiseTab(unsigned id)
{
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab->wnd()->id() == id){
            setCurrentTab(tab);
            return;
        }
    }
}
Beispiel #4
0
UserWnd *UserTabBar::wnd(unsigned id)
{
    layoutTabs();
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab->wnd()->id() == id)
            return tab->wnd();
    }
    return NULL;
}
Beispiel #5
0
void UserTabBar::setBold(unsigned id, bool bBold)
{
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab->wnd()->id() == id){
            if (tab->setBold(bBold))
                repaint();
            break;
        }
    }
}
Beispiel #6
0
void UserTabBar::changeTab(unsigned id)
{
    layoutTabs();
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab->wnd()->id() == id){
            tab->setText(tab->wnd()->getName());
            break;
        }
    }
}
Beispiel #7
0
list<UserWnd*> UserTabBar::windows()
{
    list<UserWnd*> res;
    unsigned n = count();
    for (unsigned i = 0; n > 0; i++){
        UserTab *t = static_cast<UserTab*>(tab(i));
        if (t == NULL)
            continue;
        res.push_back(t->wnd());
        n--;
    }
    return res;
}
Beispiel #8
0
void UserTabBar::removeTab(unsigned id)
{
    layoutTabs();
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab == NULL)
            continue;
        if (tab->wnd()->id() == id){
            QTabBar::removeTab(tab);
            break;
        }
    }
}
Beispiel #9
0
void UserTabBar::removeTab(unsigned id)
{
    layoutTabs();
    QList<QTab> *tList = tabList();
    for (QTab *t = tList->first(); t; t = tList->next()){
        UserTab *tab = static_cast<UserTab*>(t);
        if (tab == NULL)
            continue;
        if (tab->wnd()->id() == id){
            QTabBar::removeTab(tab);
            QTimer::singleShot(0, this, SLOT(slotRepaint()));
            break;
        }
    }
}
Beispiel #10
0
void UserTabBar::mousePressEvent(QMouseEvent *e)
{
    if (e->button() == RightButton){
        QTab *t = selectTab(e->pos());
        if (t == NULL) return;
        UserTab *tab = static_cast<UserTab*>(t);
        ProcessMenuParam mp;
        mp.id = MenuContact;
        mp.param = (void*)(tab->wnd()->id());
        mp.key = 0;
        Event eMenu(EventProcessMenu, &mp);
        QPopupMenu *menu = (QPopupMenu*)eMenu.process();
        if (menu)
            menu->popup(e->globalPos());
        return;
    }
    QTabBar::mousePressEvent(e);
}