LTBOOL CFolderDisplay::OnRButtonUp(int x, int y) { // Get the control that the click was on int nControlIndex=0; if (GetControlUnderPoint(x, y, &nControlIndex)) { CLTGUICtrl* pCtrl = GetControl(nControlIndex); if (m_pCaptureCtrl && pCtrl != m_pCaptureCtrl) return LTFALSE; // If the mouse is over the same control now as it was when the down message was called // then send the "left" message to the control. if (nControlIndex == m_nRMouseDownItemSel) { if (pCtrl->IsEnabled()) { if (GetSelectedControl() == m_pRendererCtrl) { // Get the current resolution FolderDisplayResolution currentResolution=GetCurrentSelectedResolution(); LTBOOL handled = pCtrl->OnRButtonUp(x,y); if (handled) { SetupResolutionCtrl(); // Set the resolution for the control SetCurrentCtrlResolution(currentResolution); } return handled; } else if (pCtrl == m_pHardwareCursor) { return OnLeft(); } else { SetSelection(nControlIndex); return CBaseFolder::OnRButtonUp(x,y); } } } } else { m_nRMouseDownItemSel= kNoSelection; } return LTFALSE; }
// Handles the mouse move message LTBOOL CListCtrl::OnMouseMove(int x, int y) { x += g_pInterfaceResMgr->GetXOffset(); y += g_pInterfaceResMgr->GetYOffset(); int nControlUnderPoint=0; CLTGUICtrl *pCtrl = GetControlUnderPoint(x, y, &nControlUnderPoint); if (m_pUp && CanScrollUp()) m_pUp->Select(pCtrl == m_pUp); if (m_pDown && CanScrollDown()) m_pDown->Select(pCtrl == m_pDown); // If m_bEnableMouseMoveSelect is TRUE then select the item that the mouse is over if (m_bEnableMouseMoveSelect) { if(pCtrl && nControlUnderPoint >= 0) { // Make sure we're enabled if(!pCtrl->IsEnabled()) return LTFALSE; if (GetSelectedItem() != nControlUnderPoint) { SelectItem(nControlUnderPoint); return LTTRUE; } } else { /* //if not on anything select nothing if ( m_nCurrentIndex < (int)m_controlArray.GetSize() ) { m_controlArray[m_nCurrentIndex]->Select(FALSE); } m_nCurrentIndex = kNoSelection; */ } } return LTFALSE; }
LTBOOL CListCtrl::OnLButtonDblClick(int x, int y) { x += g_pInterfaceResMgr->GetXOffset(); y += g_pInterfaceResMgr->GetYOffset(); m_fNextScrollTime = -1.0f; // Get the control that the click was on int nControlIndex=0; CLTGUICtrl *pCtrl = GetControlUnderPoint(x, y, &nControlIndex); if(pCtrl) { // Make sure we're enabled if(!pCtrl->IsEnabled()) return LTFALSE; // If the mouse is over the same control now as it was when the down message was called // then send the "enter" message to the control. if (nControlIndex == m_nMouseDownItemSel) { if (nControlIndex == kUpSel) { return (!CanScrollUp() || ScrollUp()); } else if (nControlIndex == kDownSel) { return (!CanScrollDown() || ScrollDown()); } else { return m_controlArray[nControlIndex]->OnLButtonDblClick( x, y); } } } else { m_nMouseDownItemSel=kNoSelection; } return LTFALSE; }
// Handles the left button down message LTBOOL CListCtrl::OnLButtonDown(int x, int y) { x += g_pInterfaceResMgr->GetXOffset(); y += g_pInterfaceResMgr->GetYOffset(); // Get the control that the click was on int nControlIndex=0; CLTGUICtrl *pCtrl = GetControlUnderPoint(x, y, &nControlIndex); if(pCtrl) { // Make sure we're enabled if(!pCtrl->IsEnabled()) return LTFALSE; if (nControlIndex >= 0 && m_bEnableMouseClickSelect) { // Select the control SelectItem(nControlIndex); } if ((nControlIndex == kUpSel && CanScrollUp())|| (nControlIndex == kDownSel && CanScrollDown())) m_fNextScrollTime = g_pLTClient->GetTime()+m_fScrollFirstDelay; // Record this control as the one being selected from the mouse click. // If the mouse is still over it on the UP message, then the "enter" message will be sent. m_nMouseDownItemSel=nControlIndex; return LTTRUE; } else { // This clears the index for what item was selected from a mouse down message m_nMouseDownItemSel=kNoSelection; return LTFALSE; } }