kdeui Library API Documentation

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 #include <kdemacros.h> 00032 00033 class QPushButton; 00034 class KSeparator; 00035 class KURLLabel; 00036 class QBoxLayout; 00037 class QPixmap; 00038 class KGuiItem; 00043 class KDialogBaseButton; 00044 00049 class KDialogBaseTile; 00050 00193 class KDialogBase : public KDialog 00194 { 00195 Q_OBJECT 00196 00197 public: 00198 00218 enum ButtonCode 00219 { 00220 Help = 0x00000001, 00221 Default = 0x00000002, 00222 Ok = 0x00000004, 00223 Apply = 0x00000008, 00224 Try = 0x00000010, 00225 Cancel = 0x00000020, 00226 Close = 0x00000040, 00227 User1 = 0x00000080, 00228 User2 = 0x00000100, 00229 User3 = 0x00000200, 00230 No = 0x00000080, 00231 Yes = 0x00000100, 00232 Details = 0x00000400, 00233 Filler = 0x40000000, 00234 Stretch = 0x80000000, 00235 NoDefault 00236 }; 00237 00238 enum ActionButtonStyle 00239 { 00240 ActionStyle0=0, // KDE std 00241 ActionStyle1, 00242 ActionStyle2, 00243 ActionStyle3, 00244 ActionStyle4, 00245 ActionStyleMAX 00246 }; 00247 00258 enum DialogType 00259 { 00260 TreeList = KJanusWidget::TreeList, 00261 Tabbed = KJanusWidget::Tabbed, 00262 Plain = KJanusWidget::Plain, 00263 Swallow = KJanusWidget::Swallow, 00264 IconList = KJanusWidget::IconList 00265 }; 00266 00267 public: 00268 00291 KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, 00292 const QString &caption=QString::null, 00293 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 00294 bool separator=false, 00295 const KGuiItem &user1=KGuiItem(), 00296 const KGuiItem &user2=KGuiItem(), 00297 const KGuiItem &user3=KGuiItem() ); 00298 00326 KDialogBase( int dialogFace, const QString &caption, 00327 int buttonMask, ButtonCode defaultButton, 00328 QWidget *parent=0, const char *name=0, bool modal=true, 00329 bool separator=false, 00330 const KGuiItem &user1=KGuiItem(), 00331 const KGuiItem &user2=KGuiItem(), 00332 const KGuiItem &user3=KGuiItem() ); 00333 00334 00362 KDialogBase( KDialogBase::DialogType dialogFace, WFlags f, 00363 QWidget *parent=0, const char *name=0, bool modal=true, 00364 const QString &caption=QString::null, 00365 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 00366 bool separator=false, 00367 const KGuiItem &user1=KGuiItem(), 00368 const KGuiItem &user2=KGuiItem(), 00369 const KGuiItem &user3=KGuiItem() ); 00370 00402 KDialogBase( const QString &caption, int buttonMask=Yes|No|Cancel, 00403 ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel, 00404 QWidget *parent=0, const char *name=0, 00405 bool modal=true, bool separator=false, 00406 const KGuiItem &yes = KStdGuiItem::yes(), // i18n("&Yes") 00407 const KGuiItem &no = KStdGuiItem::no(), // i18n("&No"), 00408 const KGuiItem &cancel = KStdGuiItem::cancel() // i18n("&Cancel") 00409 ); 00410 00414 ~KDialogBase(); 00415 00426 void setButtonBoxOrientation( int orientation ); 00427 00439 void setEscapeButton( ButtonCode id ); 00440 00441 00449 virtual void adjustSize(); 00450 virtual QSize sizeHint() const; 00451 virtual QSize minimumSizeHint() const; 00452 00463 QFrame *plainPage(); 00464 00492 QFrame *addPage( const QString &itemName, 00493 const QString &header=QString::null, 00494 const QPixmap &pixmap=QPixmap() ); 00495 00507 QFrame *addPage( const QStringList &items, 00508 const QString &header=QString::null, 00509 const QPixmap &pixmap=QPixmap() ); 00510 00535 QVBox *addVBoxPage( const QString &itemName, 00536 const QString &header=QString::null, 00537 const QPixmap &pixmap=QPixmap() ); 00538 00550 QVBox *addVBoxPage( const QStringList &items, 00551 const QString &header=QString::null, 00552 const QPixmap &pixmap=QPixmap() ); 00553 00572 QHBox *addHBoxPage( const QString &itemName, 00573 const QString &header=QString::null, 00574 const QPixmap &pixmap=QPixmap() ); 00575 00587 QHBox *addHBoxPage( const QStringList &items, 00588 const QString &header=QString::null, 00589 const QPixmap &pixmap=QPixmap() ); 00590 00611 QGrid *addGridPage( int n, Orientation dir, 00612 const QString &itemName, 00613 const QString &header=QString::null, 00614 const QPixmap &pixmap=QPixmap() ); 00615 00616 00628 QGrid *addGridPage( int n, Orientation dir, 00629 const QStringList &items, 00630 const QString &header=QString::null, 00631 const QPixmap &pixmap=QPixmap() ); 00632 00633 00640 void setFolderIcon(const QStringList &path,const QPixmap &pixmap); 00641 00655 QFrame *makeMainWidget(); 00656 00670 QVBox *makeVBoxMainWidget(); 00671 00685 QHBox *makeHBoxMainWidget(); 00686 00704 QGrid *makeGridMainWidget( int n, Orientation dir ); 00705 00706 00711 void enableButtonSeparator( bool state ); 00712 00723 void showButton( ButtonCode id, bool state ); 00724 00733 void showButtonOK( bool state ); 00734 00743 void showButtonApply( bool state ); 00744 00751 void showButtonCancel( bool state ); 00752 00763 bool showPage( int index ); 00764 00773 int activePageIndex() const; 00774 00775 00792 int pageIndex( QWidget *widget ) const; 00793 00794 00807 void setMainWidget( QWidget *widget ); 00808 00814 QWidget *mainWidget(); 00815 00823 void disableResize(); 00824 00836 void setInitialSize( const QSize &s, bool noResize=false ); 00837 00848 void incInitialSize( const QSize &s, bool noResize=false ); 00849 00857 QSize configDialogSize( const QString& groupName ) const; 00858 00868 QSize configDialogSize( KConfig& config, const QString& groupName ) const; 00869 00879 void saveDialogSize( const QString& groupName, bool global=false ); 00880 00891 void saveDialogSize( KConfig& config, const QString& groupName, 00892 bool global=false ) const; 00893 00902 void setButtonOK( const KGuiItem &item = KStdGuiItem::ok() ); 00903 00919 void setButtonOKText( const QString &text=QString::null, 00920 const QString &tooltip=QString::null, 00921 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00922 00931 void setButtonApply( const KGuiItem &item = KStdGuiItem::apply() ); 00932 00948 void setButtonApplyText( const QString &text=QString::null, 00949 const QString &tooltip=QString::null, 00950 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00951 00960 void setButtonCancel( const KGuiItem &item = KStdGuiItem::cancel() ); 00961 00975 void setButtonCancelText( const QString &text=QString::null, 00976 const QString &tooltip=QString::null, 00977 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00978 00985 void setButtonText( ButtonCode id, const QString &text ); 00986 00993 void setButtonTip( ButtonCode id, const QString &text ); 00994 01001 void setButtonWhatsThis( ButtonCode id, const QString &text ); 01002 01014 void setButtonGuiItem( ButtonCode id, const KGuiItem &item ); 01015 01026 void setTreeListAutoResize( bool state ); 01027 01040 void setShowIconsInTreeList(bool state); 01041 01050 void setRootIsDecorated( bool state ); 01051 01065 void unfoldTreeList( bool persist = false ); 01066 01075 void addWidgetBelowList( QWidget * widget ); 01076 01087 void addButtonBelowList( const QString & text, QObject * recv, const char * slot ); 01088 01100 void addButtonBelowList( const KGuiItem & guiitem, QObject * recv, const char * slot ); 01101 01114 void setIconListAllVisible( bool state ); 01115 01121 static bool haveBackgroundTile(); 01122 01129 static const QPixmap *backgroundTile(); 01134 static const QPixmap *getBackgroundTile() KDE_DEPRECATED; 01135 01143 static void setBackgroundTile( const QPixmap *pix ); 01144 01150 void showTile( bool state ); 01151 01163 void getBorderWidths( int& ulx, int& uly, int& lrx, int& lry ) const KDE_DEPRECATED; 01164 01176 QRect getContentsRect() const KDE_DEPRECATED; 01177 01195 QSize calculateSize( int w, int h ) const; 01196 01205 QString helpLinkText() const; 01206 01220 QPushButton *actionButton( ButtonCode id ); 01221 01222 public slots: 01229 void enableButton( ButtonCode id, bool state ); 01230 01236 void enableButtonOK( bool state ); 01237 01243 void enableButtonApply( bool state ); 01244 01250 void enableButtonCancel( bool state ); 01251 01257 void enableLinkedHelp( bool state ); 01258 01268 void delayedDestruct(); 01269 01278 void setHelpLinkText( const QString &text ); 01279 01292 void setHelp( const QString &anchor, 01293 const QString &appname = QString::null ); 01294 01298 void helpClickedSlot( const QString & ); 01299 01303 void setDetails(bool showDetails); 01304 01311 void setDetailsWidget(QWidget *detailsWidget); 01312 01317 void updateBackground(); 01318 01327 void cancel(); 01328 01329 signals: 01334 void helpClicked(); 01335 01340 void defaultClicked(); 01341 01342 01347 void user3Clicked(); 01348 01353 void user2Clicked(); 01354 01359 void user1Clicked(); 01360 01365 void applyClicked(); 01366 01371 void tryClicked(); 01372 01377 void okClicked(); 01378 01383 void yesClicked(); 01384 01389 void noClicked(); 01390 01395 void cancelClicked(); 01396 01401 void closeClicked(); 01402 01407 void apply(); 01408 01412 void backgroundChanged(); 01413 01421 void hidden(); 01422 01437 void finished(); 01438 01443 void aboutToShowDetails(); 01444 01449 void aboutToShowPage(QWidget *page); 01450 01451 protected: 01457 virtual void keyPressEvent( QKeyEvent *e ); 01458 01463 virtual void hideEvent( QHideEvent * ); 01464 01471 virtual void closeEvent( QCloseEvent *e ); 01472 01473 protected slots: 01478 virtual void slotHelp(); 01479 01483 virtual void slotDefault(); 01484 01489 virtual void slotDetails(); 01490 01494 virtual void slotUser3(); 01495 01499 virtual void slotUser2(); 01500 01504 virtual void slotUser1(); 01505 01510 virtual void slotOk(); 01511 01515 virtual void slotApply(); 01516 01520 virtual void slotTry(); 01521 01526 virtual void slotYes(); 01527 01532 virtual void slotNo(); 01533 01539 virtual void slotCancel(); 01540 01545 virtual void slotClose(); 01546 01552 virtual void applyPressed(); 01553 01557 void updateGeometry(); 01558 01566 void slotDelayedDestruct(); 01567 01568 private: 01572 void setupLayout(); 01573 01579 void makeRelay(); 01580 01593 void makeButtonBox( int mask, ButtonCode defaultButton, 01594 const KGuiItem &user1 = KGuiItem(), 01595 const KGuiItem &user2 = KGuiItem(), 01596 const KGuiItem &user3 = KGuiItem() ); 01597 01605 void setButtonFocus( QPushButton *p, bool isDefault, bool isFocus ); 01606 01612 void printMakeMainWidgetError(); 01613 01614 private slots: 01620 void setButtonStyle( int style ); 01621 01622 01623 private: 01624 QBoxLayout *mTopLayout; 01625 QWidget *mMainWidget; 01626 KURLLabel *mUrlHelp; 01627 KJanusWidget *mJanus; 01628 KSeparator *mActionSep; 01629 01630 bool mIsActivated; 01631 01632 QString mAnchor; 01633 QString mHelpApp; 01634 QString mHelpLinkText; 01635 01636 static KDialogBaseTile *mTile; 01637 bool mShowTile; 01638 01639 bool mMessageBoxMode; 01640 int mButtonOrientation; 01641 ButtonCode mEscapeButton; 01642 01643 protected: 01644 virtual void virtual_hook( int id, void* data ); 01645 private: 01646 class KDialogBasePrivate; 01647 KDialogBasePrivate *d; 01648 }; 01649 01650 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:27 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003