Public Types | Public Member Functions | Protected Member Functions

StartButton Struct Reference

special "Start" button with one click activation More...

#include <desktopbar.h>

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

List of all members.

Public Types

typedef PictureButton super

Public Member Functions

 StartButton (HWND hwnd)

Protected Member Functions

LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)

Detailed Description

special "Start" button with one click activation

Definition at line 126 of file desktopbar.h.


Member Typedef Documentation

Reimplemented from PictureButton.

Definition at line 128 of file desktopbar.h.


Constructor & Destructor Documentation

StartButton::StartButton ( HWND  hwnd )

Definition at line 177 of file desktopbar.cpp.

 :  PictureButton(hwnd, SmallIcon(IDI_STARTMENU), GetSysColorBrush(COLOR_BTNFACE))
{
}

Member Function Documentation

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

Here is the call graph for this function:


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