kalarm/lib

pushbutton.h
1 /*
2  * pushbutton.h - push button with read-only option
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 PUSHBUTTON_H
22 #define PUSHBUTTON_H
23 
24 #include <tqpushbutton.h>
25 
26 
37 class PushButton : public TQPushButton
38 {
39  TQ_OBJECT
40 
41  TQ_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
42  public:
47  explicit PushButton(TQWidget* parent, const char* name = 0);
53  PushButton(const TQString& text, TQWidget* parent, const char* name = 0);
60  PushButton(const TQIconSet& icon, const TQString& text, TQWidget* parent, const char* name = 0);
64  virtual void setReadOnly(bool readOnly);
66  virtual bool isReadOnly() const { return mReadOnly; }
67  protected:
68  virtual void mousePressEvent(TQMouseEvent*);
69  virtual void mouseReleaseEvent(TQMouseEvent*);
70  virtual void mouseMoveEvent(TQMouseEvent*);
71  virtual void keyPressEvent(TQKeyEvent*);
72  virtual void keyReleaseEvent(TQKeyEvent*);
73  private:
74  TQWidget::FocusPolicy mFocusPolicy; // default focus policy for the TQPushButton
75  bool mReadOnly; // value cannot be changed
76 };
77 
78 #endif // PUSHBUTTON_H
A TQPushButton with read-only option.
Definition: pushbutton.h:38
virtual void setReadOnly(bool readOnly)
Sets whether the push button is read-only for the user.
Definition: pushbutton.cpp:42
PushButton(TQWidget *parent, const char *name=0)
Constructor.
Definition: pushbutton.cpp:24
virtual bool isReadOnly() const
Returns true if the widget is read only.
Definition: pushbutton.h:66