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 00216 enum ButtonCode 00217 { 00218 Help = 0x00000001, 00219 Default = 0x00000002, 00220 Ok = 0x00000004, 00221 Apply = 0x00000008, 00222 Try = 0x00000010, 00223 Cancel = 0x00000020, 00224 Close = 0x00000040, 00225 User1 = 0x00000080, 00226 User2 = 0x00000100, 00227 User3 = 0x00000200, 00228 No = 0x00000080, 00229 Yes = 0x00000100, 00230 Details = 0x00000400, 00231 Filler = 0x40000000, 00232 Stretch = 0x80000000 00233 }; 00234 00235 enum ActionButtonStyle 00236 { 00237 ActionStyle0=0, // KDE std 00238 ActionStyle1, 00239 ActionStyle2, 00240 ActionStyle3, 00241 ActionStyle4, 00242 ActionStyleMAX 00243 }; 00244 00254 enum DialogType 00255 { 00256 TreeList = KJanusWidget::TreeList, 00257 Tabbed = KJanusWidget::Tabbed, 00258 Plain = KJanusWidget::Plain, 00259 Swallow = KJanusWidget::Swallow, 00260 IconList = KJanusWidget::IconList 00261 }; 00262 00263 public: 00264 00286 KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, 00287 const QString &caption=QString::null, 00288 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 00289 bool separator=false, 00290 const KGuiItem &user1=KGuiItem(), 00291 const KGuiItem &user2=KGuiItem(), 00292 const KGuiItem &user3=KGuiItem() ); 00293 00320 KDialogBase( int dialogFace, const QString &caption, 00321 int buttonMask, ButtonCode defaultButton, 00322 QWidget *parent=0, const char *name=0, bool modal=true, 00323 bool separator=false, 00324 const KGuiItem &user1=KGuiItem(), 00325 const KGuiItem &user2=KGuiItem(), 00326 const KGuiItem &user3=KGuiItem() ); 00327 00328 00355 KDialogBase( KDialogBase::DialogType dialogFace, WFlags f, 00356 QWidget *parent=0, const char *name=0, bool modal=true, 00357 const QString &caption=QString::null, 00358 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 00359 bool separator=false, 00360 const KGuiItem &user1=KGuiItem(), 00361 const KGuiItem &user2=KGuiItem(), 00362 const KGuiItem &user3=KGuiItem() ); 00363 00394 KDialogBase( const QString &caption, int buttonMask=Yes|No|Cancel, 00395 ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel, 00396 QWidget *parent=0, const char *name=0, 00397 bool modal=true, bool separator=false, 00398 const KGuiItem &yes = KStdGuiItem::yes(), // i18n("&Yes") 00399 const KGuiItem &no = KStdGuiItem::no(), // i18n("&No"), 00400 const KGuiItem &cancel = KStdGuiItem::cancel() // i18n("&Cancel") 00401 ); 00402 00406 ~KDialogBase(); 00407 00418 void setButtonBoxOrientation( int orientation ); 00419 00431 void setEscapeButton( ButtonCode id ); 00432 00433 00441 virtual void adjustSize(); 00442 virtual QSize sizeHint() const; 00443 virtual QSize minimumSizeHint() const; 00444 00455 QFrame *plainPage(); 00456 00484 QFrame *addPage( const QString &itemName, 00485 const QString &header=QString::null, 00486 const QPixmap &pixmap=QPixmap() ); 00487 00499 QFrame *addPage( const QStringList &items, 00500 const QString &header=QString::null, 00501 const QPixmap &pixmap=QPixmap() ); 00502 00527 QVBox *addVBoxPage( const QString &itemName, 00528 const QString &header=QString::null, 00529 const QPixmap &pixmap=QPixmap() ); 00530 00542 QVBox *addVBoxPage( const QStringList &items, 00543 const QString &header=QString::null, 00544 const QPixmap &pixmap=QPixmap() ); 00545 00564 QHBox *addHBoxPage( const QString &itemName, 00565 const QString &header=QString::null, 00566 const QPixmap &pixmap=QPixmap() ); 00567 00579 QHBox *addHBoxPage( const QStringList &items, 00580 const QString &header=QString::null, 00581 const QPixmap &pixmap=QPixmap() ); 00582 00603 QGrid *addGridPage( int n, Orientation dir, 00604 const QString &itemName, 00605 const QString &header=QString::null, 00606 const QPixmap &pixmap=QPixmap() ); 00607 00608 00620 QGrid *addGridPage( int n, Orientation dir, 00621 const QStringList &items, 00622 const QString &header=QString::null, 00623 const QPixmap &pixmap=QPixmap() ); 00624 00625 00632 void setFolderIcon(const QStringList &path,const QPixmap &pixmap); 00633 00647 QFrame *makeMainWidget(); 00648 00662 QVBox *makeVBoxMainWidget(); 00663 00677 QHBox *makeHBoxMainWidget(); 00678 00696 QGrid *makeGridMainWidget( int n, Orientation dir ); 00697 00698 00703 void enableButtonSeparator( bool state ); 00704 00715 void showButton( ButtonCode id, bool state ); 00716 00725 void showButtonOK( bool state ); 00726 00735 void showButtonApply( bool state ); 00736 00743 void showButtonCancel( bool state ); 00744 00755 bool showPage( int index ); 00756 00765 int activePageIndex() const; 00766 00767 00784 int pageIndex( QWidget *widget ) const; 00785 00786 00799 void setMainWidget( QWidget *widget ); 00800 00806 QWidget *mainWidget(); 00807 00815 void disableResize(); 00816 00828 void setInitialSize( const QSize &s, bool noResize=false ); 00829 00840 void incInitialSize( const QSize &s, bool noResize=false ); 00841 00851 QSize configDialogSize( const QString& groupName ) const; 00852 00864 QSize configDialogSize( KConfig& config, const QString& groupName ) const; 00865 00875 void saveDialogSize( const QString& groupName, bool global=false ); 00876 00887 void saveDialogSize( KConfig& config, const QString& groupName, 00888 bool global=false ) const; 00889 00898 void setButtonOK( const KGuiItem &item = KStdGuiItem::ok() ); 00899 00915 void setButtonOKText( const QString &text=QString::null, 00916 const QString &tooltip=QString::null, 00917 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00918 00927 void setButtonApply( const KGuiItem &item = KStdGuiItem::apply() ); 00928 00944 void setButtonApplyText( const QString &text=QString::null, 00945 const QString &tooltip=QString::null, 00946 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00947 00956 void setButtonCancel( const KGuiItem &item = KStdGuiItem::cancel() ); 00957 00971 void setButtonCancelText( const QString &text=QString::null, 00972 const QString &tooltip=QString::null, 00973 const QString &quickhelp=QString::null ) KDE_DEPRECATED; 00974 00981 void setButtonText( ButtonCode id, const QString &text ); 00982 00989 void setButtonTip( ButtonCode id, const QString &text ); 00990 00997 void setButtonWhatsThis( ButtonCode id, const QString &text ); 00998 00999 01010 void setTreeListAutoResize( bool state ); 01011 01024 void setShowIconsInTreeList(bool state); 01025 01034 void setRootIsDecorated( bool state ); 01035 01049 void unfoldTreeList( bool persist = false ); 01050 01059 void addWidgetBelowList( QWidget * widget ); 01060 01071 void addButtonBelowList( const QString & text, QObject * recv, const char * slot ); 01072 01084 void addButtonBelowList( const KGuiItem & guiitem, QObject * recv, const char * slot ); 01085 01098 void setIconListAllVisible( bool state ); 01099 01105 static bool haveBackgroundTile(); 01106 01113 static const QPixmap *backgroundTile(); 01118 static const QPixmap *getBackgroundTile() KDE_DEPRECATED; 01119 01127 static void setBackgroundTile( const QPixmap *pix ); 01128 01134 void showTile( bool state ); 01135 01147 void getBorderWidths( int& ulx, int& uly, int& lrx, int& lry ) const KDE_DEPRECATED; 01148 01160 QRect getContentsRect() const KDE_DEPRECATED; 01161 01179 QSize calculateSize( int w, int h ) const; 01180 01189 QString helpLinkText() const; 01190 01204 QPushButton *actionButton( ButtonCode id ); 01205 01206 public slots: 01213 void enableButton( ButtonCode id, bool state ); 01214 01220 void enableButtonOK( bool state ); 01221 01227 void enableButtonApply( bool state ); 01228 01234 void enableButtonCancel( bool state ); 01235 01241 void enableLinkedHelp( bool state ); 01242 01252 void delayedDestruct(); 01253 01262 void setHelpLinkText( const QString &text ); 01263 01271 void setHelp( const QString &anchor, 01272 const QString &appname = QString::null ); 01273 01277 void helpClickedSlot( const QString & ); 01278 01282 void setDetails(bool showDetails); 01283 01290 void setDetailsWidget(QWidget *detailsWidget); 01291 01296 void updateBackground(); 01297 01306 void cancel(); 01307 01308 signals: 01313 void helpClicked(); 01314 01319 void defaultClicked(); 01320 01321 01326 void user3Clicked(); 01327 01332 void user2Clicked(); 01333 01338 void user1Clicked(); 01339 01344 void applyClicked(); 01345 01350 void tryClicked(); 01351 01356 void okClicked(); 01357 01362 void yesClicked(); 01363 01368 void noClicked(); 01369 01374 void cancelClicked(); 01375 01380 void closeClicked(); 01381 01386 void apply() KDE_DEPRECATED; 01387 01391 void backgroundChanged(); 01392 01400 void hidden(); 01401 01416 void finished(); 01417 01422 void aboutToShowDetails(); 01423 01427 void aboutToShowPage(QWidget *page); 01428 01429 protected: 01435 virtual void keyPressEvent( QKeyEvent *e ); 01436 01441 virtual void hideEvent( QHideEvent * ); 01442 01449 virtual void closeEvent( QCloseEvent *e ); 01450 01451 protected slots: 01456 virtual void slotHelp(); 01457 01461 virtual void slotDefault(); 01462 01467 virtual void slotDetails(); 01468 01472 virtual void slotUser3(); 01473 01477 virtual void slotUser2(); 01478 01482 virtual void slotUser1(); 01483 01488 virtual void slotOk(); 01489 01493 virtual void slotApply(); 01494 01498 virtual void slotTry(); 01499 01504 virtual void slotYes(); 01505 01510 virtual void slotNo(); 01511 01517 virtual void slotCancel(); 01518 01523 virtual void slotClose(); 01524 01530 virtual void applyPressed() KDE_DEPRECATED; 01531 01535 void updateGeometry(); 01536 01544 void slotDelayedDestruct(); 01545 01546 private: 01550 void setupLayout(); 01551 01557 void makeRelay(); 01558 01570 void makeButtonBox( int mask, ButtonCode defaultButton, 01571 const KGuiItem &user1 = KGuiItem(), 01572 const KGuiItem &user2 = KGuiItem(), 01573 const KGuiItem &user3 = KGuiItem() ); 01574 01582 void setButtonFocus( QPushButton *p, bool isDefault, bool isFocus ); 01583 01589 void printMakeMainWidgetError(); 01590 01591 private slots: 01597 void setButtonStyle( int style ); 01598 01599 01600 private: 01601 QBoxLayout *mTopLayout; 01602 QWidget *mMainWidget; 01603 KURLLabel *mUrlHelp; 01604 KJanusWidget *mJanus; 01605 KSeparator *mActionSep; 01606 01607 bool mIsActivated; 01608 01609 QString mAnchor; 01610 QString mHelpApp; 01611 QString mHelpLinkText; 01612 01613 static KDialogBaseTile *mTile; 01614 bool mShowTile; 01615 01616 bool mMessageBoxMode; 01617 int mButtonOrientation; 01618 ButtonCode mEscapeButton; 01619 01620 protected: 01621 virtual void virtual_hook( int id, void* data ); 01622 private: 01623 class KDialogBasePrivate; 01624 KDialogBasePrivate *d; 01625 }; 01626 01627 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:14:25 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003