kurllabel.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1998 Kurt Granroth <granroth@kde.org>
00003    Copyright (C) 2000 Peter Putzer <putzer@kde.org>
00004    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KURLLABEL_H
00022 #define KURLLABEL_H
00023 
00024 #include <qlabel.h>
00025 
00026 #include <kdelibs_export.h>
00027 
00028 class QColor;
00029 class QCursor;
00030 class QPixmap;
00031 
00071 class KDEUI_EXPORT KURLLabel : public QLabel
00072 {
00073   Q_OBJECT
00074   Q_PROPERTY (QString url READ url WRITE setURL)
00075   Q_PROPERTY (QString tipText READ tipText WRITE setTipText )
00076   Q_PROPERTY (QPixmap altPixmap READ altPixmap WRITE setAltPixmap)
00077   Q_PROPERTY (bool glowEnabled READ isGlowEnabled WRITE setGlow )
00078   Q_PROPERTY (bool floatEnabled READ isFloatEnabled WRITE setFloat )
00079   Q_PROPERTY (bool useTips READ useTips WRITE setUseTips )
00080   Q_PROPERTY (bool useCursor READ useCursor WRITE setUseCursor )
00081 
00082 public:
00089   KURLLabel (QWidget* parent = 0L, const char* name = 0L);
00090 
00103   KURLLabel (const QString& url, const QString& text = QString::null,
00104               QWidget* parent = 0L, const char* name = 0L);
00105 
00109   virtual ~KURLLabel ();
00110 
00114   const QString& url () const;
00115 
00119   const QString& tipText () const;
00120 
00126   bool useTips () const;
00127 
00133   bool useCursor () const;
00134 
00139   bool isGlowEnabled () const;
00140 
00149   bool isFloatEnabled () const;
00150 
00154   const QPixmap* altPixmap () const;
00155 
00156 public slots:
00163   void setUnderline (bool on = true);
00164 
00170   void setURL (const QString& url);
00171 
00175   virtual void setFont (const QFont&);
00176 
00184   void setUseTips (bool on = true);
00185 
00193   void setTipText (const QString& tip);
00194 
00201   void setHighlightedColor(const QColor& highcolor);
00202 
00208   void setHighlightedColor(const QString& highcolor);
00209 
00217   void setSelectedColor(const QColor& selcolor);
00218 
00224   void setSelectedColor(const QString& selcolor);
00225 
00236   void setUseCursor (bool on, QCursor* cursor = 0L);
00237 
00245   void setGlow (bool glow = true);
00246 
00258   void setFloat (bool do_float = true);
00259 
00269   void setAltPixmap (const QPixmap& altPix);
00270 
00271 signals:
00272 
00278   void enteredURL (const QString& url);
00279 
00283   void enteredURL ();
00284 
00290   void leftURL (const QString& url);
00291 
00295   void leftURL ();
00296 
00302   void leftClickedURL(const QString& url);
00303 
00307   void leftClickedURL();
00308 
00314   void rightClickedURL(const QString& url);
00315 
00319   void rightClickedURL();
00320 
00326   void middleClickedURL(const QString& url);
00327 
00331   void middleClickedURL();
00332 
00333 protected:
00334 
00338   virtual void mouseReleaseEvent (QMouseEvent*);
00339 
00343   virtual void enterEvent (QEvent*);
00344 
00348   virtual void leaveEvent (QEvent*);
00349 
00353   virtual bool event (QEvent *e);
00354 
00355 
00356 private slots:
00361   void updateColor ();
00362 
00363 private:
00368   void setLinkColor (const QColor& col);
00369 
00370 protected:
00371   virtual void virtual_hook( int id, void* data );
00372 private:
00373   class Private;
00374   Private* d;
00375 };
00376 
00377 #endif // KURLLABEL_H
KDE Home | KDE Accessibility Home | Description of Access Keys