label.h
00001 /* 00002 * label.h - label with radiobutton buddy option 00003 * Program: kalarm 00004 * Copyright © 2004-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 LABEL_H 00022 #define LABEL_H 00023 00024 #include <tqlabel.h> 00025 class TQRadioButton; 00026 class LabelFocusWidget; 00027 00041 class Label : public TQLabel 00042 { 00043 Q_OBJECT 00044 00045 friend class LabelFocusWidget; 00046 public: 00052 explicit Label(TQWidget* parent, const char* name = 0, WFlags f = 0); 00059 Label(const TQString& text, TQWidget* parent, const char* name = 0, WFlags f = 0); 00070 Label(TQWidget* buddy, const TQString& text, TQWidget* parent, const char* name = 0, WFlags f = 0); 00075 virtual void setBuddy(TQWidget* buddy); 00076 protected: 00077 virtual void drawContents(TQPainter* p) { TQLabel::drawContents(p); } 00078 private slots: 00079 void buddyDead(); 00080 private: 00081 void activated(); 00082 TQRadioButton* mRadioButton; // buddy widget if it's a radio button, else 0 00083 LabelFocusWidget* mFocusWidget; 00084 }; 00085 00086 00087 // Private class for use by Label 00088 class LabelFocusWidget : public TQWidget 00089 { 00090 Q_OBJECT 00091 00092 public: 00093 LabelFocusWidget(TQWidget* parent, const char* name = 0); 00094 protected: 00095 virtual void focusInEvent(TQFocusEvent*); 00096 }; 00097 00098 #endif // LABEL_H