Пример #1
0
// Left button
void CMouse::InternalOnLButtonDown(UINT nFlags, const CPoint& point)
{
    GetWnd().SetFocus();
    m_bLeftDown = false;
    SetCursor(nFlags, point);
    if (MVRDown(nFlags, point)) {
        return;
    }
    bool bIsOnFS = IsOnFullscreenWindow();
    if ((!m_bD3DFS || !bIsOnFS) && (abs(GetMessageTime() - m_popupMenuUninitTime) < 2)) {
        return;
    }
    if (m_pMainFrame->GetLoadState() == MLS::LOADED && m_pMainFrame->GetPlaybackMode() == PM_DVD &&
            (m_pMainFrame->IsD3DFullScreenMode() ^ m_bD3DFS) == 0 &&
            (m_pMainFrame->m_pDVDC->ActivateAtPosition(GetVideoPoint(point)) == S_OK)) {
        return;
    }
    if (m_bD3DFS && bIsOnFS && m_pMainFrame->m_OSD.OnLButtonDown(nFlags, point)) {
        return;
    }
    m_bLeftDown = true;
    bool bDouble = false;
    if (m_bLeftDoubleStarted &&
            GetMessageTime() - m_leftDoubleStartTime < (int)GetDoubleClickTime() &&
            CMouse::PointEqualsImprecise(m_leftDoubleStartPoint, point)) {
        m_bLeftDoubleStarted = false;
        bDouble = true;
    } else {
        m_bLeftDoubleStarted = true;
        m_leftDoubleStartTime = GetMessageTime();
        m_leftDoubleStartPoint = point;
    }
    auto onButton = [&]() {
        GetWnd().SetCapture();
        bool ret = false;
        if (bIsOnFS || !m_pMainFrame->IsCaptionHidden()) {
            ret = OnButton(wmcmd::LDOWN, point, bIsOnFS);
        }
        if (bDouble) {
            ret = OnButton(wmcmd::LDBLCLK, point, bIsOnFS) || ret;
        }
        if (!ret) {
            ReleaseCapture();
        }
        return ret;
    };
    m_drag = (!onButton() && !bIsOnFS) ? Drag::BEGIN_DRAG : Drag::NO_DRAG;
    if (m_drag == Drag::BEGIN_DRAG) {
        GetWnd().SetCapture();
        m_beginDragPoint = point;
        GetWnd().ClientToScreen(&m_beginDragPoint);
    }
}
Пример #2
0
//------------------------------------------------------------------------------
// void ClickButton( bool run )
//------------------------------------------------------------------------------
void ScriptPanel::ClickButton( bool run )
{
	wxCommandEvent event;
	if (run)
		event.SetEventObject(mSaveSyncRunButton);
	else
		event.SetEventObject(mSaveSyncButton);
	OnButton(event);
}
Пример #3
0
void wxBuildUI::OnKeyEvent(wxInt32)
{
	// If we're enabled, click.
	if(true == IsEnabled())
	{
		wxCommandEvent event;
		event.SetId(mButtonID);
		OnButton(event);
	}
}
Пример #4
0
void CMouse::InternalOnLButtonUp(UINT nFlags, const CPoint& point)
{
    ReleaseCapture();
    if (!MVRUp(nFlags, point)) {
        bool bIsOnFS = IsOnFullscreenWindow();
        if (!(m_bD3DFS && bIsOnFS && m_pMainFrame->m_OSD.OnLButtonUp(nFlags, point)) && m_bLeftDown) {
            OnButton(wmcmd::LUP, point, bIsOnFS);
        }
    }
    m_drag = Drag::NO_DRAG;
    m_bLeftDown = false;
    SetCursor(nFlags, point);
}
Пример #5
0
LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_CREATE:
		hWndEdit = CreateWindow(L"EDIT", L"It's an edit window!", WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT, 20, 20, 160, 20, m_hwnd, (HMENU) ID_EDITCHILD, (HINSTANCE) GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE), NULL);
		hWndButton = CreateWindow(L"BUTTON", L"It's a button!", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 50, 160, 20, m_hwnd, (HMENU) ID_BUTTONCHILD, (HINSTANCE) GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE), NULL);
		PlotWin.Create(L"It's a graph window!", WS_CHILD | WS_VISIBLE, 0, 220, 20, 900, 600, m_hwnd, (HMENU) ID_GRAPHCHILD);
		hWndPlot = PlotWin.Window();//hWndPlot = CreateWindowEx(0, L"GRAPHPLOT", L"It's a graph window!", WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, 220, 20, 500, 500, m_hwnd, (HMENU) ID_GRAPHCHILD, (HINSTANCE) GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE), NULL);
		return 0;
	case WM_COMMAND:
		{
			int wmId, wmEvent;
			wmId    = LOWORD(wParam);
			wmEvent = HIWORD(wParam);
			// Parse the menu selections:
			switch (wmEvent)
			{
			case BN_CLICKED:
				OnButton(wmId, wmEvent, lParam);
				break;
			}
		}
		/*switch (wmId)
		{
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}*/
		return 0;
	case WM_PAINT:
		{
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(m_hwnd, &ps);

            FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));

            EndPaint(m_hwnd, &ps);
        }
		return 0;

    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;

	case AM_UPDATE:
		UpdateText();
		return 0;
	}
    return DefWindowProc(m_hwnd, uMsg, wParam, lParam);
}
Пример #6
0
BOOL CMyDialog::OnCommand(WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);

	switch (LOWORD(wParam))
    {
	case IDC_BUTTON1:	OnButton();		return TRUE;
	case IDC_RADIO1:	OnRadio1();		return TRUE;
	case IDC_RADIO2:	OnRadio2();		return TRUE;
	case IDC_RADIO3:	OnRadio3();		return TRUE;
	case IDC_CHECK1:	OnCheck1();		return TRUE;
	case IDC_CHECK2:	OnCheck2();		return TRUE;
	case IDC_CHECK3:	OnCheck3();		return TRUE;
    }

	return FALSE;
}
Пример #7
0
BOOL CMessageBox::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message==WM_KEYDOWN){
		switch(pMsg->wParam){
			case VK_ESCAPE:
				if(-1!=m_nEscapeButton){
					OnButton(m_arBInfo[m_nEscapeButton].m_id);
				}
				return TRUE;
			default:
				break;
		}
	}
    if( IsDialogMessage( pMsg ) )        
		return TRUE;    
	else
        return CDialog::PreTranslateMessage( pMsg );
}
Пример #8
0
// Middle button
void CMouse::InternalOnMButtonDown(UINT nFlags, const CPoint& point)
{
    SetCursor(nFlags, point);
    OnButton(wmcmd::MDOWN, point);
}
Пример #9
0
BOOL CMouse::InternalOnMouseWheel(UINT nFlags, short zDelta, const CPoint& point)
{
    return zDelta > 0 ? OnButton(wmcmd::WUP, point) :
           zDelta < 0 ? OnButton(wmcmd::WDOWN, point) :
           FALSE;
}
Пример #10
0
bool CMouse::InternalOnXButtonUp(UINT nFlags, UINT nButton, const CPoint& point)
{
    bool ret = OnButton(nButton == XBUTTON1 ? wmcmd::X1UP : nButton == XBUTTON2 ? wmcmd::X2UP : wmcmd::NONE, point);
    SetCursor(nFlags, point);
    return ret;
}
Пример #11
0
bool CMouse::InternalOnXButtonDblClk(UINT nFlags, UINT nButton, const CPoint& point)
{
    InternalOnXButtonDown(nFlags, nButton, point);
    return OnButton(nButton == XBUTTON1 ? wmcmd::X1DBLCLK : nButton == XBUTTON2 ? wmcmd::X2DBLCLK : wmcmd::NONE, point);
}
Пример #12
0
void CMouse::InternalOnRButtonDblClk(UINT nFlags, const CPoint& point)
{
    SetCursor(nFlags, point);
    OnButton(wmcmd::RDOWN, point);
    OnButton(wmcmd::RDBLCLK, point);
}
Пример #13
0
// Navigation buttons
bool CMouse::InternalOnXButtonDown(UINT nFlags, UINT nButton, const CPoint& point)
{
    SetCursor(nFlags, point);
    return OnButton(nButton == XBUTTON1 ? wmcmd::X1DOWN : nButton == XBUTTON2 ? wmcmd::X2DOWN : wmcmd::NONE, point);
}
Пример #14
0
void CMouse::InternalOnRButtonUp(UINT nFlags, const CPoint& point)
{
    OnButton(wmcmd::RUP, point);
    SetCursor(nFlags, point);
}
Пример #15
0
void COpenView::OnPathButton()
{
	OnButton(N);
}
Пример #16
0
void CMessageBox::OnClose() 
{
	OnButton(IDCANCEL);
}
void GamepadDirectX::Update()
{
	m_lpDirectInputDevice->Poll();

	// Get events:
	while (true)
	{
		DIDEVICEOBJECTDATA buffer[16];
		DWORD num_events = 16;

		HRESULT result = m_lpDirectInputDevice->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), buffer, &num_events, 0);
		// Try to reacquire joystick if we lost it.
		if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) m_lpDirectInputDevice->Acquire();

		if (FAILED(result) && result != DI_BUFFEROVERFLOW) break;
		if (num_events == 0) break;
	
		for (unsigned int i=0; i<num_events; i++)
		{
			if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lX))
			{
				SetAxis(0, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}	else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lY))
			{
				// Y Axis position event
				SetAxis(1, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			} else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lZ))
			{
				// Z Axis position event
				SetAxis(2, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, rglSlider[0]))
			{
				// extra 1 axis position event
				SetAxis(3, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}
			else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, rglSlider[1]))
			{
				// extra 2 axis position event
				SetAxis(4, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}
			else if (buffer[i].dwOfs >= FIELD_OFFSET(DIJOYSTATE2, rgbButtons) && buffer[i].dwOfs < FIELD_OFFSET(DIJOYSTATE2, rgbButtons)+128)
			{
				// Button event
				int button_index = buffer[i].dwOfs - FIELD_OFFSET(DIJOYSTATE2, rgbButtons);
				// If high bit of lower byte is set, key is down
				OnButton( LOBYTE(buffer[i].dwData) != 0, button_index);
			} else if (buffer[i].dwOfs >= FIELD_OFFSET(DIJOYSTATE2, rgdwPOV) && buffer[i].dwOfs < FIELD_OFFSET(DIJOYSTATE2, rgdwPOV)+4*sizeof(DWORD))
			{
				// Hat event:
				int hat_index = (buffer[i].dwOfs - FIELD_OFFSET(DIJOYSTATE2, rgdwPOV)) / sizeof(DWORD);
				bool centered = (LOWORD(buffer[i].dwData) == 0xFFFF);
				int direction = buffer[i].dwData / DI_DEGREES;
				if (centered) direction = -1;

				OnHat(hat_index, (float)direction); 
			}
			else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lRx))
			{
				// X Axis rotation event
				SetAxis(5, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}
			else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lRy))
			{
				// Y Axis rotation event
				SetAxis(6, float(buffer[i].dwData)/(0xffff/2)-1.0f);

			}
			else if (buffer[i].dwOfs == FIELD_OFFSET(DIJOYSTATE2, lRz))
			{
				// Z Axis rotation event
				SetAxis(7, float(buffer[i].dwData)/(0xffff/2)-1.0f);
			}
			{
				//Ignoring hat data, force, torque, rotation, etc for now
#ifdef _DEBUG
				//LogMsg("Unhandled gamepad event");
#endif
			}

		}
	}

	Gamepad::Update();
}
Пример #18
0
bool CMouse::OnButton(UINT id, const CPoint& point)
{
    return OnButton(id, point, IsOnFullscreenWindow());
}