kalarm/lib

label.h

00001 /*
00002  *  label.h  -  label with radiobutton buddy option
00003  *  Program:  kalarm
00004  *  Copyright (C) 2004 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 <qlabel.h>
00025 class QRadioButton;
00026 class LabelFocusWidget;
00027 
00041 class Label : public QLabel
00042 {
00043         Q_OBJECT
00044         friend class LabelFocusWidget;
00045     public:
00051         Label(QWidget* parent, const char* name = 0, WFlags f = 0);
00058         Label(const QString& text, QWidget* parent, const char* name = 0, WFlags f = 0);
00069         Label(QWidget* buddy, const QString& text, QWidget* parent, const char* name = 0, WFlags f = 0);
00074         virtual void      setBuddy(QWidget* buddy);
00075     protected:
00076         virtual void      drawContents(QPainter* p)  { QLabel::drawContents(p); }
00077     private slots:
00078         void              buddyDead();
00079     private:
00080         void              activated();
00081         QRadioButton*     mRadioButton;   // buddy widget if it's a radio button, else 0
00082         LabelFocusWidget* mFocusWidget;
00083 };
00084 
00085 
00086 // Private class for use by Label
00087 class LabelFocusWidget : public QWidget
00088 {
00089         Q_OBJECT
00090     public:
00091         LabelFocusWidget(QWidget* parent, const char* name = 0);
00092     protected:
00093         virtual void focusInEvent(QFocusEvent*);
00094 };
00095 
00096 #endif // LABEL_H
KDE Home | KDE Accessibility Home | Description of Access Keys