Example #1
0
   LRESULT CALLBACK Splitter::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam)
   {
      switch(message) {
      case WM_SIZE:
         Size(LOWORD(lParam), HIWORD(lParam));
         return 0;
      case WM_PAINT:
         Paint();
         return 0;
      case WM_LBUTTONDOWN:
         LButtonDown(MAKEPOINTS(lParam));
         return 0;
      case WM_LBUTTONUP:
         LButtonUp(MAKEPOINTS(lParam));
         return 0;
      case WM_MOUSEMOVE:
         if(wParam & MK_LBUTTON)
            LButtonDrag(MAKEPOINTS(lParam));
         return 0;
      case WM_CAPTURECHANGED:
         CaptureChanged();
         return 0;
      }

      return Window::ProcessMessage(message, wParam, lParam);
   }
Example #2
0
LRESULT CDreamSkinSpinCtrl::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT nResult = ERROR_SUCCESS;

	switch(message)
	{
	case WM_ERASEBKGND:
		break;
	case WM_LBUTTONDBLCLK:
		nResult = ::SendMessageW(m_hWnd, WM_LBUTTONDOWN, wParam, lParam);
		break;
	case WM_LBUTTONDOWN:
		nResult = OnLButtonDown(wParam, MAKEPOINTS(lParam));
		break;
	case WM_LBUTTONUP:
		nResult = OnLButtonUp(wParam, MAKEPOINTS(lParam));
		break;
	case WM_MOUSELEAVE:
		nResult = OnMouseLeave();
		break;
	case WM_MOUSEMOVE:
		nResult = OnMouseMove(wParam, MAKEPOINTS(lParam));
		break;
	case WM_PAINT:
		nResult = OnPaint();
		break;
	default:
		nResult = CDreamSkinWindow::DefWindowProc(message, wParam, lParam);
	}

	return nResult;
}
Example #3
0
LRESULT CALLBACK CWndSplitter::_wndProc(HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp)
{
	CWndSplitter *pThis = (CWndSplitter*) GetWindowLong (hWnd, GWL_USERDATA);

	switch (uMsg)
	{
		case WM_PAINT:
			pThis->OnPaint ();			
			return 0;

		case WM_LBUTTONDOWN:
			pThis->OnLButtonDown ();
			break;

		case WM_MOUSEMOVE:
			if (wp & MK_LBUTTON)
				pThis->OnMouseDrag (MAKEPOINTS (lp));
			return 0;

		case WM_LBUTTONUP:
			pThis->OnLButtonUp (MAKEPOINTS (lp));
			return 0;

		case WM_CAPTURECHANGED:
			pThis->OnCaptureChanged ();
			return 0;
	}

	return DefWindowProc (hWnd, uMsg, wp, lp);
}
Example #4
0
LRESULT
CALLBACK
DetourWindowProc ( _In_  HWND   hWnd,
                   _In_  UINT   uMsg,
                   _In_  WPARAM wParam,
                   _In_  LPARAM lParam )
{
  if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) {
    static POINT last_p = { LONG_MIN, LONG_MIN };

    POINT p;

    p.x = MAKEPOINTS (lParam).x;
    p.y = MAKEPOINTS (lParam).y;

    if (game_state.needsFixedMouseCoords () && config.render.aspect_correction) {
      // Only do this if cursor actually moved!
      //
      //   Otherwise, it tricks the game into thinking the input device changed
      //     from gamepad to mouse (and changes button icons).
      if (last_p.x != p.x || last_p.y != p.y) {
        CalcCursorPos (&p);

        last_p = p;
      }

      return DetourWindowProc_Original (hWnd, uMsg, wParam, MAKELPARAM (p.x, p.y));
    }

    last_p = p;
  }

  return DetourWindowProc_Original (hWnd, uMsg, wParam, lParam);
}
Example #5
0
//-----------------------------------------------------------------------------
// Name: MouseDown
// Object: should be call on a WM_LBUTTONDOWN message
// Parameters : 
//     in : LPARAM lParam : lParam of WndProc associated with WM_LBUTTONDOWN message
// Return : TRUE on success
//-----------------------------------------------------------------------------
BOOL CSelectWindow::MouseDown(LPARAM lParam)
{
    POINT pt;
    pt.x = MAKEPOINTS(lParam).x;
    pt.y = MAKEPOINTS(lParam).y; 
    ClientToScreen (hDlg, &pt);

    return this->MouseDown(pt);
}
BOOL CALLBACK HandleDialog(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) 
{
	DATA data;
	HDC hdc;
	PAINTSTRUCT ps;
	static HANDLE hThread;

	switch(iMsg)
	{
	case WM_INITDIALOG:
		if( !InitSocket() )
			return TRUE;
		hThread = (HANDLE)_beginthread(ClientThread, NULL, NULL);
		return TRUE;
	case WM_LBUTTONDOWN:
		data.type = 0;
		data.pt = MAKEPOINTS(lParam);
		
		send(sClient, (char*)&data, sizeof(DATA), 0);
		return TRUE;
	case WM_RBUTTONDOWN:
		data.type = 1;
		data.pt = MAKEPOINTS(lParam);
		send(sClient, (char*)&data, sizeof(DATA), 0);
		return TRUE;
	case WM_PAINT:
		hdc = BeginPaint(hwnd, &ps);
		if(g_data.type == 0)
			Rectangle(hdc, g_data.pt.x, g_data.pt.y, g_data.pt.x+30, g_data.pt.y+30);
		else if(g_data.type==1)
			Ellipse(hdc, g_data.pt.x, g_data.pt.y, g_data.pt.x+30, g_data.pt.y+30);
		EndPaint(hwnd, &ps);
		return TRUE;
	case WM_COMMAND:
		switch(wParam) 
		{
		case IDC_EXIT:
			data.type = 2;
			send(sClient, (char*)&data, sizeof(DATA), 0);
			DestroyWindow(hwnd);
		}
		return TRUE;
	case WM_DESTROY:
		PostQuitMessage(0);
		return TRUE;
	default :
		break;
	}
	return 0L;
}
Example #7
0
LRESULT CALLBACK ElasticLines_MessageHandler( HWND hwnd, UINT msg, WPARAM w, LPARAM l ){
	HDC hdc;
	static POINTS ptsBegin, ptsPrevEnd, ptsEnd;
	COLORREF bgcolor = 0x00ffffff;

	switch( msg ){
	case WM_LBUTTONDOWN:
		SetCapture( hwnd );
		ptsBegin = MAKEPOINTS( l );
		ptsPrevEnd = ptsBegin;

	break;
	case WM_MOUSEMOVE:
		if ( w & MK_LBUTTON ){
			hdc = GetDC( hwnd );
			HPEN hpen = CreatePen( PS_DASHDOTDOT, 1, bgcolor );
			//HPEN redpen = CreatePen( PS_DASHDOTDOT, 1, 0x000000ff );
			HPEN hOldPen =(HPEN) SelectObject( hdc, hpen );

			MoveToEx( hdc, ptsBegin.x, ptsBegin.y, NULL );
			LineTo	( hdc, ptsPrevEnd.x, ptsPrevEnd.y );
			
			ptsEnd = MAKEPOINTS( l );
			SelectObject( hdc, hOldPen );
			MoveToEx( hdc, ptsBegin.x, ptsBegin.y, NULL );
			LineTo( hdc, ptsEnd.x, ptsEnd.y);

			ptsPrevEnd = ptsEnd;
			
			ReleaseDC( hwnd, hdc );
		}
	break;
	case WM_LBUTTONUP:
		ReleaseCapture();

	break;
	case WM_CLOSE:
		DestroyWindow( hwnd );
	break;
	case WM_DESTROY:
		PostQuitMessage( 0 );
	break;
	default:
		return DefWindowProc( hwnd, msg, w, l );
	}

	return 0;
}
Example #8
0
	LRESULT Win32Window::wndProc(UINT msg, WPARAM wParam, LPARAM lParam) {
		if(msg == WM_CLOSE) {
			PostQuitMessage(0);
		}

		switch(msg) {
		case WM_SIZE:
			onResize(ResizeEvent(LOWORD(lParam), HIWORD(lParam)));
			break;

		case WM_KEYDOWN:
			onKeyDown(KeyEvent(wParam));
			break;

		case WM_KEYUP:
			onKeyUp(KeyEvent(wParam));
			break;

		case WM_MOUSEMOVE:
			POINTS pt = MAKEPOINTS(lParam);
			break;
		}

		return DefWindowProc(hwnd, msg, wParam, lParam);
	}
