00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YQGenericButton.h 00014 00015 Author: Stefan Hundhammer <sh@suse.de> 00016 00017 /-*/ 00018 00019 // -*- c++ -*- 00020 00021 #ifndef YQGenericButton_h 00022 #define YQGenericButton_h 00023 00024 #include <qwidget.h> 00025 #include <ycp/YCPString.h> 00026 00027 #include "YPushButton.h" 00028 00029 00030 class QPushButton; 00031 class QObject; 00032 class YQDialog; 00033 00038 class YQGenericButton : public QWidget, public YPushButton 00039 { 00040 Q_OBJECT 00041 00042 protected: 00043 00047 YQGenericButton( QWidget * parent, 00048 YQDialog * dialog, 00049 const YWidgetOpt & opt, 00050 YCPString label ); 00051 00052 public: 00053 00057 virtual ~YQGenericButton(); 00058 00063 void setEnabling( bool enabled ); 00064 00068 bool isEnabled() const; 00069 00073 void setLabel( const QString & label ); 00074 00078 void setLabel( const YCPString & label ); 00079 00084 void showAsDefault( bool show = true ); 00085 00093 bool isShownAsDefault() const; 00094 00100 bool isDefault() const { return _isDefault; } 00101 00105 void setDefault( bool def = true ) { _isDefault = def; } 00106 00110 virtual bool setKeyboardFocus(); 00111 00116 virtual void setIcon( const YCPString & icon_name ); 00117 00121 QString text() const; 00122 00126 QPushButton * qPushButton() const { return _qPushButton; } 00127 00131 YQDialog * yQDialog() const { return _dialog; } 00132 00133 00134 public slots: 00135 00139 void activate(); 00140 00141 00142 protected: 00143 00147 void setQPushButton( QPushButton * pb ); 00148 00154 bool eventFilter( QObject * obj, QEvent * event ); 00155 00156 00157 private: 00158 00159 // Data members 00160 00161 YQDialog * _dialog; 00162 QPushButton * _qPushButton; 00163 bool _isDefault; 00164 }; 00165 00166 #endif // YQGenericButton_h