special "Start" button with one click activation More...
#include <desktopbar.h>
Public Types | |
typedef PictureButton | super |
Public Member Functions | |
StartButton (HWND hwnd) | |
Protected Member Functions | |
LRESULT | WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam) |
special "Start" button with one click activation
Definition at line 126 of file desktopbar.h.
typedef PictureButton StartButton::super |
Reimplemented from PictureButton.
Definition at line 128 of file desktopbar.h.
StartButton::StartButton | ( | HWND | hwnd ) |
Definition at line 177 of file desktopbar.cpp.
: PictureButton(hwnd, SmallIcon(IDI_STARTMENU), GetSysColorBrush(COLOR_BTNFACE)) { }
LRESULT StartButton::WndProc | ( | UINT | nmsg, |
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [protected, virtual] |
Reimplemented from OwnerdrawnButton.
Definition at line 182 of file desktopbar.cpp.
References WindowHandle::_hwnd, ClientToScreen(), HWND, ScreenToClient(), and OwnerdrawnButton::WndProc().
{ switch(nmsg) { // one click activation: handle button-down message, don't wait for button-up case WM_LBUTTONDOWN: if (!Button_GetState(_hwnd)) { Button_SetState(_hwnd, TRUE); SetCapture(_hwnd); SendMessage(GetParent(_hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(_hwnd),0), 0); } Button_SetState(_hwnd, FALSE); break; // re-target mouse move messages while moving the mouse cursor through the start menu case WM_MOUSEMOVE: if (GetCapture() == _hwnd) { POINT pt = {GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)}; ClientToScreen(_hwnd, &pt); HWND hwnd = WindowFromPoint(pt); if (hwnd && hwnd!=_hwnd) { ScreenToClient(hwnd, &pt); SendMessage(hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt.x, pt.y)); } } break; case WM_LBUTTONUP: if (GetCapture() == _hwnd) { ReleaseCapture(); POINT pt = {GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)}; ClientToScreen(_hwnd, &pt); HWND hwnd = WindowFromPoint(pt); if (hwnd && hwnd!=_hwnd) { ScreenToClient(hwnd, &pt); PostMessage(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y)); PostMessage(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(pt.x, pt.y)); } } break; case WM_CANCELMODE: ReleaseCapture(); break; default: return super::WndProc(nmsg, wparam, lparam); } return 0; }
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |