kalarm/lib

label.h
1 /*
2  * label.h - label with radiobutton buddy option
3  * Program: kalarm
4  * Copyright © 2004-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 LABEL_H
22 #define LABEL_H
23 
24 #include <tqlabel.h>
25 class TQRadioButton;
26 class LabelFocusWidget;
27 
41 class Label : public TQLabel
42 {
43  TQ_OBJECT
44 
45  friend class LabelFocusWidget;
46  public:
52  explicit Label(TQWidget* parent, const char* name = 0, WFlags f = 0);
59  Label(const TQString& text, TQWidget* parent, const char* name = 0, WFlags f = 0);
70  Label(TQWidget* buddy, const TQString& text, TQWidget* parent, const char* name = 0, WFlags f = 0);
75  virtual void setBuddy(TQWidget* buddy);
76  protected:
77  virtual void drawContents(TQPainter* p) { TQLabel::drawContents(p); }
78  private slots:
79  void buddyDead();
80  private:
81  void activated();
82  TQRadioButton* mRadioButton; // buddy widget if it's a radio button, else 0
83  LabelFocusWidget* mFocusWidget;
84 };
85 
86 
87 // Private class for use by Label
88 class LabelFocusWidget : public TQWidget
89 {
90  TQ_OBJECT
91 
92  public:
93  LabelFocusWidget(TQWidget* parent, const char* name = 0);
94  protected:
95  virtual void focusInEvent(TQFocusEvent*);
96 };
97 
98 #endif // LABEL_H
A TQLabel with option for a buddy radio button.
Definition: label.h:42
Label(TQWidget *parent, const char *name=0, WFlags f=0)
Constructs an empty label.
Definition: label.cpp:26
virtual void setBuddy(TQWidget *buddy)
Sets the label's buddy widget which receives the keyboard focus when the label's accelerator key is p...
Definition: label.cpp:50