Example #9
0
BOOL WINAPI _GetCursorPos(LPPOINT lpPoint)
{
  if ( !lpPoint )
    return FALSE;

  if ( !wmode )
  {
    if ( _GetCursorPosOld )
      return _GetCursorPosOld(lpPoint);
    return GetCursorPos(lpPoint);
  }

  if ( !gbHoldingAlt )
  {
    lpPoint->x = 320;
    lpPoint->y = 240;
  }
  else
  {
    POINT tempPoint;
    if ( _GetCursorPosOld )
      _GetCursorPosOld(&tempPoint);
    else
      GetCursorPos(&tempPoint);
    ScreenToClient(ghMainWnd, &tempPoint);

    LPARAM lConvert = FixPoints(MAKELPARAM(tempPoint.x, tempPoint.y));
    POINTS final = MAKEPOINTS(lConvert);
    lpPoint->x = final.x;
    lpPoint->y = final.y;
  }
  return TRUE;
}
LRESULT WebPopupMenuProxyWin::onLButtonDown(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
    handled = true;

    IntPoint mousePoint(MAKEPOINTS(lParam));
    if (scrollbar()) {
        IntRect scrollBarRect = scrollbar()->frameRect();
        if (scrollBarRect.contains(mousePoint)) {
            // Put the point into coordinates relative to the scroll bar
            mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y());
            PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y()));
            scrollbar()->mouseDown(event);
            setScrollbarCapturingMouse(true);
            return 0;
        }
    }

    // If the mouse is inside the window, update the focused index. Otherwise, 
    // hide the popup.
    RECT bounds;
    ::GetClientRect(m_popup, &bounds);
    if (::PtInRect(&bounds, mousePoint))
        setFocusedIndex(listIndexAtPoint(mousePoint), true);
    else
        hide();

    return 0;
}
Example #11
0
LRESULT CTaskbarNotifier::OnMouseHover(WPARAM /*wParam*/, LPARAM lParam)
{
	if (m_nAnimStatus == IDT_WAITING)
		KillTimer(IDT_WAITING);

	POINTS mp;
	mp = MAKEPOINTS(lParam);
	m_ptMousePosition.x = mp.x;
	m_ptMousePosition.y = mp.y;

	if (m_bMouseIsOver == FALSE)
	{
		m_bMouseIsOver = TRUE;
		RedrawWindow(&m_rcText);
	}
	else if (m_rcText.PtInRect(m_ptMousePosition))
	{
		if (!m_bTextSelected)
			RedrawWindow(&m_rcText);
	}
	else
	{
		if (m_bTextSelected)
			RedrawWindow(&m_rcText);
	}

	return 0;
}
BOOL CXTPDatePickerList::IsSelected(int nX, CRect rcItem) const
{
	BOOL bReturn = FALSE;

	// determine cursor position
	DWORD dwPos = ::GetMessagePos();
	POINTS ptsPos = MAKEPOINTS(dwPos);
	CPoint ptPos;
	ptPos.x = ptsPos.x;
	ptPos.y = ptsPos.y;

	ScreenToClient(&ptPos);

	CRect rcClient;
	GetClientRect(rcClient);

	if (ptPos.x < rcClient.left || ptPos.x > rcClient.right ||
		ptPos.y < rcClient.top || ptPos.y > rcClient.bottom)
		return FALSE;

	if (ptPos.y < 0 && nX == 0)
		bReturn = TRUE;
	else if (ptPos.y > rcClient.Height() && nX == (m_nItemsBelow + m_nItemsAbove))
		bReturn = TRUE;
	else if (ptPos.y >= rcItem.top && ptPos.y <= rcItem.bottom-1)
		bReturn = TRUE;

	return bReturn;
}
void CXTPDatePickerList::OnTimer(UINT_PTR /*nIDEvent*/)
{
	// determine cursor position
	DWORD dwPos = ::GetMessagePos();
	POINTS ptsPos = MAKEPOINTS(dwPos);
	CPoint ptPos;
	ptPos.x = ptsPos.x;
	ptPos.y = ptsPos.y;

	CRect rcClient;
	GetClientRect(rcClient);
	ClientToScreen(rcClient);

	if (ptPos.y < rcClient.top)
	{
		int nDiff = rcClient.top - ptPos.y;
		int nScroll = nDiff / rcClient.Height() + 1;
		ScrollUp(nScroll);

		Invalidate();
	}
	else if (ptPos.y > rcClient.bottom)
	{
		int nDiff = ptPos.y - rcClient.bottom;
		int nScroll = nDiff / rcClient.Height() + 1;
		ScrollDown(nScroll);

		Invalidate();
	}
}
Example #14
0
// 主窗口的消息处理函数
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
    switch (message)
    {
    case WM_ERASEBKGND:         // 不清除背景,避免闪烁
        break;
    case WM_PAINT:              // 重绘主窗口
        ondraw(hwnd);
        break;
    case WM_SIZE:               // 改变窗口大小
        regen(hwnd);
        break;
    case WM_DESTROY:            // 退出
        PostQuitMessage(0);
        break;
    case WM_LBUTTONDBLCLK:      // 双击切换测试图形
        switchTest(hwnd);
        break;
    case WM_MOUSEMOVE:          // 鼠标移动
        _pt = MAKEPOINTS(lparam);
        InvalidateRect(hwnd, NULL, FALSE);
        break;
    default:
        return DefWindowProc(hwnd, message, wparam, lparam);
    }

    return 0;
}
Example #15
0
int CHolderWindow::OnHolderWindowMouseMove(LPARAM lParam)
{
	static POINTS	ptsPrevCursor;
	POINTS			ptsCursor;
	RECT			rc;

	ptsCursor = MAKEPOINTS(lParam);
	GetClientRect(m_hHolder,&rc);

	/* Is the window in the process of been resized? */
	if(m_bHolderResizing)
	{
		/* Mouse hasn't moved. */
		if((ptsPrevCursor.x == ptsCursor.x)
			&& (ptsPrevCursor.y == ptsCursor.y))
			return 0;

		ptsPrevCursor.x = ptsCursor.x;
		ptsPrevCursor.y = ptsCursor.y;

		SendMessage(GetParent(m_hHolder),WM_USER_HOLDERRESIZED,(WPARAM)m_hHolder,(LPARAM)ptsCursor.x);

		return 1;
	}

	if(ptsCursor.x >= (rc.right - 10))
	{
		SetCursor(LoadCursor(NULL,IDC_SIZEWE));
	}

	return 0;
}
LRESULT WebPopupMenuProxyWin::onLButtonUp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
{
    handled = true;

    IntPoint mousePoint(MAKEPOINTS(lParam));
    if (scrollbar()) {
        IntRect scrollBarRect = scrollbar()->frameRect();
        if (scrollbarCapturingMouse() || scrollBarRect.contains(mousePoint)) {
            setScrollbarCapturingMouse(false);
            // Put the point into coordinates relative to the scroll bar
            mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y());
            PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y()));
            scrollbar()->mouseUp();
            // FIXME: This is a hack to work around Scrollbar not invalidating correctly when it doesn't have a parent widget
            RECT r = scrollBarRect;
            ::InvalidateRect(m_popup, &r, TRUE);
            return 0;
        }
    }
    // Only hide the popup if the mouse is inside the popup window.
    RECT bounds;
    ::GetClientRect(m_popup, &bounds);
    if (::PtInRect(&bounds, mousePoint)) {
        hide();
        int index = focusedIndex();
        if (index >= 0) {
            // FIXME: Do we need to send back the index right away?
             m_newSelectedIndex = index;
        }
    }

    return 0;
}
Example #17
0
LRESULT CTaskbarNotifier::OnMouseHover(WPARAM /*wParam*/, LPARAM lParam)
{
	if (m_nAnimStatus == IDT_WAITING)
		KillTimer(IDT_WAITING);

	POINTS mp;
	mp = MAKEPOINTS(lParam);
	m_ptMousePosition.x = mp.x;
	m_ptMousePosition.y = mp.y;

	if (m_bMouseIsOver == FALSE)
	{
		m_bMouseIsOver = TRUE;
		RedrawWindow();
	}
	else if ((m_ptMousePosition.x >= m_rcText.left) && (m_ptMousePosition.x <= m_rcText.right)
			 && (m_ptMousePosition.y >= m_rcText.top) && (m_ptMousePosition.y <= m_rcText.bottom))
	{
		if (!m_bTextSelected)
			RedrawWindow();
	}
	else
	{
		if (m_bTextSelected)
			RedrawWindow();
	}

	return 0;
}
Example #18
0
BOOL TAbsenceDlg::EvCreate(LPARAM lParam)
{
	SetDlgIcon(hWnd);

	if (rect.left == CW_USEDEFAULT)
	{
		DWORD	val = GetMessagePos();
		POINTS	pos = MAKEPOINTS(val);

		GetWindowRect(&rect);
		int cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN);
		int xsize = rect.right - rect.left, ysize = rect.bottom - rect.top;
		int x = pos.x - xsize / 2, y = pos.y - ysize;

		if (x + xsize > cx)
			x = cx - xsize;
		if (y + ysize > cy)
			y = cy - ysize;

		MoveWindow(x > 0 ? x : 0, y > 0 ? y : 0, xsize, ysize, FALSE);
	}
	else
		MoveWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE);

	typedef char MaxBuf[MAX_PATH_U8];
	typedef char MaxHead[MAX_NAMEBUF];
	tmpAbsenceStr = new MaxBuf[cfg->AbsenceMax];
	tmpAbsenceHead = new MaxHead[cfg->AbsenceMax];

	SetData();
	return	TRUE;
}
Example #19
0
static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static WindowWin32* pWin = NULL;
    switch (message)
    {
    case WM_NCCREATE:
    {
        CREATESTRUCT *cs = reinterpret_cast<CREATESTRUCT *>(lParam);
        pWin = reinterpret_cast<WindowWin32 *>(cs->lpCreateParams);
    }
    break;

    case WM_DESTROY:
        if (pWin->GetController().get())
            pWin->GetController()->OnDestroy();
        ::PostQuitMessage(0);
        return 0;

    case WM_KEYDOWN:
    {
        KeyPressWin32 kPress(wParam);
        if (pWin->GetController().get())
            pWin->GetController()->OnKeyDown(kPress.GetKey());
    }
    return 0;

    case WM_LBUTTONDOWN:
    {
        POINTS p = MAKEPOINTS(lParam);
        KeyStateWin32 kState(wParam);
        if (pWin->GetController().get())
            pWin->GetController()->OnLButtonDown(p.x, p.y, kState);
    }
    return 0;

    case WM_MOUSEMOVE:
    {
        POINTS p = MAKEPOINTS(lParam);
        KeyStateWin32 kState(wParam);
        if (pWin->GetController().get())
            pWin->GetController()->OnMouseMove(p.x, p.y, kState);
    }
    return 0;
    }

    return DefWindowProc (hWnd, message, wParam, lParam) ;
}
Example #20
0
BOOL CTitleTip::PreTranslateMessage(MSG* pMsg) 
{
	CWnd                    *pWnd;
	int                     hittest;

	switch (pMsg->message)
	{
	case WM_LBUTTONDOWN:
	case WM_RBUTTONDOWN:
	case WM_MBUTTONDOWN:
		POINTS pts = MAKEPOINTS( pMsg->lParam );
		POINT  point;
		point.x = pts.x;
		point.y = pts.y;
		ClientToScreen( &point );
		pWnd = WindowFromPoint( point );
		if( pWnd == this ) 
			pWnd = m_pParentWnd;

		hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));

		if (hittest == HTCLIENT) {
			pWnd->ScreenToClient( &point );
			pMsg->lParam = MAKELONG(point.x,point.y);
		} else {
			switch (pMsg->message) {
			case WM_LBUTTONDOWN: 
				pMsg->message = WM_NCLBUTTONDOWN;
				break;
			case WM_RBUTTONDOWN: 
				pMsg->message = WM_NCRBUTTONDOWN;
				break;
			case WM_MBUTTONDOWN: 
				pMsg->message = WM_NCMBUTTONDOWN;
				break;
			}
			pMsg->wParam = hittest;
			pMsg->lParam = MAKELONG(point.x,point.y);
		}

        Hide();
		pWnd->PostMessage(pMsg->message,pMsg->wParam,pMsg->lParam);
		return TRUE;	
		
	case WM_KEYDOWN:
	case WM_SYSKEYDOWN:
        Hide();
		m_pParentWnd->PostMessage( pMsg->message, pMsg->wParam, pMsg->lParam );
		return TRUE;
	}

	if( GetFocus() == NULL )
	{
        Hide();
		return TRUE;
	}

	return CWnd::PreTranslateMessage(pMsg);
}
Example #21
0
//+---------------------------------------------------------------------------
//
//  Member:     CScrollbarController::OnMessage
//              
//  Synopsis:   Handle messages sent to this scroll bar controller.
//              
//  Arguments:  
//              
//  Notes:      
//              
//----------------------------------------------------------------------------
LRESULT CScrollbarController::OnMessage(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_MOUSEMOVE:
		MouseMove(CPoint(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y));
		break;

	case WM_LBUTTONDBLCLK:
	case WM_LBUTTONDOWN:
		AssertSz(FALSE, "CScrollbarController got unexpected message");
		break;

	case WM_LBUTTONUP:
		if(_partPressed != SBP_NONE)
		{
			// invalidate just the part that was pressed
			_partPressed = SBP_NONE;
			CSize scrollOffset;
			_pDispScroller->GetScrollOffset(&scrollOffset);
			LONG containerSize = _rcScrollbar.Size(_direction);
			Verify(_pLayout->OpenView());
			InvalidatePart(
				_partPressedStart,
				_direction,
				_rcScrollbar,
				_pDispScroller->GetContentSize()[_direction],
				containerSize,
				scrollOffset[_direction],
				_buttonWidth,
				_pDispScroller,
				&_drawInfo);
		}

		// fall thru to Terminate...
	case WM_CAPTURECHANGED:
		goto Terminate;
	}

	return 0;

