diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:21 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:21 -0600 |
commit | dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 (patch) | |
tree | c297348a55df66c571de4525646e0b9762427353 /tdemdi/tdemdidocumentviewtabwidget.cpp | |
parent | b7658a0d5eca24a9d37c6e04f88298ef02389db0 (diff) | |
download | tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.tar.gz tdelibs-dfe289850f068f19ba4a83ab4e7e22a7e09c13c9.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdemdi/tdemdidocumentviewtabwidget.cpp')
-rw-r--r-- | tdemdi/tdemdidocumentviewtabwidget.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/tdemdi/tdemdidocumentviewtabwidget.cpp b/tdemdi/tdemdidocumentviewtabwidget.cpp new file mode 100644 index 000000000..dcfa60976 --- /dev/null +++ b/tdemdi/tdemdidocumentviewtabwidget.cpp @@ -0,0 +1,148 @@ +//---------------------------------------------------------------------------- +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +//---------------------------------------------------------------------------- + +#include <tqtimer.h> + +#include <ktabbar.h> +#include <kpopupmenu.h> +#include "tdemdidocumentviewtabwidget.h" + +KMdiDocumentViewTabWidget::KMdiDocumentViewTabWidget( TQWidget* parent, const char* name ) : KTabWidget( parent, name ) +{ + m_visibility = KMdi::ShowWhenMoreThanOneTab; + tabBar() ->hide(); + setHoverCloseButton( true ); + connect( this, TQT_SIGNAL( closeRequest( TQWidget* ) ), this, TQT_SLOT( closeTab( TQWidget* ) ) ); +} + +KMdiDocumentViewTabWidget::~KMdiDocumentViewTabWidget() +{} + +void KMdiDocumentViewTabWidget::closeTab( TQWidget* w ) +{ + w->close(); +} +void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, const TQString & label ) +{ + KTabWidget::addTab( child, label ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); +} + +void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label ) +{ + KTabWidget::addTab( child, iconset, label ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); +} + +void KMdiDocumentViewTabWidget::addTab ( TQWidget * child, TQTab * tab ) +{ + KTabWidget::addTab( child, tab ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); +} + +void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQString & label, int index ) +{ + KTabWidget::insertTab( child, label, index ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); + tabBar() ->repaint(); +} + +void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, const TQIconSet & iconset, const TQString & label, int index ) +{ + KTabWidget::insertTab( child, iconset, label, index ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); + tabBar() ->repaint(); +} + +void KMdiDocumentViewTabWidget::insertTab ( TQWidget * child, TQTab * tab, int index ) +{ + KTabWidget::insertTab( child, tab, index ); + showPage( child ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); + tabBar() ->repaint(); +} + +void KMdiDocumentViewTabWidget::removePage ( TQWidget * w ) +{ + KTabWidget::removePage( w ); + TQTimer::singleShot(0, this, TQT_SLOT(maybeShow())); +} + +void KMdiDocumentViewTabWidget::updateIconInView( TQWidget *w, TQPixmap icon ) +{ + changeTab( w, icon, tabLabel( w ) ); +} + +void KMdiDocumentViewTabWidget::updateCaptionInView( TQWidget *w, const TQString &caption ) +{ + changeTab( w, caption ); +} + +void KMdiDocumentViewTabWidget::maybeShow() +{ + switch (m_visibility) + { + case KMdi::AlwaysShowTabs: + tabBar() ->show(); + if ( cornerWidget() ) + { + if ( count() == 0 ) + cornerWidget() ->hide(); + else + cornerWidget() ->show(); + } + break; + + case KMdi::ShowWhenMoreThanOneTab: + if ( count() < 2 ) + tabBar() ->hide(); + else tabBar() ->show(); + if ( cornerWidget() ) + { + if ( count() < 2 ) + cornerWidget() ->hide(); + else + cornerWidget() ->show(); + } + break; + case KMdi::NeverShowTabs: + tabBar() ->hide(); + break; + } +} + +void KMdiDocumentViewTabWidget::setTabWidgetVisibility( KMdi::TabWidgetVisibility visibility ) +{ + m_visibility = visibility; + maybeShow(); +} + +void KMdiDocumentViewTabWidget::moveTab( int from, int to ) +{ + emit initiateTabMove( from, to ); + KTabWidget::moveTab( from, to ); +} + +KMdi::TabWidgetVisibility KMdiDocumentViewTabWidget::tabWidgetVisibility( ) +{ + return m_visibility; +} + + +#ifndef NO_INCLUDE_MOCFILES +#include "tdemdidocumentviewtabwidget.moc" +#endif + +// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands; + |