-rw-r--r-- | libopie/otabwidget.cpp | 9 | ||||
-rw-r--r-- | libopie/otabwidget.h | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp index fe2c60f..1b8c085 100644 --- a/libopie/otabwidget.cpp +++ b/libopie/otabwidget.cpp @@ -387,24 +387,33 @@ void OTabWidget::setUpLayout() updateMask(); } 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::currentTab() { if ( currTab ) { return currTab->id(); } return -1; } +QWidget* OTabWidget::currentWidget()const +{ + if ( currTab ) + { + return currTab->control(); + } + + return 0; +} diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h index c140c0b..acb9223 100644 --- a/libopie/otabwidget.h +++ b/libopie/otabwidget.h @@ -103,48 +103,49 @@ public: OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); /** * @fn ~OTabWidget() * @brief Object destructor. */ ~OTabWidget(); /** * @fn addTab( QWidget *child, const QString &icon, const QString &label ) * @brief Add new widget to control. * * @param child Widget control. * @param icon Path to icon. * @param label Text label. */ void addTab( QWidget *, const QString &, const QString & ); /** * @fn removePage( QWidget *widget ) * @brief Remove widget from control. Does not delete widget. * * @param widget Widget control to be removed. */ + /* ### Page vs. Tab.. yes the widget is a Page but then is addTab wrong -zecke */ void removePage( QWidget * ); /** * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) * @brief Change text and/or icon for existing tab * * @param child Widget control. * @param icon Path to icon. * @param label Text label. */ void changeTab( QWidget *, const QString &, const QString & ); /** * @fn tabStyle()const * @brief Returns current widget selection control style. */ TabStyle tabStyle() const; /** * @fn setTabStyle( TabStyle s ) * @brief Set the current widget selection control style. * * @param s New style to be used. */ @@ -177,50 +178,56 @@ public: * @brief Selects and brings to top the desired widget, by using label. * * @param tabname Text label for widget to select. */ void setCurrentTab( const QString & ); /** * @fn setCurrentTab( int ) * @brief Selects and brings to top the desired widget, by using id. * * @param tab id for widget to select. */ void setCurrentTab(int); /** * @fn sizeHint()const * @brief Reimplemented for internal purposes. */ QSize sizeHint() const; /** * @fn currentTab( ) * @brief returns current tab id. */ - int currentTab(); - + // ### make const + int currentTab()/* const */; +/** + * @brief returns the current page of the active tab + * + * @since 1.2 + */ + QWidget* currentWidget()const; protected: /** * @fn resizeEvent( QResizeEvent * ) * @brief Reimplemented for internal purposes. */ void resizeEvent( QResizeEvent * ); private: OTabInfoList tabs; OTabInfo *currTab; TabStyle tabBarStyle; TabPosition tabBarPosition; QWidgetStack *tabBarStack; OTabBar *tabBar; QComboBox *tabList; QWidgetStack *widgetStack; class Private; Private* d; |