libyui-qt
YQGenericButton.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQGenericButton.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQGenericButton_h
27 #define YQGenericButton_h
28 
29 #include <qwidget.h>
30 
31 #include <yui/YPushButton.h>
32 
33 
34 class QPushButton;
35 class QObject;
36 class YQDialog;
37 
38 using std::string;
39 
44 class YQGenericButton : public QWidget, public YPushButton
45 {
46  friend class YQDialog;
47 
48  Q_OBJECT
49 
50 protected:
51 
55  YQGenericButton( YWidget * parent,
56  const std::string & label );
57 
58 public:
59 
63  virtual ~YQGenericButton();
64 
70  virtual void setEnabled( bool enabled );
71 
75  bool isEnabled() const;
76 
80  void setLabel( const QString & label );
81 
87  virtual void setLabel( const std::string & label );
88 
93  void showAsDefault( bool show = true );
94 
102  bool isShownAsDefault() const;
103 
107  virtual bool setKeyboardFocus();
108 
114  virtual void setIcon( const std::string & iconName );
115 
119  QString text() const;
120 
124  QPushButton * qPushButton() const { return _qPushButton; }
125 
129  YQDialog * yQDialog() const { return _dialog; }
130 
134  void setShortcut ( const QKeySequence & key );
135 
136 public slots:
137 
141  void activate();
142 
143 
144 protected:
145 
149  void setQPushButton( QPushButton * pb );
150 
156  bool eventFilter( QObject * obj, QEvent * event );
157 
162  YQDialog * dialog();
163 
164  void forgetDialog();
165 
166 private:
167 
168  YQDialog * _dialog;
169  QPushButton * _qPushButton;
170 };
171 
172 #endif // YQGenericButton_h
void setQPushButton(QPushButton *pb)
Definition: YQGenericButton.cc:55
virtual void setIcon(const std::string &iconName)
Definition: YQGenericButton.cc:116
void activate()
Definition: YQGenericButton.cc:191
void showAsDefault(bool show=true)
Definition: YQGenericButton.cc:167
virtual ~YQGenericButton()
Definition: YQGenericButton.cc:65
YQDialog * dialog()
Definition: YQGenericButton.cc:85
bool isEnabled() const
Definition: YQGenericButton.cc:110
YQDialog * yQDialog() const
Definition: YQGenericButton.h:129
bool eventFilter(QObject *obj, QEvent *event)
Definition: YQGenericButton.cc:198
virtual bool setKeyboardFocus()
Definition: YQGenericButton.cc:229
virtual void setEnabled(bool enabled)
Definition: YQGenericButton.cc:101
bool isShownAsDefault() const
Definition: YQGenericButton.cc:178
void setShortcut(const QKeySequence &key)
Definition: YQGenericButton.cc:240
Definition: YQGenericButton.h:44
QPushButton * qPushButton() const
Definition: YQGenericButton.h:124
QString text() const
Definition: YQGenericButton.cc:185
Definition: YQDialog.h:42
void setLabel(const QString &label)
Definition: YQGenericButton.cc:145
YQGenericButton(YWidget *parent, const std::string &label)
Definition: YQGenericButton.cc:44