Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

HyperlinkCtrl Struct Reference

Hyperlink Controls. More...

#include <window.h>

Inheritance diagram for HyperlinkCtrl:
Inheritance graph
[legend]
Collaboration diagram for HyperlinkCtrl:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SubclassedWindow super

Public Member Functions

 HyperlinkCtrl (HWND hwnd, COLORREF colorLink=RGB(0, 0, 255), COLORREF colorVisited=RGB(128, 0, 128))
 HyperlinkCtrl (HWND owner, int id, COLORREF colorLink=RGB(0, 0, 255), COLORREF colorVisited=RGB(128, 0, 128))
 ~HyperlinkCtrl ()

Public Attributes

String _cmd

Protected Member Functions

LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
void init ()
bool LaunchLink ()

Protected Attributes

COLORREF _textColor
COLORREF _colorVisited
HFONT _hfont
HCURSOR _crsr_link

Detailed Description

Hyperlink Controls.

Definition at line 815 of file window.h.


Member Typedef Documentation

Reimplemented from SubclassedWindow.

Definition at line 817 of file window.h.


Constructor & Destructor Documentation

HyperlinkCtrl::HyperlinkCtrl ( HWND  hwnd,
COLORREF  colorLink = RGB(0,0,255),
COLORREF  colorVisited = RGB(128,0,128) 
)

Definition at line 1181 of file window.cpp.

References init().

 :  super(hwnd),
    _cmd(ResString(GetDlgCtrlID(hwnd))),
    _textColor(colorLink),
    _colorVisited(colorVisited),
    _hfont(0),
    _crsr_link(0)
{
    init();
}

Here is the call graph for this function:

HyperlinkCtrl::HyperlinkCtrl ( HWND  owner,
int  id,
COLORREF  colorLink = RGB(0,0,255),
COLORREF  colorVisited = RGB(128,0,128) 
)

Definition at line 1192 of file window.cpp.

References init().

 :  super(GetDlgItem(owner, id)),
    _cmd(ResString(id)),
    _textColor(colorLink),
    _colorVisited(colorVisited),
    _hfont(0),
    _crsr_link(0)
{
    init();
}

Here is the call graph for this function:

HyperlinkCtrl::~HyperlinkCtrl (  )

Definition at line 1211 of file window.cpp.

References _hfont.

{
    if (_hfont)
        DeleteObject(_hfont);
}

Member Function Documentation

void HyperlinkCtrl::init (  ) [protected]

Definition at line 1203 of file window.cpp.

References _cmd, WindowHandle::_hwnd, String::assign(), and BUFFER_LEN.

Referenced by HyperlinkCtrl().

{
    if (_cmd.empty()) {
        TCHAR txt[BUFFER_LEN];
        _cmd.assign(txt, GetWindowText(_hwnd, txt, BUFFER_LEN));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool HyperlinkCtrl::LaunchLink (  ) [inline, protected]

Definition at line 836 of file window.h.

References _cmd, and WindowHandle::_hwnd.

Referenced by WndProc().

    {
        if (!_cmd.empty()) {
            HINSTANCE hinst = ShellExecute(GetParent(_hwnd), _T("open"), _cmd, 0, 0, SW_SHOWNORMAL);
            return (int)hinst > HINSTANCE_ERROR;
        }

        return true;
    }

Here is the caller graph for this function:

LRESULT HyperlinkCtrl::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Reimplemented from SubclassedWindow.

Definition at line 1217 of file window.cpp.

References _colorVisited, _crsr_link, _hfont, WindowHandle::_hwnd, _textColor, LaunchLink(), PM_DISPATCH_CTLCOLOR, and SubclassedWindow::WndProc().

{
    switch(nmsg) {
      case PM_DISPATCH_CTLCOLOR: {
        if (!_hfont) {
            HFONT hfont = (HFONT) SendMessage(_hwnd, WM_GETFONT, 0, 0);
            LOGFONT lf; GetObject(hfont, sizeof(lf), &lf);
            lf.lfUnderline = TRUE;
            _hfont = CreateFontIndirect(&lf);
        }

        HDC hdc = (HDC) wparam;
        SetTextColor(hdc, _textColor);  //@@
        SelectFont(hdc, _hfont);
        SetBkMode(hdc, TRANSPARENT);
        return (LRESULT)GetStockObject(HOLLOW_BRUSH);
      }

      case WM_SETCURSOR:
        if (!_crsr_link)
            _crsr_link = LoadCursor(0, IDC_HAND);

        if (_crsr_link)
            SetCursor(_crsr_link);
        return 0;

      case WM_NCHITTEST:
        return HTCLIENT;    // Aktivierung von Maus-Botschaften

      case WM_LBUTTONDOWN:
        if (LaunchLink()) {
            _textColor = _colorVisited;
            InvalidateRect(_hwnd, NULL, FALSE);
        } else
            MessageBeep(0);
        return 0;

      default:
        return super::WndProc(nmsg, wparam, lparam);
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 824 of file window.h.

Referenced by init(), and LaunchLink().

COLORREF HyperlinkCtrl::_colorVisited [protected]

Definition at line 828 of file window.h.

Referenced by WndProc().

HCURSOR HyperlinkCtrl::_crsr_link [protected]

Definition at line 830 of file window.h.

Referenced by WndProc().

HFONT HyperlinkCtrl::_hfont [protected]

Definition at line 829 of file window.h.

Referenced by WndProc(), and ~HyperlinkCtrl().

COLORREF HyperlinkCtrl::_textColor [protected]

Definition at line 827 of file window.h.

Referenced by WndProc().


The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage