• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • 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 
00128 class KDEUI_EXPORT KDialog : public QDialog //krazy:exclude=qclasses
00129 {
00130   Q_OBJECT
00131   Q_ENUMS(ButtonCode)
00132     Q_DECLARE_PRIVATE(KDialog)
00133 
00134   public:
00135 
00136     enum ButtonCode
00137     {
00138       None    = 0x00000000,
00139       Help    = 0x00000001, 
00140       Default = 0x00000002, 
00141       Ok      = 0x00000004, 
00142       Apply   = 0x00000008, 
00143       Try     = 0x00000010, 
00144       Cancel  = 0x00000020, 
00145       Close   = 0x00000040, 
00146       No      = 0x00000080, 
00147       Yes     = 0x00000100, 
00148       Reset   = 0x00000200, 
00149       Details = 0x00000400, 
00150       User1   = 0x00001000, 
00151       User2   = 0x00002000, 
00152       User3   = 0x00004000, 
00153       NoDefault = 0x00008000 
00154     };
00155     // TODO KDE5: remove NoDefault and use the value None instead
00156     Q_DECLARE_FLAGS(ButtonCodes, ButtonCode)
00157 
00158     enum ButtonPopupMode
00159     {
00160       InstantPopup = 0,
00161       DelayedPopup = 1
00162     };
00163     Q_DECLARE_FLAGS(ButtonPopupModes, ButtonPopupMode)
00164 
00165   public:
00172     explicit KDialog( QWidget *parent = 0, Qt::WFlags flags = 0 );
00173 
00177     ~KDialog();
00178 
00192     void setButtons( ButtonCodes buttonMask );
00193 
00204     void setButtonsOrientation( Qt::Orientation orientation );
00205 
00216     void setEscapeButton( ButtonCode id );
00217 
00226     void setDefaultButton( ButtonCode id );
00227 
00232     ButtonCode defaultButton() const;
00233 
00238     void showButtonSeparator( bool state );
00239 
00250     void showButton( ButtonCode id, bool state );
00251 
00258     void setButtonText( ButtonCode id, const QString &text );
00259 
00263     QString buttonText( ButtonCode id ) const;
00264 
00271     void setButtonIcon( ButtonCode id, const KIcon &icon );
00272 
00276     KIcon buttonIcon( ButtonCode id ) const;
00277 
00284     void setButtonToolTip( ButtonCode id, const QString &text );
00285 
00289     QString buttonToolTip( ButtonCode id ) const;
00290 
00297     void setButtonWhatsThis( ButtonCode id, const QString &text );
00298 
00302     QString buttonWhatsThis( ButtonCode id ) const;
00303 
00313     void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
00314 
00322     void setButtonMenu( ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup);
00323 
00327     void setButtonFocus( ButtonCode id );
00328 
00338     void setInitialSize( const QSize &size );
00339 
00348     void incrementInitialSize( const QSize &size );
00349 
00358     void restoreDialogSize( const KConfigGroup& config ) ;
00359 
00369     void saveDialogSize( KConfigGroup& config, KConfigGroup::WriteConfigFlags options = KConfigGroup::Normal ) const;
00370 
00383     QString helpLinkText() const;
00384 
00388     bool isButtonEnabled( ButtonCode id ) const;
00389 
00400     KPushButton* button( ButtonCode id ) const;
00401 
00409     static int marginHint();
00410 
00418     static int spacingHint();
00419 
00426     static int groupSpacingHint();
00427 
00440     enum CaptionFlag
00441     {
00442         NoCaptionFlags = 0,
00443         AppNameCaption = 1,
00444         ModifiedCaption = 2,
00445         HIGCompliantCaption = AppNameCaption
00446     };
00447     Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
00448 
00449     
00469     static QString makeStandardCaption( const QString &userCaption,
00470                                         QWidget* window = 0,
00471                                         CaptionFlags flags = HIGCompliantCaption );
00472 
00484     static void resizeLayout( QWidget *widget, int margin, int spacing );
00485 
00497     static void resizeLayout( QLayout *lay, int margin, int spacing );
00498 
00508     static void centerOnScreen( QWidget *widget, int screen = -1 );
00509 
00518     static bool avoidArea( QWidget *widget, const QRect& area, int screen = -1 );
00519 
00523     void setMainWidget( QWidget *widget );
00524 
00533     QWidget *mainWidget();
00534 
00538     virtual QSize sizeHint() const;
00539 
00543     virtual QSize minimumSizeHint() const;
00544     
00550     static void setAllowEmbeddingInGraphicsView( bool allowEmbedding );
00551 
00552   public Q_SLOTS:
00560     virtual void setCaption( const QString &caption );
00561 
00571     virtual void setCaption( const QString &caption, bool modified );
00572 
00579     virtual void setPlainCaption( const QString &caption );
00580 
00587     void enableButton( ButtonCode id, bool state );
00588 
00594     void enableButtonOk( bool state );
00595 
00601     void enableButtonApply( bool state );
00602 
00608     void enableButtonCancel( bool state );
00609 
00619     void enableLinkedHelp( bool state );
00620 
00633     void setHelpLinkText( const QString &text );
00634 
00647     void setHelp( const QString &anchor, const QString &appname = QString() );
00648 
00652     bool isDetailsWidgetVisible() const;
00653 
00657     void setDetailsWidgetVisible( bool visible );
00658 
00665     void setDetailsWidget( QWidget *detailsWidget );
00666 
00673     void delayedDestruct();
00674 
00675   Q_SIGNALS:
00685     void layoutHintChanged();
00686 
00691     void helpClicked();
00692 
00697     void defaultClicked();
00698 
00703     void resetClicked();
00704 
00709     void user3Clicked();
00710 
00715     void user2Clicked();
00716 
00721     void user1Clicked();
00722 
00727     void applyClicked();
00728 
00733     void tryClicked();
00734 
00739     void okClicked();
00740 
00745     void yesClicked();
00746 
00751     void noClicked();
00752 
00757     void cancelClicked();
00758 
00763     void closeClicked();
00764 
00770     void buttonClicked( KDialog::ButtonCode button);
00771 
00779     void hidden();
00780 
00795     void finished();
00796 
00801     void aboutToShowDetails();
00802 
00803   protected:
00808     virtual void hideEvent( QHideEvent * );
00809 
00816     virtual void closeEvent( QCloseEvent *e );
00817 
00821     virtual void keyPressEvent( QKeyEvent* );
00822 
00823   protected Q_SLOTS:
00843     virtual void slotButtonClicked(int button);
00844 
00851     void updateGeometry();
00852 
00853     protected:
00854         KDialog(KDialogPrivate &dd, QWidget *parent, Qt::WFlags flags = 0);
00855         KDialogPrivate *const d_ptr;
00856 
00857     private:
00858         Q_DISABLE_COPY(KDialog)
00859         Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
00860         Q_PRIVATE_SLOT(d_ptr, void helpLinkClicked())
00861 };
00862 
00863 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::ButtonCodes)
00864 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::CaptionFlags)
00865 
00866 #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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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