summaryrefslogtreecommitdiff
path: root/libopie/otabwidget.cpp
Side-by-side diff
Diffstat (limited to 'libopie/otabwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/otabwidget.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index aaf14ce..bed7ef1 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -192,24 +192,37 @@ void OTabWidget::setCurrentTab( const QString &tabname )
{
OTabInfo *newtab = tabs.first();
while ( newtab && newtab->label() != tabname )
{
newtab = tabs.next();
}
if ( newtab && newtab->label() == tabname )
{
selectTab( newtab );
}
}
+void OTabWidget::setCurrentTab(int tabindex) {
+ OTabInfo *newtab = tabs.first();
+ while ( newtab && newtab->id() != tabindex )
+ {
+ newtab = tabs.next();
+ }
+ if ( newtab && newtab->id() == tabindex )
+ {
+ selectTab( newtab );
+ }
+}
+
+
OTabWidget::TabStyle OTabWidget::tabStyle() const
{
return tabBarStyle;
}
void OTabWidget::setTabStyle( TabStyle s )
{
tabBarStyle = s;
}
OTabWidget::TabPosition OTabWidget::tabPosition() const
{
@@ -296,12 +309,21 @@ void OTabWidget::setUpLayout()
QSize OTabWidget::sizeHint() const
{
QSize s( widgetStack->sizeHint() );
QSize t( tabBarStack->sizeHint() );
return QSize( QMAX( s.width(), t.width()), s.height() + t.height() );
}
void OTabWidget::resizeEvent( QResizeEvent * )
{
setUpLayout();
}
+
+int OTabWidget::getCurrentTab() {
+ if ( currentTab )
+ {
+ return currentTab->id();
+ }
+ return -1;
+}
+