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

ojanuswidget.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
00005                              Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
00006               =.
00007             .=l.
00008            .>+-=
00009  _;:,     .>    :=|.         This program is free software; you can
00010 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00011 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00012 .="- .-=="i,     .._         License as published by the Free Software
00013  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00014      ._= =}       :          or (at your option) any later version.
00015     .%`+i>       _;_.
00016     .i_,=:_.      -<s.       This program is distributed in the hope that
00017      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00018     : ..    .:,     . . .    without even the implied warranty of
00019     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00020   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00021 ..}^=.=       =       ;      Library General Public License for more
00022 ++=   -.     .`     .:       details.
00023  :     =  ...= . :.=-
00024  -.   .:....=;==+<;          You should have received a copy of the GNU
00025   -_. . .   )=.  =           Library General Public License along with
00026     --        :-=`           this library; see the file COPYING.LIB.
00027                              If not, write to the Free Software Foundation,
00028                              Inc., 59 Temple Place - Suite 330,
00029                              Boston, MA 02111-1307, USA.
00030 
00031 */
00032 
00033 #ifndef OJANUSWIDGET_H
00034 #define OJANUSWIDGET_H
00035 
00036 #include <qptrlist.h>
00037 #include <qpixmap.h>
00038 #include <qlistbox.h>
00039 #include <qmap.h>
00040 #include <qsplitter.h>
00041 #include <qstringlist.h>
00042 
00043 class QGrid;
00044 class QHBox;
00045 class QLabel;
00046 class QTabWidget;
00047 class QVBox;
00048 class QWidgetStack;
00049 class OSeparator;
00050 class QListView;
00051 class QListViewItem;
00052 
00100 class OJanusWidget : public QWidget
00101 {
00102   Q_OBJECT
00103 
00104   private:
00105     
00106     class IconListBox : public QListBox
00107     {
00108       public:
00109         IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 );
00110         void updateMinimumHeight();
00111         void updateWidth();
00112         void invalidateHeight();
00113         void invalidateWidth();
00114         void setShowAll( bool showAll );
00115 
00116       private:
00117         bool mShowAll;
00118         bool mHeightValid;
00119         bool mWidthValid;
00120     };
00121 
00122   public:
00123     
00124     enum Face
00125     {
00126       TreeList = 0,
00127       Tabbed,
00128       Plain,
00129       Swallow,
00130       IconList
00131     };
00132 
00133   public:
00134 
00143     OJanusWidget( QWidget *parent=0, const char *name=0, int face=Plain );
00144 
00148     ~OJanusWidget();
00149 
00155     virtual bool showPage( int index );
00156 
00163     virtual int  activePageIndex() const;
00164 
00171     virtual bool isValid() const;
00172 
00178     virtual int face() const;
00179 
00186     virtual QSize minimumSizeHint() const;
00187 
00194     virtual QSize sizeHint() const;
00195 
00201     virtual QFrame *plainPage();
00202 
00222     virtual QFrame *addPage(const QString &item,const QString &header=QString::null,
00223                     const QPixmap &pixmap=QPixmap() );
00224 
00239      virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null,
00240                     const QPixmap &pixmap=QPixmap() );
00241 
00261     virtual QVBox *addVBoxPage( const QString &item,
00262                         const QString &header=QString::null,
00263                         const QPixmap &pixmap=QPixmap() );
00264 
00277     virtual QVBox *addVBoxPage( const QStringList &items,
00278                         const QString &header=QString::null,
00279                         const QPixmap &pixmap=QPixmap() );
00280 
00301     virtual QHBox *addHBoxPage( const QString &itemName,
00302                         const QString &header=QString::null,
00303                         const QPixmap &pixmap=QPixmap() );
00304 
00317     virtual QHBox *addHBoxPage( const QStringList &items,
00318                         const QString &header=QString::null,
00319                         const QPixmap &pixmap=QPixmap() );
00320 
00344     virtual QGrid *addGridPage( int n, Orientation dir,
00345                         const QString &itemName,
00346                         const QString &header=QString::null,
00347                         const QPixmap &pixmap=QPixmap() );
00348 
00361     virtual QGrid *addGridPage( int n, Orientation dir,
00362                         const QStringList &items,
00363                         const QString &header=QString::null,
00364                         const QPixmap &pixmap=QPixmap() );
00365 
00375     void removePage( QWidget *page );
00376 
00377 
00394     virtual int pageIndex( QWidget *widget ) const;
00395 
00405     virtual bool setSwallowedWidget( QWidget *widget );
00406 
00417     virtual void setTreeListAutoResize( bool state );
00418 
00431     virtual void setShowIconsInTreeList(bool state);
00432 
00441     virtual void setRootIsDecorated( bool state );
00442 
00456     /*virtual*/ void unfoldTreeList( bool persist = false ); //### KDE4 BIC add virtual
00457 
00470     virtual void setIconListAllVisible( bool state );
00471 
00477     virtual void setFolderIcon(const QStringList &path, const QPixmap &pixmap);
00478 
00479   signals:
00480     void aboutToShowPage(QWidget *page);
00481 
00482   public slots:
00486     virtual void setFocus();
00487 
00488   protected:
00493     virtual void showEvent( QShowEvent * );
00494 
00503     virtual bool eventFilter( QObject *o, QEvent *e );
00504 
00505   private slots:
00506     bool slotShowPage();
00507     void slotFontChanged();
00508     void slotItemClicked(QListViewItem *it);
00509     void pageGone(QObject *obj); // signal from the added page's "destroyed" signal
00510     void slotReopen(QListViewItem *item);
00511 
00512   protected:
00513     bool showPage( QWidget *w );
00514     void addPageWidget( QFrame *page, const QStringList &items,
00515                         const QString &header, const QPixmap &pixmap );
00516     void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page);
00517     QWidget *FindParent();
00518 
00519   private:
00520     bool mValid;
00521 
00522     QPtrList<QWidget> *mPageList;
00523     QStringList *mTitleList;
00524 
00525     int          mFace;
00526     QListView    *mTreeList;
00527     IconListBox  *mIconList;
00528     QWidgetStack *mPageStack;
00529     QLabel       *mTitleLabel;
00530     QTabWidget   *mTabControl;
00531     QFrame       *mPlainPage;
00532     QWidget      *mSwallowPage;
00533     QWidget      *mActivePageWidget;
00534     OSeparator   *mTitleSep;
00535     QSplitter::ResizeMode mTreeListResizeMode;
00536     bool         mShowIconsInTreeList;
00537     QMap<QListViewItem *, QWidget *> mTreeListToPageStack;
00538     QMap<QListBoxItem *, QWidget *> mIconListToPageStack;
00539     QMap<QString, QPixmap> mFolderIconMap;
00540     QMap<QString, QStringList> mChildrenNames;
00541     QMap<QString, QWidget *> mChildPages;
00542 
00543   public:
00544     class IconListItem;
00545   
00546   private:
00547     class OJanusWidgetPrivate;
00548     OJanusWidgetPrivate *d;
00549 };
00550 
00551 #endif

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