radiobutton.h
00001 /* 00002 * radiobutton.h - radio button with focus widget and read-only options 00003 * Program: kalarm 00004 * Copyright © 2002,2003,2005,2006 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef RADIOBUTTON_H 00022 #define RADIOBUTTON_H 00023 00024 #include <tqradiobutton.h> 00025 00026 00042 class RadioButton : public TQRadioButton 00043 { 00044 Q_OBJECT 00045 00046 public: 00051 explicit RadioButton(TQWidget* parent, const char* name = 0); 00057 RadioButton(const TQString& text, TQWidget* parent, const char* name = 0); 00059 bool isReadOnly() const { return mReadOnly; } 00064 virtual void setReadOnly(bool readOnly); 00066 TQWidget* focusWidget() const { return mFocusWidget; } 00073 void setFocusWidget(TQWidget* widget, bool enable = true); 00074 protected: 00075 virtual void mousePressEvent(TQMouseEvent*); 00076 virtual void mouseReleaseEvent(TQMouseEvent*); 00077 virtual void mouseMoveEvent(TQMouseEvent*); 00078 virtual void keyPressEvent(TQKeyEvent*); 00079 virtual void keyReleaseEvent(TQKeyEvent*); 00080 protected slots: 00081 void slotClicked(); 00082 private: 00083 TQ_FocusPolicy mFocusPolicy; // default focus policy for the TQRadioButton 00084 TQWidget* mFocusWidget; // widget to receive focus when button is clicked on 00085 bool mFocusWidgetEnable; // enable focus widget before setting focus 00086 bool mReadOnly; // value cannot be changed 00087 }; 00088 00089 #endif // RADIOBUTTON_H