kdialogbase.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kdialogbase.h

    00001 /*
    00002  *  This file is part of the KDE Libraries
    00003  *  Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and
    00004  *  Espen Sand (espen@kde.org)
    00005  *  Holger Freyther <freyther@kde.org>
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Library General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Library General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Library General Public License
    00018  *  along with this library; see the file COPYING.LIB.  If not, write to
    00019  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020  *  Boston, MA 02111-1307, USA.
    00021  *
    00022  */
    00023 #ifndef _KDIALOG_BASE_H_
    00024 #define _KDIALOG_BASE_H_
    00025
    00026 #include <kdialog.h>
    00027 #include <kjanuswidget.h>
    00028 #include <kguiitem.h>
    00029 #include <kstdguiitem.h>
    00030 #include <qptrlist.h>
    00031
    00032 class QPushButton;
    00033 class KSeparator;
    00034 class KURLLabel;
    00035 class QBoxLayout;
    00036 class QPixmap;
    00037 class KGuiItem;
    00042 class KDialogBaseButton;
    00043
    00048 class KDialogBaseTile;
    00049
    00191 class KDialogBase : public KDialog
    00192 {
    00193   Q_OBJECT
    00194
    00195   public:
    00196
    00214     enum ButtonCode
    00215     {
    00216       Help    = 0x00000001,
    00217       Default = 0x00000002,
    00218       Ok      = 0x00000004,
    00219       Apply   = 0x00000008,
    00220       Try     = 0x00000010,
    00221       Cancel  = 0x00000020,
    00222       Close   = 0x00000040,
    00223       User1   = 0x00000080,
    00224       User2   = 0x00000100,
    00225       User3   = 0x00000200,
    00226       No      = 0x00000080,
    00227       Yes     = 0x00000100,
    00228       Details = 0x00000400,
    00229       Filler  = 0x40000000,
    00230       Stretch = 0x80000000
    00231     };
    00232
    00233     enum ActionButtonStyle
    00234     {
    00235       ActionStyle0=0, // KDE std
    00236       ActionStyle1,
    00237       ActionStyle2,
    00238       ActionStyle3,
    00239       ActionStyle4,
    00240       ActionStyleMAX
    00241     };
    00242
    00252     enum DialogType
    00253     {
    00254       TreeList  = KJanusWidget::TreeList,
    00255       Tabbed    = KJanusWidget::Tabbed,
    00256       Plain     = KJanusWidget::Plain,
    00257       Swallow   = KJanusWidget::Swallow,
    00258       IconList  = KJanusWidget::IconList
    00259     };
    00260
    00261   public:
    00262
    00284     KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
    00285                  const QString &caption=QString::null,
    00286                  int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
    00287                  bool separator=false,
    00288                  const KGuiItem &user1=KGuiItem(),
    00289                  const KGuiItem &user2=KGuiItem(),
    00290                  const KGuiItem &user3=KGuiItem() );
    00291
    00315     KDialogBase( int dialogFace, const QString &caption,
    00316                  int buttonMask, ButtonCode defaultButton,
    00317                  QWidget *parent=0, const char *name=0, bool modal=true,
    00318                  bool separator=false,
    00319                  const KGuiItem &user1=KGuiItem(),
    00320                  const KGuiItem &user2=KGuiItem(),
    00321                  const KGuiItem &user3=KGuiItem() );
    00322
    00323
    00354     KDialogBase( const QString &caption, int buttonMask=Yes|No|Cancel,
    00355                  ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel,
    00356                  QWidget *parent=0, const char *name=0,
    00357                  bool modal=true, bool separator=false,
    00358                  const KGuiItem &yes = KStdGuiItem::yes(), // i18n("&Yes")
    00359                  const KGuiItem &no = KStdGuiItem::no(), // i18n("&No"),
    00360                  const KGuiItem &cancel = KStdGuiItem::cancel() // i18n("&Cancel")
    00361                  );
    00362
    00366     ~KDialogBase();
    00367
    00378     void setButtonBoxOrientation( int orientation );
    00379
    00391     void setEscapeButton( ButtonCode id );
    00392
    00393
    00401     virtual void adjustSize();
    00402     virtual QSize sizeHint() const;
    00403     virtual QSize minimumSizeHint() const;
    00404
    00415     QFrame *plainPage();
    00416
    00444     QFrame  *addPage( const QString &itemName,
    00445                       const QString &header=QString::null,
    00446                       const QPixmap &pixmap=QPixmap() );
    00447
    00459     QFrame  *addPage( const QStringList &items,
    00460                       const QString &header=QString::null,
    00461                       const QPixmap &pixmap=QPixmap() );
    00462
    00487     QVBox *addVBoxPage( const QString &itemName,
    00488                         const QString &header=QString::null,
    00489                         const QPixmap &pixmap=QPixmap() );
    00490
    00502     QVBox *addVBoxPage( const QStringList &items,
    00503                         const QString &header=QString::null,
    00504                         const QPixmap &pixmap=QPixmap() );
    00505
    00524     QHBox *addHBoxPage( const QString &itemName,
    00525                         const QString &header=QString::null,
    00526                         const QPixmap &pixmap=QPixmap() );
    00527
    00539     QHBox *addHBoxPage( const QStringList &items,
    00540                         const QString &header=QString::null,
    00541                         const QPixmap &pixmap=QPixmap() );
    00542
    00563     QGrid *addGridPage( int n, Orientation dir,
    00564                         const QString &itemName,
    00565                         const QString &header=QString::null,
    00566                         const QPixmap &pixmap=QPixmap() );
    00567
    00568
    00580     QGrid *addGridPage( int n, Orientation dir,
    00581                         const QStringList &items,
    00582                         const QString &header=QString::null,
    00583                         const QPixmap &pixmap=QPixmap() );
    00584
    00585
    00592     void setFolderIcon(const QStringList &path,const QPixmap &pixmap);
    00593
    00607     QFrame *makeMainWidget();
    00608
    00622     QVBox *makeVBoxMainWidget();
    00623
    00637     QHBox *makeHBoxMainWidget();
    00638
    00656     QGrid *makeGridMainWidget( int n, Orientation dir );
    00657
    00658
    00663     void enableButtonSeparator( bool state );
    00664
    00675     void showButton( ButtonCode id, bool state );
    00676
    00685     void showButtonOK( bool state );
    00686
    00695     void showButtonApply( bool state );
    00696
    00703     void showButtonCancel( bool state );
    00704
    00715     bool showPage( int index );
    00716
    00725     int activePageIndex() const;
    00726
    00727
    00744     int pageIndex( QWidget *widget ) const;
    00745
    00746
    00759     void setMainWidget( QWidget *widget );
    00760
    00766     QWidget *mainWidget();
    00767
    00775     void disableResize();
    00776
    00788     void setInitialSize( const QSize &s, bool noResize=false );
    00789
    00800     void incInitialSize( const QSize &s, bool noResize=false );
    00801
    00811    QSize configDialogSize( const QString& groupName ) const;
    00812
    00822    void saveDialogSize( const QString& groupName, bool global=false );
    00823
    00837     void setButtonOKText( const QString &text=QString::null,
    00838                           const QString &tooltip=QString::null,
    00839                           const QString &quickhelp=QString::null );
    00840
    00854     void setButtonApplyText( const QString &text=QString::null,
    00855                              const QString &tooltip=QString::null,
    00856                              const QString &quickhelp=QString::null );
    00857
    00869     void setButtonCancelText( const QString &text=QString::null,
    00870                               const QString &tooltip=QString::null,
    00871                               const QString &quickhelp=QString::null );
    00872
    00879     void setButtonText( ButtonCode id, const QString &text );
    00880
    00887     void setButtonTip( ButtonCode id, const QString &text );
    00888
    00895     void setButtonWhatsThis( ButtonCode id, const QString &text );
    00896
    00897
    00908      void setTreeListAutoResize( bool state );
    00909
    00922     void setShowIconsInTreeList(bool state);
    00923
    00932     void setRootIsDecorated( bool state );
    00933
    00946     void setIconListAllVisible( bool state );
    00947
    00953     static bool haveBackgroundTile();
    00954
    00961     static const QPixmap *backgroundTile();
    00966     static const QPixmap *getBackgroundTile();
    00967
    00975     static void setBackgroundTile( const QPixmap *pix );
    00976
    00982     void showTile( bool state );
    00983
    00995     void  getBorderWidths( int& ulx, int& uly, int& lrx, int& lry ) const;
    00996
    01008     QRect getContentsRect() const;
    01009
    01027     QSize calculateSize( int w, int h ) const;
    01028
    01037     QString helpLinkText() const;
    01038
    01051     QPushButton *actionButton( ButtonCode id );
    01052
    01053   public slots:
    01060     void enableButton( ButtonCode id, bool state );
    01061
    01067     void enableButtonOK( bool state );
    01068
    01074     void enableButtonApply( bool state );
    01075
    01081     void enableButtonCancel( bool state );
    01082
    01088     void enableLinkedHelp( bool state );
    01089
    01099     void delayedDestruct();
    01100
    01109     void setHelpLinkText( const QString &text );
    01110
    01118     void setHelp( const QString &anchor,
    01119                   const QString &appname = QString::null );
    01120
    01124     void helpClickedSlot( const QString & );
    01125
    01129     void setDetails(bool showDetails);
    01130
    01137     void setDetailsWidget(QWidget *detailsWidget);
    01138
    01143     void updateBackground();
    01144
    01153     void cancel();
    01154
    01155   signals:
    01160     void helpClicked();
    01161
    01166     void defaultClicked();
    01167
    01168
    01173     void user3Clicked();
    01174
    01179     void user2Clicked();
    01180
    01185     void user1Clicked();
    01186
    01191     void applyClicked();
    01192
    01197     void tryClicked();
    01198
    01203     void okClicked();
    01204
    01209     void yesClicked();
    01210
    01215     void noClicked();
    01216
    01221     void cancelClicked();
    01222
    01227     void closeClicked();
    01228
    01233     void apply();
    01234
    01238     void backgroundChanged();
    01239
    01247     void hidden();
    01248
    01263     void finished();
    01264
    01269     void aboutToShowDetails();
    01270
    01274     void aboutToShowPage(QWidget *page);
    01275
    01276   protected:
    01282     virtual void keyPressEvent( QKeyEvent *e );
    01283
    01288     virtual void hideEvent( QHideEvent * );
    01289
    01296     virtual void closeEvent( QCloseEvent *e );
    01297
    01298   protected slots:
    01303     virtual void slotHelp();
    01304
    01308     virtual void slotDefault();
    01309
    01314     virtual void slotDetails();
    01315
    01319     virtual void slotUser3();
    01320
    01324     virtual void slotUser2();
    01325
    01329     virtual void slotUser1();
    01330
    01335     virtual void slotOk();
    01336
    01340     virtual void slotApply();
    01341
    01345     virtual void slotTry();
    01346
    01351     virtual void slotYes();
    01352
    01357     virtual void slotNo();
    01358
    01364     virtual void slotCancel();
    01365
    01370     virtual void slotClose();
    01371
    01376     virtual void applyPressed();
    01377
    01381     void updateGeometry();
    01382
    01390     void slotDelayedDestruct();
    01391
    01392   private:
    01396     void setupLayout();
    01397
    01403     void makeRelay();
    01404
    01416     void makeButtonBox( int mask, ButtonCode defaultButton,
    01417                         const KGuiItem &user1 = KGuiItem(),
    01418                         const KGuiItem &user2 = KGuiItem(),
    01419                         const KGuiItem &user3 = KGuiItem() );
    01420
    01428     void setButtonFocus( QPushButton *p, bool isDefault, bool isFocus );
    01429
    01435     void printMakeMainWidgetError();
    01436
    01437   private slots:
    01443     void setButtonStyle( int style );
    01444
    01445
    01446   private:
    01447     QBoxLayout   *mTopLayout;
    01448     QWidget      *mMainWidget;
    01449     KURLLabel    *mUrlHelp;
    01450     KJanusWidget *mJanus;
    01451     KSeparator   *mActionSep;
    01452
    01453     bool mIsActivated;
    01454
    01455     QString mAnchor;
    01456     QString mHelpApp;
    01457     QString mHelpLinkText;
    01458
    01459     static KDialogBaseTile *mTile;
    01460     bool   mShowTile;
    01461
    01462     bool mMessageBoxMode;
    01463     int  mButtonOrientation;
    01464     ButtonCode mEscapeButton;
    01465
    01466   protected:
    01467     virtual void virtual_hook( int id, void* data );
    01468   private:
    01469     class KDialogBasePrivate;
    01470     KDialogBasePrivate *d;
    01471 };
    01472
    01473 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:56:32 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001