• Skip to content
  • Skip to link menu
KDE 4.3 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-2009 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 //krazy:exclude=qclasses
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 
00190     void setButtons( ButtonCodes buttonMask );
00191 
00202     void setButtonsOrientation( Qt::Orientation orientation );
00203 
00214     void setEscapeButton( ButtonCode id );
00215 
00224     void setDefaultButton( ButtonCode id );
00225 
00229     ButtonCode defaultButton() const;
00230 
00235     void showButtonSeparator( bool state );
00236 
00247     void showButton( ButtonCode id, bool state );
00248 
00255     void setButtonText( ButtonCode id, const QString &text );
00256 
00260     QString buttonText( ButtonCode id ) const;
00261 
00268     void setButtonIcon( ButtonCode id, const KIcon &icon );
00269 
00273     KIcon buttonIcon( ButtonCode id ) const;
00274 
00281     void setButtonToolTip( ButtonCode id, const QString &text );
00282 
00286     QString buttonToolTip( ButtonCode id ) const;
00287 
00294     void setButtonWhatsThis( ButtonCode id, const QString &text );
00295 
00299     QString buttonWhatsThis( ButtonCode id ) const;
00300 
00310     void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
00311 
00319     void setButtonMenu( ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup);
00320 
00324     void setButtonFocus( ButtonCode id );
00325 
00335     void setInitialSize( const QSize &size );
00336 
00345     void incrementInitialSize( const QSize &size );
00346 
00355     void restoreDialogSize( const KConfigGroup& config ) ;
00356 
00366     void saveDialogSize( KConfigGroup& config, KConfigGroup::WriteConfigFlags options = KConfigGroup::Normal ) const;
00367 
00380     QString helpLinkText() const;
00381 
00385     bool isButtonEnabled( ButtonCode id ) const;
00386 
00397     KPushButton* button( ButtonCode id ) const;
00398 
00406     static int marginHint();
00407 
00415     static int spacingHint();
00416 
00423     static int groupSpacingHint();
00424 
00437     enum CaptionFlag
00438     {
00439         NoCaptionFlags = 0,
00440         AppNameCaption = 1,
00441         ModifiedCaption = 2,
00442         HIGCompliantCaption = AppNameCaption
00443     };
00444     Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
00445 
00446     
00466     static QString makeStandardCaption( const QString &userCaption,
00467                                         QWidget* window = 0,
00468                                         CaptionFlags flags = HIGCompliantCaption );
00469 
00481     static void resizeLayout( QWidget *widget, int margin, int spacing );
00482 
00494     static void resizeLayout( QLayout *lay, int margin, int spacing );
00495 
00505     static void centerOnScreen( QWidget *widget, int screen = -1 );
00506 
00515     static bool avoidArea( QWidget *widget, const QRect& area, int screen = -1 );
00516 
00520     void setMainWidget( QWidget *widget );
00521 
00530     QWidget *mainWidget();
00531 
00535     virtual QSize sizeHint() const;
00536 
00540     virtual QSize minimumSizeHint() const;
00541 
00542   public Q_SLOTS:
00550     virtual void setCaption( const QString &caption );
00551 
00561     virtual void setCaption( const QString &caption, bool modified );
00562 
00569     virtual void setPlainCaption( const QString &caption );
00570 
00577     void enableButton( ButtonCode id, bool state );
00578 
00584     void enableButtonOk( bool state );
00585 
00591     void enableButtonApply( bool state );
00592 
00598     void enableButtonCancel( bool state );
00599 
00609     void enableLinkedHelp( bool state );
00610 
00623     void setHelpLinkText( const QString &text );
00624 
00637     void setHelp( const QString &anchor, const QString &appname = QString() );
00638 
00642     bool isDetailsWidgetVisible() const;
00643 
00647     void setDetailsWidgetVisible( bool visible );
00648 
00655     void setDetailsWidget( QWidget *detailsWidget );
00656 
00663     void delayedDestruct();
00664 
00665   Q_SIGNALS:
00675     void layoutHintChanged();
00676 
00681     void helpClicked();
00682 
00687     void defaultClicked();
00688 
00693     void resetClicked();
00694 
00699     void user3Clicked();
00700 
00705     void user2Clicked();
00706 
00711     void user1Clicked();
00712 
00717     void applyClicked();
00718 
00723     void tryClicked();
00724 
00729     void okClicked();
00730 
00735     void yesClicked();
00736 
00741     void noClicked();
00742 
00747     void cancelClicked();
00748 
00753     void closeClicked();
00754 
00760     void buttonClicked( KDialog::ButtonCode button);
00761 
00769     void hidden();
00770 
00785     void finished();
00786 
00791     void aboutToShowDetails();
00792 
00793   protected:
00798     virtual void hideEvent( QHideEvent * );
00799 
00806     virtual void closeEvent( QCloseEvent *e );
00807 
00811     virtual void keyPressEvent( QKeyEvent* );
00812 
00813   protected Q_SLOTS:
00833     virtual void slotButtonClicked(int button);
00834 
00841     void updateGeometry();
00842 
00843     protected:
00844         KDialog(KDialogPrivate &dd, QWidget *parent, Qt::WFlags flags = 0);
00845         KDialogPrivate *const d_ptr;
00846 
00847     private:
00848         Q_DISABLE_COPY(KDialog)
00849         Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
00850         Q_PRIVATE_SLOT(d_ptr, void helpLinkClicked())
00851 };
00852 
00853 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::ButtonCodes)
00854 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::CaptionFlags)
00855 
00856 #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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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