|
////////////////////////////////////////////////////////////
// HyperLinkWrapper class
// Created by J.Fan.
// Wrap a TLabel object and make it like hyper link.
////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
#ifndef HyperlinkWrapperH
#define HyperlinkWrapperH
//---------------------------------------------------------------------------
#include <vcl.h>
class HyperlinkWrapper {
public: class Style {
public: TColor Color;
public: bool Bold;
public: bool Underline;
public: bool Italic;
public: bool Strike;
public: __fastcall Style(TColor color = clBlack, bool bold = false,
bool underline = false, bool italic = false, bool strike = false);
};
private: Style linkStyle;
private: Style hoverStyle;
private: TList* labels;
public: static __fastcall void openUrl(const TCHAR* url);
public: __fastcall HyperlinkWrapper();
public: __property Style LinkStyle = {read = linkStyle, write = setLinkStyle};
public: __property Style HoverStyle = {read = hoverStyle, write = setHoverStyle};
public: void __fastcall wrap(TLabel* label);
private: void __fastcall setLinkStyle(const Style& style);
private: void __fastcall setHoverStyle(const Style& style);
private: void __fastcall onLabelMouseEnter(TObject* sender);
private: void __fastcall onLabelMouseLeave(TObject* sender);
private: void __fastcall applyStyle(TLabel* label, const Style& style);
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
James Fancy, is a software engineer from China. He enjoys and familiar with Java, C++ and some script languages.
If you can read Chinese word, here is one of James Fancy's BLOG:
http://hi.baidu.com/jamesfancy