Terminate:
	StopScrollbarController();
	return 0;
}
LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
	switch(uMessage)
    {
	// ADD CUSTOM WINDOWS MESSAGE HANDLERS HERE
	case WM_KEYDOWN:
		Keyboard::_SetKeyboardKey((UINT)wParam, true);
		break;

	case WM_KEYUP:
		Keyboard::_SetKeyboardKey((UINT)wParam, false);
		break;

	case WM_LBUTTONDOWN:
        Mouse::_SetMousePosition(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y);
        Mouse::_SetMouseLeftButton(true);
        break;	

    case WM_LBUTTONUP:
        Mouse::_SetMousePosition(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y);
        Mouse::_SetMouseLeftButton(false);
        break;

    case WM_MOUSEMOVE:
        Mouse::_SetMousePosition(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y);
        break;

	case WM_RBUTTONDOWN:
        Mouse::_SetMousePosition(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y);
		Mouse::_SetMouseRightButton(true);
        break;

    case WM_RBUTTONUP:
        Mouse::_SetMousePosition(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y);
		Mouse::_SetMouseRightButton(false);
        break;	

	case WM_DESTROY:
        g_bAppRunning = false;
        break;
    }

    return DefWindowProc(hWnd,uMessage,wParam,lParam);
}
Example #23
0
void ButtonEvent(DWORD dwEvent, LPARAM lParam)
{
#ifndef SHADOW_BROODWAR
  BYTE bFlag = 0;
  switch( dwEvent )
  {
  case BW_EVN_LBUTTONDOWN:
  case BW_EVN_LBUTTONUP:
  case BW_EVN_LBUTTONDBLCLK:
    bFlag = 0x02;
    break;
  case BW_EVN_RBUTTONDOWN:
  case BW_EVN_RBUTTONUP:
  case BW_EVN_RBUTTONDBLCLK:
    bFlag = 0x08;
    break;
  case BW_EVN_MBUTTONDOWN:
  case BW_EVN_MBUTTONUP:
  case BW_EVN_MBUTTONDBLCLK:
    bFlag = 0x20;
    break;
  }
  if ( !( BW::BWDATA::InputFlags & ~bFlag & 0x2A) )
  {
    switch( dwEvent )
    {
    case BW_EVN_LBUTTONDOWN:
    case BW_EVN_RBUTTONDOWN:
    case BW_EVN_MBUTTONDOWN:
    case BW_EVN_LBUTTONDBLCLK:
    case BW_EVN_RBUTTONDBLCLK:
    case BW_EVN_MBUTTONDBLCLK:
      BW::BWDATA::InputFlags |= bFlag;
      SetCapture(ghMainWnd);
      break;
    case BW_EVN_LBUTTONUP:
    case BW_EVN_RBUTTONUP:
    case BW_EVN_MBUTTONUP:
      BW::BWDATA::InputFlags &= ~bFlag;
      ReleaseCapture();
      break;
    }
    POINTS pt = MAKEPOINTS(lParam);
    BW::dlgEvent evt = { 0 };
    
    evt.wNo = (WORD)dwEvent;
    evt.cursor.x = pt.x;
    evt.cursor.y = pt.y;
    BW::BWDATA::Mouse.x = pt.x;
    BW::BWDATA::Mouse.y = pt.y;
    if ( !SendHotkey(&evt) && BW::BWDATA::InputProcedures[dwEvent] )
      BW::BWDATA::InputProcedures[dwEvent](&evt);
  }
#endif
}
Example #24
0
static LRESULT CALLBACK MainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    static system_t*    s_system = NULL;
    CREATESTRUCT*       createStruct;
    int                 width;
    int                 height;
    switch (message) 
    {
    case WM_CREATE:
        createStruct = ((CREATESTRUCT*)lParam);
        s_system = createStruct->lpCreateParams;
        return 0;
    /* Keyboard input */
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
        SetKeyState(s_system, (uint8_t)wParam, 1);
        // Handle Alt-F4 here. TODO: Support disabling it
        if(GetKeyState(kSysKeyF4) && GetKeyState(kSysKeyAlt))
            PostQuitMessage(0);
        return 0;
    case WM_KEYUP:
    case WM_SYSKEYUP:
        SetKeyState(s_system, (uint8_t)wParam, 0);
        // Handle Alt-F4 here. TODO: Support disabling it
        if(GetKeyState(kSysKeyF4) && GetKeyState(kSysKeyAlt))
            PostQuitMessage(0);
        return 0;
    case WM_SIZE:
        if(s_system->resizeCallback)
        {
            width = LOWORD(lParam);
            height = HIWORD(lParam);
            s_system->resizeCallback(width, height);
        }
        return 0;
    
    /* Mouse input */
    case WM_MOUSEMOVE:
        {
            POINTS pos = MAKEPOINTS(lParam);
            MouseMove(s_system, pos.x, pos.y);
        }
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN:
    case WM_MBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_RBUTTONUP:
    case WM_MBUTTONUP:
        SetMouseState(s_system, (int)wParam);
        return 0;
    }

    return DefWindowProc(hWnd, message, wParam, lParam);
}
Example #25
0
//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND	- process the application menu
//  WM_PAINT	- Paint the main window
//  WM_DESTROY	- post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	POINTS P;

	switch (message) 
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam); 
		wmEvent = HIWORD(wParam); 
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
      App->loop_continue = false;
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_KEYDOWN:
		App->HandleInput(wParam, true);
		break;
	case WM_KEYUP:
		App->HandleInput(wParam, false);
	case WM_PAINT:
		break;
	case WM_MBUTTONDOWN:
		App->HandleMouseBtn(true);
		break;
	case WM_MBUTTONUP:
		App->HandleMouseBtn(false);
		break;
	case WM_MOUSEMOVE:
		P = MAKEPOINTS(lParam);
		App->HandleMouseMove(wParam & MK_LBUTTON, P.x, P.y);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
    App->loop_continue = false;
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Example #26
0
  LRESULT message_handler(const UINT message, WPARAM wparam, LPARAM lparam) {
    switch (message) {
      case WM_DESTROY: {
        ::PostQuitMessage(0);
        return 0;
      }
      case WM_SIZE: {
        return size_handler(MAKEPOINTS(lparam));
      }
      case WM_PAINT: {
        paint_handler();
        break;
      }
      case WM_LBUTTONDOWN: {
        return left_mouse_button_handler(MAKEPOINTS(lparam));
      }
      case WM_MOUSEMOVE: {
        return mouse_move_handler(wparam, MAKEPOINTS(lparam));
      }
      case WM_ENTERSIZEMOVE: {
        sizing_loop_ = true;
        break;
      }
      case WM_EXITSIZEMOVE: {
        sizing_loop_ = false;
        break;
      }
      case WM_WINDOWPOSCHANGING: {
        // send to fixed size windows when there is a device loss. do nothing
        // to prevent the default window proc from resizing to 640x400.
        return 0;
      }
      case WM_DPICHANGED: {
        return dpi_changed_handler(lparam);
      }
    }

    return ::DefWindowProc(window(), message, wparam, lparam);
  }
