00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQDialog.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Stefan Hundhammer <sh@suse.de> 00017 00018 /-*/ 00019 00020 // -*- c++ -*- 00021 00022 #ifndef YQDialog_h 00023 #define YQDialog_h 00024 00025 #include <qwidget.h> 00026 #include "YDialog.h" 00027 00028 00029 class YQGenericButton; 00030 class YQWizard; 00031 class QFrame; 00032 00033 00034 class YQDialog : public QWidget, public YDialog 00035 { 00036 Q_OBJECT 00037 00038 public: 00042 YQDialog( const YWidgetOpt & opt, 00043 QWidget * qt_parent = 0, 00044 bool default_size = false ); 00045 00049 ~YQDialog(); 00050 00054 void activate( bool active ); 00055 00060 void closeEvent( QCloseEvent * ev ); 00061 00065 long nicesize( YUIDimension dim ); 00066 00072 long decorationWidth( YUIDimension dim ); 00073 00077 YQGenericButton * findDefaultButton(); 00078 00084 void setEnabling( bool enabled ); 00085 00089 void setSize( long newWidth, long newHeight ); 00090 00094 bool userResized() { return _userResized; } 00095 00100 YQGenericButton * focusButton() const { return _focusButton; } 00101 00106 YQGenericButton * defaultButton() const { return _defaultButton; } 00107 00114 void losingFocus( YQGenericButton * button ); 00115 00122 void gettingFocus( YQGenericButton * button ); 00123 00129 void setDefaultButton( YQGenericButton * newDefaultButton ); 00130 00134 void ensureOnlyOneDefaultButton(); 00135 00140 bool activateDefaultButton( bool warn = true ); 00141 00146 YQWizard * findWizard() const; 00147 00152 YQGenericButton * wizardDefaultButton( YQWizard * wizard ) const; 00153 00161 static void center( QWidget * dialog, QWidget * parent = 0 ); 00162 00163 00164 protected: 00165 00170 void childAdded( YWidget * child ); 00171 00178 void keyPressEvent( QKeyEvent * e ); 00179 00180 00186 void focusInEvent( QFocusEvent * event ); 00187 00193 void resizeEvent ( QResizeEvent * ev ); 00194 00195 00199 void show(); 00200 00201 00202 // 00203 // Data members 00204 // 00205 00206 QFrame * _qFrame; 00207 00208 bool _userResized; 00209 QSize _userSize; 00210 00211 YQGenericButton * _focusButton; 00212 YQGenericButton * _defaultButton; 00213 }; 00214 00215 00216 #endif // YQDialog_h 00217