Esempio n. 1
0
void KMdiDockContainer::toggle()
{
	kdDebug( 760 ) << k_funcinfo << endl;

	if ( m_tb->isTabRaised( oldtab ) )
	{
		kdDebug( 760 ) << k_funcinfo << "lowering tab" << endl;
		m_tb->setTab( oldtab, false );
		tabClicked( oldtab );
		KMdiMainFrm *mainFrm = tqt_dynamic_cast<KMdiMainFrm*>( m_mainWin );
		if ( mainFrm && mainFrm->activeWindow() )
			mainFrm->activeWindow()->setFocus();
	}
	else
	{
		kdDebug( 760 ) << k_funcinfo << "raising tab" << endl;
		if ( m_tb->tab( m_previousTab ) == 0 )
		{
			if ( m_tb->tabs() ->count() == 0 )
				return ;

			m_previousTab = m_tb->tabs() ->getFirst() ->id();
		}
		m_tb->setTab( m_previousTab, true );
		tabClicked( m_previousTab );
	}
}
Esempio n. 2
0
/**
 * \brief Handle the mouse release event
 * @param event as the mouse event
 */
void UBDockPalette::mouseReleaseEvent(QMouseEvent *event)
{
    Q_UNUSED(event);
    if(!mResized && mClickTime.elapsed() < CLICKTIME)
    {
        // If the clicked position is in the tab, perform the related action
        if(eUBDockOrientation_Left == mOrientation)
        {
            if(mMousePressPos.x() >= width() - 2*border() &&
               mMousePressPos.y() >= border() &&
               mMousePressPos.x() <= width() &&
               mMousePressPos.y() <= border() + TABSIZE)
            {
                tabClicked();
            }
        }
        else if(eUBDockOrientation_Right == mOrientation)
        {
            if(mMousePressPos.x() >= 0 &&
               mMousePressPos.x() <= 2*border() &&
               mMousePressPos.y() >= border() &&
               mMousePressPos.y() <= border() + TABSIZE)
            {
                tabClicked();
            }
        }
    }

    mCanResize = false;
}
Esempio n. 3
0
void KMdiDockContainer::removeWidget( KDockWidget* dwdg )
{
	KDockWidget * w = dwdg;
	if ( !m_map.contains( w ) )
		return; //we don't have this widget in our container

	kdDebug( 760 ) << k_funcinfo << endl;
	//lower the tab. ( TODO: needed? )
	int id = m_map[ w ];
	if ( m_tb->isTabRaised( id ) )
	{
		m_tb->setTab( id, false );
		tabClicked( id );
	}

	m_tb->removeTab( id );
	m_ws->removeWidget( w );
	m_map.remove( w );
	m_revMap.remove( id );
	if ( m_overlapButtons.contains( w ) )
	{
		( ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() ) )->removeButton( m_overlapButtons[ w ] );
		m_overlapButtons.remove( w );
	}
	KDockContainer::removeWidget( w );
	itemNames.remove( w->name() );
	tabCaptions.remove( w->name() );
	tabTooltips.remove( w->name() );
	hideIfNeeded();
}
Esempio n. 4
0
void DockContainer::removeWidget(KDockWidget *dwdg)
{
    KDockWidget *w = (KDockWidget *)dwdg;
    if(!m_map.contains(w))
        return;
    int id = m_map[w];
    if(m_tb->isTabRaised(id))
    {
        // why do we hide the tab if we're just going
        // to remove it? - mattr 2004-10-26
        m_tb->setTab(id, false);
        m_tabSwitching = false;
        tabClicked(id);
    }
    m_tb->removeTab(id);
    m_ws->removeWidget(w);
    m_map.remove(w);
    m_revMap.remove(id);
    if(m_overlapButtons.contains(w))
    {
        (static_cast< KDockWidgetHeader * >(w->getHeader()->qt_cast("KDockWidgetHeader")))->removeButton(m_overlapButtons[w]);
        m_overlapButtons.remove(w);
    }
    KDockContainer::removeWidget(w);
    itemNames.remove(w->name());
    tabCaptions.remove(w->name());
    tabTooltips.remove(w->name());
    if(!itemNames.count())
        ((KDockWidget *)parentWidget())->undock();
}
Esempio n. 5
0
void KMdiDockContainer::showWidget( KDockWidget *w )
{
	if ( !m_map.contains( w ) )
		return ;

	int id = m_map[ w ];
	m_tb->setTab( id, true );
	tabClicked( id );
}
Esempio n. 6
0
void DockContainer::showWidget(KDockWidget *w)
{
    if(!m_map.contains(w))
        return;

    kdDebug() << "KMDI::DockContainer::<showWidget" << endl;
    int id = m_map[w];
    m_tb->setTab(id, true);
    tabClicked(id);
}
Esempio n. 7
0
void KMdiDockContainer::undockWidget( KDockWidget *dwdg )
{
	KDockWidget * w = dwdg;

	if ( !m_map.contains( w ) )
		return ;

	int id = m_map[ w ];
	if ( m_tb->isTabRaised( id ) )
	{
		kdDebug( 760 ) << k_funcinfo << "Widget has been undocked, setting tab down" << endl;
		m_tb->setTab( id, false );
		tabClicked( id );
	}
}
Esempio n. 8
0
void DockContainer::nextToolView()
{
    QPtrList< KMultiTabBarTab > *tabs = m_tb->tabs();
    int pos = tabs->findRef(m_tb->tab(oldtab));
    if(pos == -1)
        return;
    pos++;
    if(pos >= (int)tabs->count())
        pos = 0;
    KMultiTabBarTab *tab = tabs->at(pos);
    if(!tab)
        return; // can never happen here, but who knows
    m_tb->setTab(tab->id(), true);
    tabClicked(tab->id());
}
Esempio n. 9
0
void DockContainer::toggle()
{
    kdDebug(760) << "DockContainer:activate" << endl;
    if(m_tb->isTabRaised(oldtab))
    {
        m_tb->setTab(oldtab, false);
        tabClicked(oldtab);
        //    KMDI::MainWindow *mainFrm = dynamic_cast<KMDI::MainWindow*>(m_mainWin);
        //     if (mainFrm && mainFrm->activeWindow() ) // TODO
        //           mainFrm->activeWindow()->setFocus();
    }
    else
    {
        kdDebug(760) << "DockContainer::toggle(): raising tab" << endl;
        if(m_tb->tab(m_previousTab) == 0)
        {
            if(m_tb->tabs()->count() == 0)
                return;
            m_previousTab = m_tb->tabs()->getFirst()->id();
        }
        m_tb->setTab(m_previousTab, true);
        tabClicked(m_previousTab);
    }
}
Esempio n. 10
0
void DockContainer::collapseOverlapped()
{
    if(m_tabSwitching)
        return;
    if(isOverlapMode())
    {
        QPtrList< KMultiTabBarTab > *tl = m_tb->tabs();
        QPtrListIterator< KMultiTabBarTab > it(*tl);
        for(; it.current(); ++it)
        {
            if(it.current()->isOn())
            {
                kdDebug(760) << "Lowering TAB" << endl;
                it.current()->setState(false);
                tabClicked(it.current()->id());
            }
        }
    }
}
Esempio n. 11
0
void KMdiDockContainer::prevToolView()
{
	kdDebug( 760 ) << k_funcinfo << endl;
	TQPtrList<KMultiTabBarTab>* tabs = m_tb->tabs();
	int pos = tabs->findRef( m_tb->tab( oldtab ) );

	if ( pos == -1 )
		return ;

	pos--;
	if ( pos < 0 )
		pos = tabs->count() - 1;

	KMultiTabBarTab *tab = tabs->at( pos );
	if ( !tab )
		return ; //can never happen here, but who knows

	m_tb->setTab( tab->id(), true );
	tabClicked( tab->id() );
}
Esempio n. 12
0
void KMdiDockContainer::collapseOverlapped()
{
	//don't collapse if we're switching tabs
	if ( m_tabSwitching )
		return;

	if ( isOverlapMode() )
	{
		TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
		TQPtrListIterator<KMultiTabBarTab> it( *tl );
		for ( ;it.current();++it )
		{
			if ( it.current()->isOn() )
			{
				kdDebug( 760 ) << k_funcinfo << "lowering tab with id " << ( *it )->id() << endl;
				it.current()->setState( false );
				tabClicked( ( *it )->id() );
			}
		}
	}
}
Esempio n. 13
0
void KMdiDockContainer::delayedRaise()
{
	m_tb->setTab( m_delayedRaise, true );
	tabClicked( m_delayedRaise );
}