• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kdialog.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE Libraries
00002  *  Copyright (C) 1998 Thomas Tanghus (tanghus@earthling.net)
00003  *  Additions 1999-2000 by Espen Sand (espen@kde.org)
00004  *                      and Holger Freyther <freyther@kde.org>
00005  *            2005-2006   Olivier Goffart <ogoffart @ kde.org>
00006  *            2006      Tobias Koenig <tokoe@kde.org>
00007  *
00008  *  This library is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU Library General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2 of the License, or (at your option) any later version.
00012  *
00013  *  This library is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *  Library General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Library General Public License
00019  *  along with this library; see the file COPYING.LIB.  If not, write to
00020  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  *  Boston, MA 02110-1301, USA.
00022  */
00023 
00024 #ifndef KDIALOG_H
00025 #define KDIALOG_H
00026 
00027 class KPushButton;
00028 class QMenu;
00029 class KDialogPrivate;
00030 
00031 #include <kdeui_export.h>
00032 #include <kconfiggroup.h>
00033 #include <kguiitem.h>
00034 
00035 #include <QtGui/QDialog>
00036 
00127 class KDEUI_EXPORT KDialog : public QDialog
00128 {
00129   Q_OBJECT
00130   Q_ENUMS(ButtonCode)
00131     Q_DECLARE_PRIVATE(KDialog)
00132 
00133   public:
00134 
00135     enum ButtonCode
00136     {
00137       None    = 0x00000000,
00138       Help    = 0x00000001, 
00139       Default = 0x00000002, 
00140       Ok      = 0x00000004, 
00141       Apply   = 0x00000008, 
00142       Try     = 0x00000010, 
00143       Cancel  = 0x00000020, 
00144       Close   = 0x00000040, 
00145       No      = 0x00000080, 
00146       Yes     = 0x00000100, 
00147       Reset   = 0x00000200, 
00148       Details = 0x00000400, 
00149       User1   = 0x00001000, 
00150       User2   = 0x00002000, 
00151       User3   = 0x00004000, 
00152       NoDefault = 0x00008000 
00153     };
00154     Q_DECLARE_FLAGS(ButtonCodes, ButtonCode)
00155 
00156     enum ButtonPopupMode
00157     {
00158       InstantPopup = 0,
00159       DelayedPopup = 1
00160     };
00161     Q_DECLARE_FLAGS(ButtonPopupModes, ButtonPopupMode)
00162 
00163   public:
00170     explicit KDialog( QWidget *parent = 0, Qt::WFlags flags = 0 );
00171 
00175     ~KDialog();
00176 
00184     void setButtons( ButtonCodes buttonMask );
00185 
00196     void setButtonsOrientation( Qt::Orientation orientation );
00197 
00208     void setEscapeButton( ButtonCode id );
00209 
00218     void setDefaultButton( ButtonCode id );
00219 
00223     ButtonCode defaultButton() const;
00224 
00229     void showButtonSeparator( bool state );
00230 
00241     void showButton( ButtonCode id, bool state );
00242 
00249     void setButtonText( ButtonCode id, const QString &text );
00250 
00254     QString buttonText( ButtonCode id ) const;
00255 
00262     void setButtonIcon( ButtonCode id, const KIcon &icon );
00263 
00267     KIcon buttonIcon( ButtonCode id ) const;
00268 
00275     void setButtonToolTip( ButtonCode id, const QString &text );
00276 
00280     QString buttonToolTip( ButtonCode id ) const;
00281 
00288     void setButtonWhatsThis( ButtonCode id, const QString &text );
00289 
00293     QString buttonWhatsThis( ButtonCode id ) const;
00294 
00304     void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
00305 
00313     void setButtonMenu( ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup);
00314 
00318     void setButtonFocus( ButtonCode id );
00319 
00329     void setInitialSize( const QSize &size );
00330 
00339     void incrementInitialSize( const QSize &size );
00340 
00349     void restoreDialogSize( const KConfigGroup& config ) ;
00350 
00360     void saveDialogSize( KConfigGroup& config, KConfigGroup::WriteConfigFlags options = KConfigGroup::Normal ) const;
00361 
00374     QString helpLinkText() const;
00375 
00379     bool isButtonEnabled( ButtonCode id ) const;
00380 
00391     KPushButton* button( ButtonCode id ) const;
00392 
00397     static int marginHint();
00398 
00403     static int spacingHint();
00404 
00417     enum CaptionFlag
00418     {
00419         NoCaptionFlags = 0,
00420         AppNameCaption = 1,
00421         ModifiedCaption = 2,
00422         HIGCompliantCaption = AppNameCaption
00423     };
00424     Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
00425 
00426     
00446     static QString makeStandardCaption( const QString &userCaption,
00447                                         QWidget* window = 0,
00448                                         CaptionFlags flags = HIGCompliantCaption );
00449 
00457     static void resizeLayout( QWidget *widget, int margin, int spacing );
00458 
00466     static void resizeLayout( QLayout *lay, int margin, int spacing );
00467 
00477     static void centerOnScreen( QWidget *widget, int screen = -1 );
00478 
00487     static bool avoidArea( QWidget *widget, const QRect& area, int screen = -1 );
00488 
00492     void setMainWidget( QWidget *widget );
00493 
00502     QWidget *mainWidget();
00503 
00507     virtual QSize sizeHint() const;
00508 
00512     virtual QSize minimumSizeHint() const;
00513 
00514   public Q_SLOTS:
00522     virtual void setCaption( const QString &caption );
00523 
00533     virtual void setCaption( const QString &caption, bool modified );
00534 
00541     virtual void setPlainCaption( const QString &caption );
00542 
00549     void enableButton( ButtonCode id, bool state );
00550 
00556     void enableButtonOk( bool state );
00557 
00563     void enableButtonApply( bool state );
00564 
00570     void enableButtonCancel( bool state );
00571 
00581     void enableLinkedHelp( bool state );
00582 
00595     void setHelpLinkText( const QString &text );
00596 
00609     void setHelp( const QString &anchor, const QString &appname = QString() );
00610 
00614     bool isDetailsWidgetVisible() const;
00615 
00619     void setDetailsWidgetVisible( bool visible );
00620 
00627     void setDetailsWidget( QWidget *detailsWidget );
00628 
00635     void delayedDestruct();
00636 
00637   Q_SIGNALS:
00645     void layoutHintChanged();
00646 
00651     void helpClicked();
00652 
00657     void defaultClicked();
00658 
00663     void resetClicked();
00664 
00669     void user3Clicked();
00670 
00675     void user2Clicked();
00676 
00681     void user1Clicked();
00682 
00687     void applyClicked();
00688 
00693     void tryClicked();
00694 
00699     void okClicked();
00700 
00705     void yesClicked();
00706 
00711     void noClicked();
00712 
00717     void cancelClicked();
00718 
00723     void closeClicked();
00724 
00730     void buttonClicked( KDialog::ButtonCode button);
00731 
00739     void hidden();
00740 
00755     void finished();
00756 
00761     void aboutToShowDetails();
00762 
00763   protected:
00768     virtual void hideEvent( QHideEvent * );
00769 
00776     virtual void closeEvent( QCloseEvent *e );
00777 
00781     virtual void keyPressEvent( QKeyEvent* );
00782 
00783   protected Q_SLOTS:
00803     virtual void slotButtonClicked(int button);
00804 
00808     void updateGeometry();
00809 
00810     protected:
00811         KDialog(KDialogPrivate &dd, QWidget *parent, Qt::WFlags flags = 0);
00812         KDialogPrivate *const d_ptr;
00813 
00814     private:
00815         Q_DISABLE_COPY(KDialog)
00816         Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
00817 };
00818 
00819 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::ButtonCodes)
00820 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::CaptionFlags)
00821 
00822 #endif // KDIALOG_H

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal