Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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

, 25 Apr 2008 CPOL
Register a fake protocol of TDL: to make tdl:///filename.tdl?tid available
#pragma hdrstop
#include "HyperlinkWrapper.h"

#pragma package(smart_init)

__fastcall HyperlinkWrapper::Style::Style(TColor color, bool bold,
    bool underline, bool italic, bool strike)
    : Color(color), Bold(bold), Underline(underline), Italic(italic), Strike(strike) {}

void __fastcall HyperlinkWrapper::openUrl(const TCHAR* url) {
    ShellExecute(Application->Handle, TEXT("open"), url, NULL, NULL, SW_SHOW);

__fastcall HyperlinkWrapper::HyperlinkWrapper() {
    labels = new TList();

void __fastcall HyperlinkWrapper::wrap(TLabel* label) {
    applyStyle(label, linkStyle);
    label->Cursor = crHandPoint;
    label->OnMouseEnter = onLabelMouseEnter;
    label->OnMouseLeave = onLabelMouseLeave;    

void __fastcall HyperlinkWrapper::setLinkStyle(const Style& style) {
    linkStyle = style;
    for (int i = 0; i < labels->Count; i++) {
        applyStyle((TLabel*) labels->Items[i], linkStyle);

void __fastcall HyperlinkWrapper::setHoverStyle(const Style& style) {
    hoverStyle = style;

void __fastcall HyperlinkWrapper::onLabelMouseEnter(TObject* sender) {
    TLabel* label = (TLabel*) sender;
    applyStyle(label, hoverStyle);

void __fastcall HyperlinkWrapper::onLabelMouseLeave(TObject* sender) {
    TLabel* label = (TLabel*) sender;
    applyStyle(label, linkStyle);

void __fastcall HyperlinkWrapper::applyStyle(TLabel* label, const Style& style) {
    label->Font->Color = style.Color;
    TFontStyles styles;
    if (style.Bold) styles << fsBold;
    if (style.Underline) styles << fsUnderline;
    if (style.Italic) styles << fsItalic;
    if (style.Strike) styles << fsStrikeOut;
    label->Font->Style = styles; 

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.


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


About the Author


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:

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150302.1 | Last Updated 25 Apr 2008
Article Copyright 2007 by jamesfancy
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid