Click here to Skip to main content
15,886,058 members
Articles / Web Development / HTML

TDL: Protocol for .dan.g.'s ToDoList, Useful for SVN Users

Rate me:
Please Sign up or sign in to vote.
4.43/5 (3 votes)
25 Apr 2008CPOL3 min read 55.7K   509   44  
Register a fake protocol of TDL: to make tdl:///filename.tdl?tid available
////////////////////////////////////////////////////////////
// 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
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

Comments and Discussions