Example #27
0
bool WindowSplitter::OnSetCursor() {
	DWORD dPos = GetMessagePos();			//get current mouse pos
	POINTS pts = MAKEPOINTS(dPos);
	POINT pos = {pts.x, pts.y};
	ScreenToClient(m_windowParent->GetHWND(), &pos);

	if (PointOnSplitter(pos)) {
		::SetCursor(::LoadCursor(NULL, IDC_SIZENS));
		return true;
	}

	return false;
}
Example #28
0
void CSummaryPage::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult) 
{
    UNUSED_ALWAYS(pNMHDR);
    if(m_List.GetItemCount()>0){
	    CMenu menu;
	    menu.LoadMenu(IDR_TT_CONTEXTMENU1);
        DWORD dwPos=GetMessagePos();
    
	    CMenu *pPopup=menu.GetSubMenu(0);
	    pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, MAKEPOINTS(dwPos).x,MAKEPOINTS(dwPos).y,this);
    }	    
	*pResult = 0;
}
Example #29
0
/************************************************************************
*
*   MouseHandler - WM_BUTTONDOWN handler
*
************************************************************************/
void MouseHandler( 
    HWND hWnd, 
    LONG lParam )
{

    if ( ( gImeUIData.ImeState & IME_IN_CHOSECAND ) ||
         ( gImeUIData.ImeState & IME_IN_COMPOSITION && !MoveCaret( hWnd ) ) )
        return;

    HideCaret( hWnd );

    //
    // Calculate caret position based on fixed pitched font
    //
    yPos = MAKEPOINTS(lParam).y / cyMetrics;
    xPos = MAKEPOINTS(lParam).x / cxMetrics;

    //
    // Adjust caret position if click landed on a trail byte
    //
    if ( IsDBCSTrailByte( (LPSTR)textbuf[yPos], (LPSTR)&(textbuf[yPos][xPos]) ) )
    {
        //
        // If click landed on the last quarter of the DBCS character,
        // assume the user was aiming at the next character.
        //
        if ( (MAKEPOINTS(lParam).x - xPos * cxMetrics) > (cxMetrics / 2) )
            xPos++;
        else
            xPos--;
    }
    
    DestroyCaret();
    CreateCaret(hWnd, NULL,
                (fInsertMode && IsDBCSLeadByte( textbuf[yPos][xPos] )) ? CaretWidth*2 : CaretWidth,
                cyMetrics );
    SetCaretPos( xPos * cxMetrics, yPos * cyMetrics );
    ShowCaret( hWnd );
}
Example #30
0
    void NativeButton::ButtonPressed()
    {
        RequestFocus();

        // TODO(beng): obtain mouse event flags for native buttons someday.
        DWORD pos = GetMessagePos();
        POINTS points = MAKEPOINTS(pos);
        gfx::Point cursor_point(points.x, points.y);

        view::MouseEvent event(view::Event::ET_MOUSE_RELEASED,
            cursor_point.x(), cursor_point.y(),
            view::Event::EF_LEFT_BUTTON_DOWN);
        NotifyClick(event);
    }