Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

otabwidget.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) 2002, 2005 Dan Williams <drw@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022     :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #ifndef OTABWIDGET_H
00032 #define OTABWIDGET_H
00033 
00034 /* OPIE */
00035 #include <opie2/otabinfo.h>
00036 
00037 /* QT */
00038 #include <qwidget.h>
00039 #include <qlist.h>
00040 
00041 
00042 class QComboBox;
00043 class QPixmap;
00044 class QTabBar;
00045 class QWidgetStack;
00046 
00047 namespace Opie {
00048 namespace Ui   {
00049 
00050 class OTabBar;
00051 
00067 class OTabWidget : public QWidget
00068 {
00069     Q_OBJECT
00070 
00071   public:
00084     enum TabStyle { Global, TextTab, IconTab, TextList, IconList };
00085 
00094     enum TabPosition { Top, Bottom };
00095 
00108     OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top );
00109 
00114     ~OTabWidget();
00115 
00124     void addTab( QWidget *, const QString &, const QString & );
00125 
00132     void removePage( QWidget * );
00133 
00142     void changeTab( QWidget *, const QString &, const QString & );
00143 
00148     TabStyle tabStyle() const;
00149 
00156     void setTabStyle( TabStyle );
00157 
00162     TabPosition tabPosition() const;
00163 
00170     void setTabPosition( TabPosition );
00171 
00178     void setCurrentTab( QWidget * );
00179 
00186     void setCurrentTab( const QString & );
00187 
00194     void setCurrentTab(int);
00195 
00200     // ### make const
00201     int currentTab()/* const */;
00207     QWidget* currentWidget()const;
00208 
00209 protected:
00210 
00215     void resizeEvent( QResizeEvent * );
00216 
00217 private:
00218     OTabInfoList  m_tabs;           // List of information for tabs
00219     OTabInfo     *m_currTab;        // Current tab displayed
00220     TabStyle      m_tabBarStyle;    // Current style of control
00221     TabPosition   m_tabBarPosition; // Position of selector control
00222     bool          m_usingTabs;      // Indicates whether style is either TextTab or IconTab
00223                                     // (saves from having to always check for these 2 values)
00224 
00225     // UI components
00226     OTabBar      *m_tabBar;
00227     QComboBox    *m_tabList;
00228     QWidgetStack *m_widgetStack;
00229 
00230     class Private;
00231     Private* d;
00232 
00239     void    selectTab( OTabInfo * );
00240 
00245     void    setUpLayout();
00246 
00247 
00248   signals:
00255     void currentChanged( QWidget * );
00256 
00257   private slots:
00258 
00265     void slotTabBarSelected( int );
00266 
00273     void slotTabListSelected( int );
00274 };
00275 
00276 }
00277 }
00278 
00279 #endif

Generated on Sat Nov 5 16:16:28 2005 for OPIE by  doxygen 1.4.2