• Skip to content
  • Skip to link menu
KDE 4.4 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 
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     Q_DECLARE_FLAGS(ButtonCodes, ButtonCode)
00156 
00157     enum ButtonPopupMode
00158     {
00159       InstantPopup = 0,
00160       DelayedPopup = 1
00161     };
00162     Q_DECLARE_FLAGS(ButtonPopupModes, ButtonPopupMode)
00163 
00164   public:
00171     explicit KDialog( QWidget *parent = 0, Qt::WFlags flags = 0 );
00172 
00176     ~KDialog();
00177 
00191     void setButtons( ButtonCodes buttonMask );
00192 
00203     void setButtonsOrientation( Qt::Orientation orientation );
00204 
00215     void setEscapeButton( ButtonCode id );
00216 
00225     void setDefaultButton( ButtonCode id );
00226 
00230     ButtonCode defaultButton() const;
00231 
00236     void showButtonSeparator( bool state );
00237 
00248     void showButton( ButtonCode id, bool state );
00249 
00256     void setButtonText( ButtonCode id, const QString &text );
00257 
00261     QString buttonText( ButtonCode id ) const;
00262 
00269     void setButtonIcon( ButtonCode id, const KIcon &icon );
00270 
00274     KIcon buttonIcon( ButtonCode id ) const;
00275 
00282     void setButtonToolTip( ButtonCode id, const QString &text );
00283 
00287     QString buttonToolTip( ButtonCode id ) const;
00288 
00295     void setButtonWhatsThis( ButtonCode id, const QString &text );
00296 
00300     QString buttonWhatsThis( ButtonCode id ) const;
00301 
00311     void setButtonGuiItem( ButtonCode id, const KGuiItem &item );
00312 
00320     void setButtonMenu( ButtonCode id, QMenu *menu, ButtonPopupMode popupmode=InstantPopup);
00321 
00325     void setButtonFocus( ButtonCode id );
00326 
00336     void setInitialSize( const QSize &size );
00337 
00346     void incrementInitialSize( const QSize &size );
00347 
00356     void restoreDialogSize( const KConfigGroup& config ) ;
00357 
00367     void saveDialogSize( KConfigGroup& config, KConfigGroup::WriteConfigFlags options = KConfigGroup::Normal ) const;
00368 
00381     QString helpLinkText() const;
00382 
00386     bool isButtonEnabled( ButtonCode id ) const;
00387 
00398     KPushButton* button( ButtonCode id ) const;
00399 
00407     static int marginHint();
00408 
00416     static int spacingHint();
00417 
00424     static int groupSpacingHint();
00425 
00438     enum CaptionFlag
00439     {
00440         NoCaptionFlags = 0,
00441         AppNameCaption = 1,
00442         ModifiedCaption = 2,
00443         HIGCompliantCaption = AppNameCaption
00444     };
00445     Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
00446 
00447     
00467     static QString makeStandardCaption( const QString &userCaption,
00468                                         QWidget* window = 0,
00469                                         CaptionFlags flags = HIGCompliantCaption );
00470 
00482     static void resizeLayout( QWidget *widget, int margin, int spacing );
00483 
00495     static void resizeLayout( QLayout *lay, int margin, int spacing );
00496 
00506     static void centerOnScreen( QWidget *widget, int screen = -1 );
00507 
00516     static bool avoidArea( QWidget *widget, const QRect& area, int screen = -1 );
00517 
00521     void setMainWidget( QWidget *widget );
00522 
00531     QWidget *mainWidget();
00532 
00536     virtual QSize sizeHint() const;
00537 
00541     virtual QSize minimumSizeHint() const;
00542 
00543   public Q_SLOTS:
00551     virtual void setCaption( const QString &caption );
00552 
00562     virtual void setCaption( const QString &caption, bool modified );
00563 
00570     virtual void setPlainCaption( const QString &caption );
00571 
00578     void enableButton( ButtonCode id, bool state );
00579 
00585     void enableButtonOk( bool state );
00586 
00592     void enableButtonApply( bool state );
00593 
00599     void enableButtonCancel( bool state );
00600 
00610     void enableLinkedHelp( bool state );
00611 
00624     void setHelpLinkText( const QString &text );
00625 
00638     void setHelp( const QString &anchor, const QString &appname = QString() );
00639 
00643     bool isDetailsWidgetVisible() const;
00644 
00648     void setDetailsWidgetVisible( bool visible );
00649 
00656     void setDetailsWidget( QWidget *detailsWidget );
00657 
00664     void delayedDestruct();
00665 
00666   Q_SIGNALS:
00676     void layoutHintChanged();
00677 
00682     void helpClicked();
00683 
00688     void defaultClicked();
00689 
00694     void resetClicked();
00695 
00700     void user3Clicked();
00701 
00706     void user2Clicked();
00707 
00712     void user1Clicked();
00713 
00718     void applyClicked();
00719 
00724     void tryClicked();
00725 
00730     void okClicked();
00731 
00736     void yesClicked();
00737 
00742     void noClicked();
00743 
00748     void cancelClicked();
00749 
00754     void closeClicked();
00755 
00761     void buttonClicked( KDialog::ButtonCode button);
00762 
00770     void hidden();
00771 
00786     void finished();
00787 
00792     void aboutToShowDetails();
00793 
00794   protected:
00799     virtual void hideEvent( QHideEvent * );
00800 
00807     virtual void closeEvent( QCloseEvent *e );
00808 
00812     virtual void keyPressEvent( QKeyEvent* );
00813 
00814   protected Q_SLOTS:
00834     virtual void slotButtonClicked(int button);
00835 
00842     void updateGeometry();
00843 
00844     protected:
00845         KDialog(KDialogPrivate &dd, QWidget *parent, Qt::WFlags flags = 0);
00846         KDialogPrivate *const d_ptr;
00847 
00848     private:
00849         Q_DISABLE_COPY(KDialog)
00850         Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
00851         Q_PRIVATE_SLOT(d_ptr, void helpLinkClicked())
00852 };
00853 
00854 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::ButtonCodes)
00855 Q_DECLARE_OPERATORS_FOR_FLAGS(KDialog::CaptionFlags)
00856 
00857 #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
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
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