Hyperlink Controls. More...
#include <window.h>


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 |
Hyperlink Controls.
Definition at line 815 of file window.h.
| typedef SubclassedWindow HyperlinkCtrl::super |
Reimplemented from SubclassedWindow.
| 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(); }

| 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(); }

| HyperlinkCtrl::~HyperlinkCtrl | ( | ) |
Definition at line 1211 of file window.cpp.
References _hfont.
| 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));
}
}


| 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;
}

| 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);
}
}

Definition at line 824 of file window.h.
Referenced by init(), and LaunchLink().
COLORREF HyperlinkCtrl::_colorVisited [protected] |
HCURSOR HyperlinkCtrl::_crsr_link [protected] |
HFONT HyperlinkCtrl::_hfont [protected] |
Definition at line 829 of file window.h.
Referenced by WndProc(), and ~HyperlinkCtrl().
COLORREF HyperlinkCtrl::_textColor [protected] |
|
ROS Explorer Source Code Documentation
generated on 02.01.2013 by
|