kdialogbase.h
/*
* This file is part of the KDE Libraries
* Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and
* Espen Sand (espen@kde.org)
* Holger Freyther <freyther@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 _KDIALOG_BASE_H_
#define _KDIALOG_BASE_H_
#include <kdialog.h>
#include <kjanuswidget.h>
#include <kguiitem.h>
#include <kstdguiitem.h>
#include <qptrlist.h>
class QPushButton;
class KSeparator;
class KURLLabel;
class QBoxLayout;
class QPixmap;
class KGuiItem;
class KDialogBaseButton;
class KDialogBaseTile;
class KDEUI_EXPORT KDialogBase : public KDialog
{
Q_OBJECT
public:
enum ButtonCode
{
Help = 0x00000001,
Default = 0x00000002,
Ok = 0x00000004,
Apply = 0x00000008,
Try = 0x00000010,
Cancel = 0x00000020,
Close = 0x00000040,
User1 = 0x00000080,
User2 = 0x00000100,
User3 = 0x00000200,
No = 0x00000080,
Yes = 0x00000100,
Details = 0x00000400,
Filler = 0x40000000,
Stretch = 0x80000000,
NoDefault
};
enum ActionButtonStyle
{
ActionStyle0=0, // KDE std
ActionStyle1,
ActionStyle2,
ActionStyle3,
ActionStyle4,
ActionStyleMAX
};
enum DialogType
{
TreeList = KJanusWidget::TreeList,
Tabbed = KJanusWidget::Tabbed,
Plain = KJanusWidget::Plain,
Swallow = KJanusWidget::Swallow,
IconList = KJanusWidget::IconList
};
public:
KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
const QString &caption=QString::null,
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
const KGuiItem &user1=KGuiItem(),
const KGuiItem &user2=KGuiItem(),
const KGuiItem &user3=KGuiItem() );
KDialogBase( int dialogFace, const QString &caption,
int buttonMask, ButtonCode defaultButton,
QWidget *parent=0, const char *name=0, bool modal=true,
bool separator=false,
const KGuiItem &user1=KGuiItem(),
const KGuiItem &user2=KGuiItem(),
const KGuiItem &user3=KGuiItem() );
KDialogBase( KDialogBase::DialogType dialogFace, WFlags f,
QWidget *parent=0, const char *name=0, bool modal=true,
const QString &caption=QString::null,
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
const KGuiItem &user1=KGuiItem(),
const KGuiItem &user2=KGuiItem(),
const KGuiItem &user3=KGuiItem() );
KDialogBase( const QString &caption, int buttonMask=Yes|No|Cancel,
ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel,
QWidget *parent=0, const char *name=0,
bool modal=true, bool separator=false,
const KGuiItem &yes = KStdGuiItem::yes(), // i18n("&Yes")
const KGuiItem &no = KStdGuiItem::no(), // i18n("&No"),
const KGuiItem &cancel = KStdGuiItem::cancel() // i18n("&Cancel")
);
~KDialogBase();
void setButtonBoxOrientation( int orientation );
void setEscapeButton( ButtonCode id );
virtual void adjustSize();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
QFrame *plainPage();
QFrame *addPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QFrame *addPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QVBox *addVBoxPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QVBox *addVBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QHBox *addHBoxPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QHBox *addHBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QGrid *addGridPage( int n, Orientation dir,
const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
QGrid *addGridPage( int n, Orientation dir,
const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
void setFolderIcon(const QStringList &path,const QPixmap &pixmap);
QFrame *makeMainWidget();
QVBox *makeVBoxMainWidget();
QHBox *makeHBoxMainWidget();
QGrid *makeGridMainWidget( int n, Orientation dir );
void enableButtonSeparator( bool state );
void showButton( ButtonCode id, bool state );
void showButtonOK( bool state );
void showButtonApply( bool state );
void showButtonCancel( bool state );
bool showPage( int index );
int activePageIndex() const;
int pageIndex( QWidget *widget ) const;
void setMainWidget( QWidget *widget );
QWidget *mainWidget();
void disableResize();
void setInitialSize( const QSize &s, bool noResize=false );
void incInitialSize( const QSize &s, bool noResize=false );
QSize configDialogSize( const QString& groupName ) const;
QSize configDialogSize( KConfig& config, const QString& groupName ) const;
void saveDialogSize( const QString& groupName, bool global=false );
void saveDialogSize( KConfig& config, const QString& groupName,
bool global=false ) const;
void setButtonOK( const KGuiItem &item = KStdGuiItem::ok() );
void setButtonOKText( const QString &text=QString::null,
const QString &tooltip=QString::null,
const QString &quickhelp=QString::null ) KDE_DEPRECATED;
void setButtonApply( const KGuiItem &item = KStdGuiItem::apply() );
void setButtonApplyText( const QString &text=QString::null,
const QString &tooltip=QString::null,
const QString &quickhelp=QString::null ) KDE_DEPRECATED;
void setButtonCancel( const KGuiItem &item = KStdGuiItem::cancel() );
void setButtonCancelText( const QString &text=QString::null,
const QString &tooltip=QString::null,
const QString &quickhelp=QString::null ) KDE_DEPRECATED;
void setButtonText( ButtonCode id, const QString &text );
void setButtonTip( ButtonCode id, const QString &text );
void setButtonWhatsThis( ButtonCode id, const QString &text );
void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
void setTreeListAutoResize( bool state );
void setShowIconsInTreeList(bool state);
void setRootIsDecorated( bool state );
void unfoldTreeList( bool persist = false );
void addWidgetBelowList( QWidget * widget );
void addButtonBelowList( const QString & text, QObject * recv, const char * slot );
void addButtonBelowList( const KGuiItem & guiitem, QObject * recv, const char * slot );
void setIconListAllVisible( bool state );
static bool haveBackgroundTile();
static const QPixmap *backgroundTile();
static const QPixmap *getBackgroundTile() KDE_DEPRECATED;
static void setBackgroundTile( const QPixmap *pix );
void showTile( bool state );
void getBorderWidths( int& ulx, int& uly, int& lrx, int& lry ) const KDE_DEPRECATED;
QRect getContentsRect() const KDE_DEPRECATED;
QSize calculateSize( int w, int h ) const;
QString helpLinkText() const;
QPushButton *actionButton( ButtonCode id );
public slots:
void enableButton( ButtonCode id, bool state );
void enableButtonOK( bool state );
void enableButtonApply( bool state );
void enableButtonCancel( bool state );
void enableLinkedHelp( bool state );
void delayedDestruct();
void setHelpLinkText( const QString &text );
void setHelp( const QString &anchor,
const QString &appname = QString::null );
void helpClickedSlot( const QString & );
void setDetails(bool showDetails);
void setDetailsWidget(QWidget *detailsWidget);
void updateBackground();
void cancel();
signals:
void helpClicked();
void defaultClicked();
void user3Clicked();
void user2Clicked();
void user1Clicked();
void applyClicked();
void tryClicked();
void okClicked();
void yesClicked();
void noClicked();
void cancelClicked();
void closeClicked();
void apply();
void backgroundChanged();
void hidden();
void finished();
void aboutToShowDetails();
void aboutToShowPage(QWidget *page);
protected:
virtual void keyPressEvent( QKeyEvent *e );
virtual void hideEvent( QHideEvent * );
virtual void closeEvent( QCloseEvent *e );
protected slots:
virtual void slotHelp();
virtual void slotDefault();
virtual void slotDetails();
virtual void slotUser3();
virtual void slotUser2();
virtual void slotUser1();
virtual void slotOk();
virtual void slotApply();
virtual void slotTry();
virtual void slotYes();
virtual void slotNo();
virtual void slotCancel();
virtual void slotClose();
virtual void applyPressed();
void updateGeometry();
void slotDelayedDestruct();
private:
void setupLayout();
void makeRelay();
void makeButtonBox( int mask, ButtonCode defaultButton,
const KGuiItem &user1 = KGuiItem(),
const KGuiItem &user2 = KGuiItem(),
const KGuiItem &user3 = KGuiItem() );
void setButtonFocus( QPushButton *p, bool isDefault, bool isFocus );
void printMakeMainWidgetError();
private slots:
void setButtonStyle( int style );
private:
QBoxLayout *mTopLayout;
QWidget *mMainWidget;
KURLLabel *mUrlHelp;
KJanusWidget *mJanus;
KSeparator *mActionSep;
bool mIsActivated;
QString mAnchor;
QString mHelpApp;
QString mHelpLinkText;
static KDialogBaseTile *mTile;
bool mShowTile;
bool mMessageBoxMode;
int mButtonOrientation;
ButtonCode mEscapeButton;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KDialogBasePrivate;
KDialogBasePrivate* const d;
};
#endif
KURLLabel
A drop-in replacement for QLabel that displays hyperlinks.
Definition: kurllabel.h:71
KDialog
Dialog with extended non-modal support and methods for KDE standard compliance.
Definition: kdialog.h:52
KDialogBaseTile
Used internally by KDialogBase.
Definition: kdialogbase_priv.h:48
KDialogBase::ButtonCode
ButtonCode
Definition: kdialogbase.h:197
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KJanusWidget
Easy to use widget with many layouts.
Definition: kjanuswidget.h:67
KSeparator
Standard horizontal or vertical separator.
Definition: kseparator.h:33
KDialogBase::DialogType
DialogType
Definition: kdialogbase.h:237
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:38
KJanusWidget::TreeList
The TreeList face provides a list in the left area and pages in the right.
Definition: kjanuswidget.h:97
KDialogBaseButton
Used internally by KDialogBase.
Definition: kdialogbase_priv.h:31
KConfig
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::IconList
The IconList face provides an icon list in the left area and pages in the right.
Definition: kjanuswidget.h:126
KStdGuiItem
Provides a set of standardized KGuiItems.
Definition: kstdguiitem.h:37
KJanusWidget::Swallow
The Swallow face is provided in order to simplify the usage of existing widgets and to allow changing...
Definition: kjanuswidget.h:118

KDE Home | KDE Accessibility Home | Description of Access Keys