kalarm/lib

radiobutton.h
1 /*
2  * radiobutton.h - radio button with focus widget and read-only options
3  * Program: kalarm
4  * Copyright © 2002,2003,2005,2006 by David Jarvie <software@astrojar.org.uk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef RADIOBUTTON_H
22 #define RADIOBUTTON_H
23 
24 #include <tqradiobutton.h>
25 
26 
42 class RadioButton : public TQRadioButton
43 {
44  TQ_OBJECT
45 
46  public:
51  explicit RadioButton(TQWidget* parent, const char* name = 0);
57  RadioButton(const TQString& text, TQWidget* parent, const char* name = 0);
59  bool isReadOnly() const { return mReadOnly; }
64  virtual void setReadOnly(bool readOnly);
66  TQWidget* focusWidget() const { return mFocusWidget; }
73  void setFocusWidget(TQWidget* widget, bool enable = true);
74  protected:
75  virtual void mousePressEvent(TQMouseEvent*);
76  virtual void mouseReleaseEvent(TQMouseEvent*);
77  virtual void mouseMoveEvent(TQMouseEvent*);
78  virtual void keyPressEvent(TQKeyEvent*);
79  virtual void keyReleaseEvent(TQKeyEvent*);
80  protected slots:
81  void slotClicked();
82  private:
83  TQWidget::FocusPolicy mFocusPolicy; // default focus policy for the TQRadioButton
84  TQWidget* mFocusWidget; // widget to receive focus when button is clicked on
85  bool mFocusWidgetEnable; // enable focus widget before setting focus
86  bool mReadOnly; // value cannot be changed
87 };
88 
89 #endif // RADIOBUTTON_H
A TQRadioButton with focus widget and read-only options.
Definition: radiobutton.h:43
bool isReadOnly() const
Returns true if the widget is read only.
Definition: radiobutton.h:59
virtual void setReadOnly(bool readOnly)
Sets whether the radio button is read-only for the user.
Definition: radiobutton.cpp:42
void setFocusWidget(TQWidget *widget, bool enable=true)
Specifies a widget to receive focus when the button is clicked.
Definition: radiobutton.cpp:56
RadioButton(TQWidget *parent, const char *name=0)
Constructor.
Definition: radiobutton.cpp:24
TQWidget * focusWidget() const
Returns the widget which receives focus when the button is clicked.
Definition: radiobutton.h:66