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 <tqlabel.h> 00025 00026 #include <kdelibs_export.h> 00027 00028 class TQColor; 00029 class TQCursor; 00030 class TQPixmap; 00031 00071 class KDEUI_EXPORT KURLLabel : public TQLabel 00072 { 00073 Q_OBJECT 00074 Q_PROPERTY (TQString url READ url WRITE setURL) 00075 Q_PROPERTY (TQString tipText READ tipText WRITE setTipText ) 00076 Q_PROPERTY (TQPixmap 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 (TQWidget* parent = 0L, const char* name = 0L); 00090 00103 KURLLabel (const TQString& url, const TQString& text = TQString::null, 00104 TQWidget* parent = 0L, const char* name = 0L); 00105 00109 virtual ~KURLLabel (); 00110 00114 const TQString& url () const; 00115 00119 const TQString& 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 TQPixmap* altPixmap () const; 00155 00159 virtual void setMargin ( int margin ); 00160 00164 #ifdef qdoc 00165 #else 00166 virtual void setFocusPolicy ( TQ_FocusPolicy policy ); 00167 #endif 00168 00172 virtual void setSizePolicy ( TQSizePolicy ); 00173 00174 public slots: 00181 void setUnderline (bool on = true); 00182 00188 void setURL (const TQString& url); 00189 00193 virtual void setFont (const TQFont&); 00194 00202 void setUseTips (bool on = true); 00203 00211 void setTipText (const TQString& tip); 00212 00219 void setHighlightedColor(const TQColor& highcolor); 00220 00226 void setHighlightedColor(const TQString& highcolor); 00227 00235 void setSelectedColor(const TQColor& selcolor); 00236 00242 void setSelectedColor(const TQString& selcolor); 00243 00247 virtual void setCursor ( const TQCursor& cursor ); 00248 00252 virtual void unsetCursor (); 00253 00264 void setUseCursor (bool on, TQCursor* cursor = 0L); 00265 00273 void setGlow (bool glow = true); 00274 00286 void setFloat (bool do_float = true); 00287 00297 void setAltPixmap (const TQPixmap& altPix); 00298 00299 signals: 00300 00306 void enteredURL (const TQString& url); 00307 00311 void enteredURL (); 00312 00318 void leftURL (const TQString& url); 00319 00323 void leftURL (); 00324 00330 void leftClickedURL(const TQString& url); 00331 00335 void leftClickedURL(); 00336 00342 void rightClickedURL(const TQString& url); 00343 00347 void rightClickedURL(); 00348 00354 void middleClickedURL(const TQString& url); 00355 00359 void middleClickedURL(); 00360 00361 protected: 00362 00366 virtual void mouseReleaseEvent ( TQMouseEvent * e ); 00367 00371 virtual void enterEvent (TQEvent*); 00372 00376 virtual void leaveEvent (TQEvent*); 00377 00381 virtual bool event (TQEvent *e); 00382 00386 TQRect activeRect() const; 00387 00388 00389 private slots: 00394 void updateColor (); 00395 00396 private: 00401 void setLinkColor (const TQColor& col); 00402 00403 protected: 00404 virtual void virtual_hook( int id, void* data ); 00405 private: 00406 class Private; 00407 Private* d; 00408 }; 00409 00410 #endif // KURLLABEL_H 00411