Example #1
0
BOOL CGuiPanelAccess::OnCommand(WPARAM wParam, LPARAM lParam)
{
	HWND hwnd = (HWND) lParam;	
	for (int i=0; i < m_nItems+1;i++)
	{
			if (((CComponents*) m_arrContainer[i])->m_cwnd->m_hWnd
				== hwnd)
			{
				int x=((CComponents*) m_arrContainer[i])->m_cwnd->GetDlgCtrlID();
				CWnd* pParent= GetParent();
				pParent->SendMessage (WM_COMMAND,x);
				AfxGetMainWnd()->SendMessage(WM_COMMAND,x);
				return TRUE;
			}
	
	}
	if (wParam == ID_TOOLUP)
		OnUp();
	
	if (wParam == ID_TOOLDOWN)
		OnDownd();
	
	return FALSE;

}
Example #2
0
void CPlayListDlg::OnMouseMove(int x, int y)
{
	if (m_fListDrag) {
		RECT rcItem;
		HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
		if (!ListView_GetItemRect(hwndLV, 0, &rcItem, LVIR_BOUNDS))
			return;

		POINT pt = {x, y};
		ClientToScreen(m_hWnd, &pt);
		ScreenToClient(hwndLV, &pt);

		RECT rcLV;
		GetClientRect(hwndLV, &rcLV);
		if (pt.y < RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(hwndLV, 0, -RECT_HEIGHT(&rcItem));
			OnUp(FALSE);
			m_nDragItem = max(m_nDragItem - 1, 0);
		}
		else if (pt.y > rcLV.bottom - RECT_HEIGHT(&rcItem)) {
			ListView_Scroll(hwndLV, 0, RECT_HEIGHT(&rcItem));
			OnDown(FALSE);
			m_nDragItem = min(m_nDragItem + 1, ListView_GetItemCount(hwndLV) - 1);
		}
		else {
			LVHITTESTINFO lvhti;
			lvhti.pt.x = pt.x; 
			lvhti.pt.y = pt.y;
			int nItem = ListView_HitTest(hwndLV, &lvhti);
			if (nItem == -1)
				return;

			if (nItem - m_nDragItem > 0) {
				for (int i = 0; i < nItem - m_nDragItem; i++)
					OnDown(FALSE);
				m_nDragItem = nItem;
			}
			else if (nItem - m_nDragItem < 0) {
				for (int i = 0; i < m_nDragItem - nItem; i++)
					OnUp(FALSE);
				m_nDragItem = nItem;
			}
		}
	}
}
Example #3
0
bool CGUIControl::OnAction(const CAction &action)
{
  if (HasFocus())
  {
    switch (action.GetID())
    {
    case ACTION_MOVE_DOWN:
      OnDown();
      return true;

    case ACTION_MOVE_UP:
      OnUp();
      return true;

    case ACTION_MOVE_LEFT:
      OnLeft();
      return true;

    case ACTION_MOVE_RIGHT:
      OnRight();
      return true;

    case ACTION_SHOW_INFO:
      return OnInfo();

    case ACTION_NAV_BACK:
      return OnBack();

    case ACTION_NEXT_CONTROL:
      OnNextControl();
      return true;

    case ACTION_PREV_CONTROL:
      OnPrevControl();
      return true;
    }
  }
  return false;
}
Example #4
0
// Handles a key press.  Returns FALSE if the key was not processed through this method.
// Left, Up, Down, Right, and Enter are automatically passed through OnUp(), OnDown(), etc.
DBOOL CMenuBase::HandleKeyDown(int key, int rep)
{
	switch (key)
	{
	case VK_LEFT:
		{
			OnLeft();
			break;
		}
	case VK_RIGHT:
		{
			OnRight();
			break;
		}
	case VK_UP:
		{
			OnUp();
			break;
		}
	case VK_DOWN:
		{
			OnDown();
			break;
		}
	case VK_RETURN:
		{
			OnEnter();
			break;
		}
	default:
		{
			return m_listOption.HandleKeyDown(key, rep);
			break;
		}
	}

	// Handled the key
	return DTRUE;
}
Example #5
0
EMenuAction CMenuBase::Update (void)
{
    // Increase time elapsed in this menu mode
    m_MenuModeTime += m_pTimer->GetDeltaTime ();

    // If we don't have to exit this menu mode yet
    if (!m_HaveToExit)
    {
        // If NEXT control is pressed
        if (m_pInput->GetMainInput().TestNext())
        {
            // Don't play menu next sound because the choices of the user
            // could not be correct and we may have to play an error sound instead.
            
            OnNext ();
        }
        // If PREVIOUS control is pressed
        else if (m_pInput->GetMainInput().TestPrevious())
        {
            // Play the menu previous sound
            m_pSound->PlaySample (SAMPLE_MENU_PREVIOUS);

            OnPrevious ();
        }
        // If UP control is pressed
        else if (m_pInput->GetMainInput().TestUp())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnUp ();
        }
        // If DOWN control is pressed
        else if (m_pInput->GetMainInput().TestDown())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnDown ();
        }
        // If LEFT control is pressed
        else if (m_pInput->GetMainInput().TestLeft())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnLeft ();
        }
        // If RIGHT control is pressed
        else if (m_pInput->GetMainInput().TestRight())
        {
            // Play the menu beep sound
            m_pSound->PlaySample (SAMPLE_MENU_BEEP);

            OnRight ();
        }

        // Update the menu screen
        OnUpdate ();
    }
    // If the transition has been entirely done (enough time has elapsed)
    else if (m_MenuModeTime >= m_ExitMenuModeTime + TRANSITION_DURATION)
    {
        // It's OK to exit now!
        // Ask for the menu action we saved
        return m_ExitMenuAction;
    }

    // Don't have to change menu mode nor game mode
    return MENUACTION_NONE;
}