kjanuswidget.h
/* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KJANUS_WIDGET_H_
#define _KJANUS_WIDGET_H_
#include <qptrlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <klistbox.h>
#include <qstringlist.h>
#include <qmap.h>
class KListView;
class QGrid;
class QHBox;
class QLabel;
class QTabWidget;
class QVBox;
class QWidgetStack;
class KSeparator;
class QListViewItem;
class KGuiItem;
class KDEUI_EXPORT KJanusWidget : public QWidget
{
Q_OBJECT
private:
class IconListBox : public KListBox
{
public:
IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 );
void updateMinimumHeight();
void updateWidth();
void invalidateHeight();
void invalidateWidth();
void setShowAll( bool showAll );
private:
bool mShowAll;
bool mHeightValid;
bool mWidthValid;
};
public:
enum Face
{
TreeList = 0,
Tabbed,
Plain,
Swallow,
IconList
};
public:
KJanusWidget( QWidget *parent=0, const char *name=0, int face=Plain );
~KJanusWidget();
virtual bool showPage( int index );
virtual int activePageIndex() const;
virtual bool isValid() const;
virtual int face() const;
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;
virtual QFrame *plainPage();
virtual QFrame *addPage(const QString &item,const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QVBox *addVBoxPage( const QString &item,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QVBox *addVBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QHBox *addHBoxPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QHBox *addHBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QGrid *addGridPage( int n, Orientation dir,
const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
virtual QGrid *addGridPage( int n, Orientation dir,
const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
void removePage( QWidget *page );
virtual int pageIndex( QWidget *widget ) const;
virtual bool setSwallowedWidget( QWidget *widget );
virtual void setTreeListAutoResize( bool state );
virtual void setShowIconsInTreeList(bool state);
virtual void setRootIsDecorated( bool state );
/*virtual*/ void unfoldTreeList( bool persist = false ); //### KDE4 BIC add virtual
/*virtual*/ void addWidgetBelowList( QWidget * widget ); // ### KDE4
/*virtual*/ void addButtonBelowList( const QString & text, QObject * recv,
const char * slot ); //### KDE4
/*virtual*/ void addButtonBelowList( const KGuiItem & guiitem, QObject *
recv, const char * slot ); //### KDE4
virtual void setIconListAllVisible( bool state );
virtual void setFolderIcon(const QStringList &path, const QPixmap &pixmap);
/*virtual*/ QString pageTitle(int index) const;
/*virtual*/ QWidget *pageWidget(int index) const;
signals:
void aboutToShowPage(QWidget *page);
public slots:
virtual void setFocus();
protected:
virtual void showEvent( QShowEvent * );
virtual bool eventFilter( QObject *o, QEvent *e );
private slots:
bool slotShowPage();
void slotFontChanged();
void slotItemClicked(QListViewItem *it);
void pageGone(QObject *obj); // signal from the added page's "destroyed" signal
void slotReopen(QListViewItem *item);
protected:
bool showPage( QWidget *w );
void addPageWidget( QFrame *page, const QStringList &items,
const QString &header, const QPixmap &pixmap );
void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page);
QWidget *FindParent();
private:
bool mValid;
// Obsolete members. Remove in KDE 4.
QPtrList<QWidget> *mPageList;
QStringList *mTitleList;
int mFace;
KListView *mTreeList;
IconListBox *mIconList;
QWidgetStack *mPageStack;
QLabel *mTitleLabel;
QTabWidget *mTabControl;
QFrame *mPlainPage;
QWidget *mSwallowPage;
QWidget *mActivePageWidget;
KSeparator *mTitleSep;
QSplitter::ResizeMode mTreeListResizeMode;
bool mShowIconsInTreeList;
QMap<QListViewItem *, QWidget *> mTreeListToPageStack;
QMap<QListBoxItem *, QWidget *> mIconListToPageStack;
QMap<QString, QPixmap> mFolderIconMap;
QMap<QString, QStringList> mChildrenNames;
QMap<QString, QWidget *> mChildPages;
public:
class IconListItem;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KJanusWidgetPrivate;
KJanusWidgetPrivate *d;
};
#endif
KListView
This Widget extends the functionality of QListView to honor the system wide settings for Single Click...
Definition: klistview.h:53
KJanusWidget
Easy to use widget with many layouts.
Definition: kjanuswidget.h:67
KSeparator
Standard horizontal or vertical separator.
Definition: kseparator.h:33
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:38
KJanusWidget::Face
Face
Definition: kjanuswidget.h:89
KJanusWidget::Tabbed
The Tabbed face is a common tabbed widget.
Definition: kjanuswidget.h:104
KJanusWidget::Plain
The Plain face provides an empty widget (QFrame) where you can place your widgets.
Definition: kjanuswidget.h:110
KJanusWidget::Swallow
The Swallow face is provided in order to simplify the usage of existing widgets and to allow changing...
Definition: kjanuswidget.h:118
KListBox
A variant of QListBox that honors KDE's system-wide settings.
Definition: klistbox.h:40

KDE Home | KDE Accessibility Home | Description of Access Keys