# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kjanuswidget.h

    00001 /*  This file is part of the KDE Libraries
    00002  *  Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
    00003  *
    00004  *  This library is free software; you can redistribute it and/or
    00005  *  modify it under the terms of the GNU Library General Public
    00006  *  License as published by the Free Software Foundation; either
    00007  *  version 2 of the License, or (at your option) any later version.
    00008  *
    00009  *  This library is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  *  Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this library; see the file COPYING.LIB.  If not, write to
    00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  *  Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _KJANUS_WIDGET_H_
    00021 #define _KJANUS_WIDGET_H_
    00022
    00023 #include <qptrlist.h>
    00024 #include <qpixmap.h>
    00025 #include <qsplitter.h>
    00026
    00027 #include <klistbox.h>
    00028 #include <qstringlist.h>
    00029 #include <qmap.h>
    00030
    00031 class KListView;
    00032
    00033 class QGrid;
    00034 class QHBox;
    00035 class QLabel;
    00036 class QTabWidget;
    00037 class QVBox;
    00038 class QWidgetStack;
    00039 class KSeparator;
    00040 class QListViewItem;
    00041 class KGuiItem;
    00042
    00067 class KDEUI_EXPORT KJanusWidget : public QWidget
    00068 {
    00069   Q_OBJECT
    00070
    00071   private:
    00072     class IconListBox : public KListBox
    00073     {
    00074       public:
    00075         IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 );
    00076     void updateMinimumHeight();
    00077     void updateWidth();
    00078     void invalidateHeight();
    00079     void invalidateWidth();
    00080     void setShowAll( bool showAll );
    00081
    00082       private:
    00083     bool mShowAll;
    00084     bool mHeightValid;
    00085     bool mWidthValid;
    00086     };
    00087
    00088   public:
    00089     enum Face
    00090     {
    00097       TreeList = 0,
    00104       Tabbed,
    00110       Plain,
    00118       Swallow,
    00126       IconList
    00127     };
    00128
    00129   public:
    00130
    00139     KJanusWidget( QWidget *parent=0, const char *name=0, int face=Plain );
    00140
    00144     ~KJanusWidget();
    00145
    00151     virtual bool showPage( int index );
    00152
    00159     virtual int  activePageIndex() const;
    00160
    00167     virtual bool isValid() const;
    00168
    00174     virtual int face() const;
    00175
    00182     virtual QSize minimumSizeHint() const;
    00183
    00190     virtual QSize sizeHint() const;
    00191
    00197     virtual QFrame *plainPage();
    00198
    00218     virtual QFrame *addPage(const QString &item,const QString &header=QString::null,
    00219             const QPixmap &pixmap=QPixmap() );
    00220
    00235      virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null,
    00236             const QPixmap &pixmap=QPixmap() );
    00237
    00257     virtual QVBox *addVBoxPage( const QString &item,
    00258             const QString &header=QString::null,
    00259             const QPixmap &pixmap=QPixmap() );
    00260
    00273     virtual QVBox *addVBoxPage( const QStringList &items,
    00274             const QString &header=QString::null,
    00275             const QPixmap &pixmap=QPixmap() );
    00276
    00297     virtual QHBox *addHBoxPage( const QString &itemName,
    00298             const QString &header=QString::null,
    00299             const QPixmap &pixmap=QPixmap() );
    00300
    00313     virtual QHBox *addHBoxPage( const QStringList &items,
    00314             const QString &header=QString::null,
    00315             const QPixmap &pixmap=QPixmap() );
    00316
    00340     virtual QGrid *addGridPage( int n, Orientation dir,
    00341             const QString &itemName,
    00342             const QString &header=QString::null,
    00343             const QPixmap &pixmap=QPixmap() );
    00344
    00357     virtual QGrid *addGridPage( int n, Orientation dir,
    00358             const QStringList &items,
    00359             const QString &header=QString::null,
    00360             const QPixmap &pixmap=QPixmap() );
    00361
    00371     void removePage( QWidget *page );
    00372
    00373
    00390     virtual int pageIndex( QWidget *widget ) const;
    00391
    00401     virtual bool setSwallowedWidget( QWidget *widget );
    00402
    00413     virtual void setTreeListAutoResize( bool state );
    00414
    00427     virtual void setShowIconsInTreeList(bool state);
    00428
    00437     virtual void setRootIsDecorated( bool state );
    00438
    00452     /*virtual*/ void unfoldTreeList( bool persist = false ); //### KDE4 BIC add virtual
    00453
    00462     /*virtual*/ void addWidgetBelowList( QWidget * widget ); // ### KDE4
    00463
    00474     /*virtual*/ void addButtonBelowList( const QString & text, QObject * recv,
    00475                     const char * slot ); //### KDE4
    00476
    00488     /*virtual*/ void addButtonBelowList( const KGuiItem & guiitem, QObject *
    00489                     recv, const char * slot ); //### KDE4
    00490
    00503     virtual void setIconListAllVisible( bool state );
    00504
    00510     virtual void setFolderIcon(const QStringList &path, const QPixmap &pixmap);
    00517     /*virtual*/ QString pageTitle(int index) const;
    00525     /*virtual*/ QWidget *pageWidget(int index) const;
    00526
    00527   signals:
    00533     void aboutToShowPage(QWidget *page);
    00534
    00535   public slots:
    00539     virtual void setFocus();
    00540
    00541   protected:
    00546     virtual void showEvent( QShowEvent * );
    00547
    00556     virtual bool eventFilter( QObject *o, QEvent *e );
    00557
    00558   private slots:
    00559     bool slotShowPage();
    00560     void slotFontChanged();
    00561     void slotItemClicked(QListViewItem *it);
    00562     void pageGone(QObject *obj); // signal from the added page's "destroyed" signal
    00563     void slotReopen(QListViewItem *item);
    00564
    00565   protected:
    00566     bool showPage( QWidget *w );
    00567     void addPageWidget( QFrame *page, const QStringList &items,
    00568             const QString &header, const QPixmap &pixmap );
    00569     void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page);
    00570     QWidget *FindParent();
    00571
    00572   private:
    00573     bool mValid;
    00574
    00575     // Obsolete members. Remove in KDE 4.
    00576     QPtrList<QWidget> *mPageList;
    00577     QStringList *mTitleList;
    00578
    00579     int          mFace;
    00580     KListView    *mTreeList;
    00581     IconListBox  *mIconList;
    00582     QWidgetStack *mPageStack;
    00583     QLabel       *mTitleLabel;
    00584     QTabWidget   *mTabControl;
    00585     QFrame       *mPlainPage;
    00586     QWidget      *mSwallowPage;
    00587     QWidget      *mActivePageWidget;
    00588     KSeparator   *mTitleSep;
    00589     QSplitter::ResizeMode mTreeListResizeMode;
    00590     bool         mShowIconsInTreeList;
    00591     QMap<QListViewItem *, QWidget *> mTreeListToPageStack;
    00592     QMap<QListBoxItem *, QWidget *> mIconListToPageStack;
    00593     QMap<QString, QPixmap> mFolderIconMap;
    00594     QMap<QString, QStringList> mChildrenNames;
    00595     QMap<QString, QWidget *> mChildPages;
    00596
    00597   public:
    00598     class IconListItem;
    00599   protected:
    00600     virtual void virtual_hook( int id, void* data );
    00601   private:
    00602     class KJanusWidgetPrivate;
    00603     KJanusWidgetPrivate *d;
    00604 };
    00605
    00606 #endif

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:20:17 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003