Ejemplo n.º 1
16
/*************************************************
Function:   OnMouseWheel
Desc:
Input:
Return:		SUCCESS 成功
            FAIL 失败
**************************************************/
BOOL CDialogSetting::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
    // TODO: Add your message handler code here and/or call default


    if(zDelta < 0)
    {
        OnVScroll(SB_LINEDOWN, GetScrollPos(SB_VERT),  GetScrollBarCtrl(SB_VERT));
    }
    else if (zDelta > 0)
    {
        OnVScroll(SB_LINEUP, GetScrollPos(SB_VERT),  GetScrollBarCtrl(SB_VERT));
    }


    return CDialog::OnMouseWheel(nFlags, zDelta, pt);
}
Ejemplo n.º 2
0
BOOL CScrollWnd::OnScrollBy(CSize sizeScroll, BOOL bDoScroll)
{
	int xOrig, x;
	int yOrig, y;
	
	// don't scroll if there is no valid scroll range (ie. no scroll bar)
	CScrollBar* pBar;
	DWORD dwStyle = GetStyle();
	pBar = GetScrollBarCtrl(SB_VERT);
	if ((pBar != NULL && !pBar->IsWindowEnabled()) ||
		(pBar == NULL && !(dwStyle & WS_VSCROLL)))
	{
		// vertical scroll bar not enabled
		sizeScroll.cy = 0;
	}
	pBar = GetScrollBarCtrl(SB_HORZ);
	if ((pBar != NULL && !pBar->IsWindowEnabled()) ||
		(pBar == NULL && !(dwStyle & WS_HSCROLL)))
	{
		// horizontal scroll bar not enabled
		sizeScroll.cx = 0;
	}
	
	// adjust current x position
	xOrig = x = GetScrollPos(SB_HORZ);
	int xMax = GetScrollLimit(SB_HORZ);
	x += sizeScroll.cx;
	if (x < 0)
		x = 0;
	else if (x > xMax)
		x = xMax;
	
	// adjust current y position
	yOrig = y = GetScrollPos(SB_VERT);
	int yMax = GetScrollLimit(SB_VERT);
	y += sizeScroll.cy;
	if (y < 0)
		y = 0;
	else if (y > yMax)
		y = yMax;
	
	// did anything change?
	if (x == xOrig && y == yOrig)
		return FALSE;
	
	if (bDoScroll)
	{
		// do scroll and update scroll positions
		ScrollWindow(-(x-xOrig), -(y-yOrig));
		//Invalidate();
		if (x != xOrig)
			SetScrollPos(SB_HORZ, x);
		if (y != yOrig)
			SetScrollPos(SB_VERT, y);
	}
	return TRUE;
}
Ejemplo n.º 3
0
//---------------------------------------------------------------------
void CBMRegEditView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
  switch (nChar)  {
  case VK_TAB:   NextView(); break;
  case VK_HOME:  OnVScroll(SB_TOP,      0, GetScrollBarCtrl(SB_VERT)); break;
  case VK_END:   OnVScroll(SB_BOTTOM,   0, GetScrollBarCtrl(SB_VERT)); break;
  case VK_UP:    if (GetActReg()!=0) ChangeSelectionNextRow(FALSE); break;
  case VK_DOWN:  if (GetActReg()<GetRowCount()-1) ChangeSelectionNextRow(TRUE); break;
  case VK_PRIOR: OnVScroll(SB_PAGEUP,  0, GetScrollBarCtrl(SB_VERT)); break;
  case VK_NEXT:  OnVScroll(SB_PAGEDOWN,0, GetScrollBarCtrl(SB_VERT)); break;
  default:       CScrollView::OnKeyDown(nChar, nRepCnt, nFlags);
  }
}
Ejemplo n.º 4
0
//------------------------------------------------------------
// Overrides of CView and CBrView
void CBMView::OnUpdate(CView*, LPARAM lHint, CObject* pHint)
{ if (pHint!=NULL && theApp.m_nActiveFrame!=DBVIEW) return;
 if ( pHint != NULL && pHint->IsKindOf(RUNTIME_CLASS(CScriptDoc))) return;
 UpdateScrollSizes(); Invalidate();
 if (theApp.m_nActiveFrame==DBVIEW) {
   if (theApp.CurrentTask&NEW_SAMPLE) OnVScroll(SB_BOTTOM,0,GetScrollBarCtrl(SB_VERT));
 }
}
Ejemplo n.º 5
0
BOOL ServerOpts2::OnInitDialog()
{
	CSubDlg::OnInitDialog();

	// TODO:  Add extra initialization here
	CScrollBar* pScrollBar = GetScrollBarCtrl(SB_VERT);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 6
0
void CScrollWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	if (pScrollBar != NULL && pScrollBar->SendChildNotifyLastMsg())
		return;     // eat it

	// ignore scroll bar msgs from other controls
	if (pScrollBar != GetScrollBarCtrl(SB_VERT))
		return;

	OnScroll(MAKEWORD(-1, nSBCode), nPos);
}
Ejemplo n.º 7
0
void CScrollWnd::GetScrollBarSizes(CSize& sizeSb)
{
	sizeSb.cx = sizeSb.cy = 0;
	DWORD dwStyle = GetStyle();
	
	if (GetScrollBarCtrl(SB_VERT) == NULL)
	{
		// vert scrollbars will impact client area of this window
		sizeSb.cx = GetSystemMetrics(SM_CXVSCROLL);
		if (dwStyle & WS_BORDER)
			sizeSb.cx -= GetSystemMetrics(SM_CXBORDER);
	}
	if (GetScrollBarCtrl(SB_HORZ) == NULL)
	{
		// horz scrollbars will impact client area of this window
		sizeSb.cy = GetSystemMetrics(SM_CYHSCROLL);
		if (dwStyle & WS_BORDER)
			sizeSb.cy -= GetSystemMetrics(SM_CYBORDER);
	}
}
Ejemplo n.º 8
0
void CXTPPropertyPage::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	if (pScrollBar != NULL && pScrollBar->SendChildNotifyLastMsg())
		return;     // eat it

	// ignore scroll bar msgs from other controls
	if (pScrollBar != GetScrollBarCtrl(SB_HORZ))
		return;

	OnScroll(MAKEWORD(nSBCode, -1), nPos);
}
Ejemplo n.º 9
0
void CScrollView::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar *pScrollBar )
/****************************************************************************/
{
    if( pScrollBar == NULL || !pScrollBar->SendChildNotifyLastMsg() ) {
        if( pScrollBar == GetScrollBarCtrl( SB_VERT ) ) {
            OnScroll( MAKEWORD( 0xFF, nSBCode ), nPos );
        } else {
            Default();
        }
    }
}
Ejemplo n.º 10
0
void CCharSymbolSelectListBox::ReSetScorll(long lRow)
{
	CWnd* pScroll = GetScrollBarCtrl(SB_VERT);

	if (pScroll)
	{
		SetScrollRange (SB_VERT, 0, lRow);
		int selectRow = m_lNewSelectId / NUMSYMBOLPERROW; 
		SetScrollPos (SB_VERT, selectRow);
	}
}
Ejemplo n.º 11
0
void CXDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	// TODO: Add your message handler code here and/or call default
	if (pScrollBar != NULL && pScrollBar->SendChildNotifyLastMsg())
		return;     // eat it

	// ignore scroll bar msgs from other controls
	if (pScrollBar != GetScrollBarCtrl(SB_HORZ))
		return;
	OnScroll(MAKEWORD(nSBCode, -1), nPos);
	//CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void EventSheetEditor::PreviousBookmark()
{
	bool found = false;
	bool found_first = false;
	bool found_vis = false;
	bool down = false;
	int y = 0;
	bool closed = false;
	for(int a = m_pEventList->size()-1; a >= 0 ; a--)
	{
		FindBookmarkEvent(m_pEventList->at(a), found, found_first, found_vis, down, y, closed);
		if(found)
			a = 0;
	}
	if(!found)
		y = 0;
	if(y > GetScrollBarCtrl(1)->GetScrollLimit())
		y = GetScrollBarCtrl(1)->GetScrollLimit();
	SetScrollPos(1,y, true);
	Invalidate();
}
Ejemplo n.º 13
0
BOOL CCellView::OnMouseWheel(UINT, short zDelta, CPoint) 
{
  UINT nScrollCode=((zDelta<0)?SB_LINEDOWN:SB_LINEUP);
  LPARAM lParam=(LPARAM)GetScrollBarCtrl(SB_VERT)->GetSafeHwnd();
  if(lParam){
    for(int i=0;i<abs(zDelta)/WHEEL_DELTA;i++){
      CConfigTool::GetControlView()->SendMessage(WM_VSCROLL,MAKEWPARAM(nScrollCode,0),lParam);
      Sync();
    }
  }
  return TRUE;
}
Ejemplo n.º 14
0
BOOL CXTPPropertyPage::DoMouseWheel(UINT fFlags, short zDelta, CPoint point)
{
	UNUSED_ALWAYS(point);
	UNUSED_ALWAYS(fFlags);

	// if we have a vertical scroll bar, the wheel scrolls that
	// if we have _only_ a horizontal scroll bar, the wheel scrolls that
	// otherwise, don't do any work at all

	DWORD dwStyle = GetStyle();
	CScrollBar* pBar = GetScrollBarCtrl(SB_VERT);
	BOOL bHasVertBar = ((pBar != NULL) && pBar->IsWindowEnabled()) ||
					(dwStyle & WS_VSCROLL);

	pBar = GetScrollBarCtrl(SB_HORZ);
	BOOL bHasHorzBar = ((pBar != NULL) && pBar->IsWindowEnabled()) ||
					(dwStyle & WS_HSCROLL);

	if (!bHasVertBar && !bHasHorzBar)
		return FALSE;

	BOOL bResult = FALSE;
	UINT uWheelScrollLines = 3;

	if (bHasVertBar)
	{
		bResult = OnScrollBy(CSize(0, (zDelta < 0 ? 1 : -1) * m_lineDev.cy * uWheelScrollLines), TRUE);
	}
	else if (bHasHorzBar)
	{
		bResult = OnScrollBy(CSize((zDelta < 0 ? 1 : -1) * m_lineDev.cy * uWheelScrollLines, 0), TRUE);
	}

	if (bResult)
		UpdateWindow();

	return bResult;
}
Ejemplo n.º 15
0
BOOL CScrollWnd::DoMouseWheel(UINT fFlags, short zDelta, CPoint point)
{
	UNUSED_ALWAYS(point);
	UNUSED_ALWAYS(fFlags);

	// if we have a vertical scroll bar, the wheel scrolls that
	// if we have _only_ a horizontal scroll bar, the wheel scrolls that
	// otherwise, don't do any work at all

	DWORD dwStyle = GetStyle();
	CScrollBar* pBar = GetScrollBarCtrl(SB_VERT);
	BOOL bHasVertBar = ((pBar != NULL) && pBar->IsWindowEnabled()) ||
					(dwStyle & WS_VSCROLL);

	pBar = GetScrollBarCtrl(SB_HORZ);
	BOOL bHasHorzBar = ((pBar != NULL) && pBar->IsWindowEnabled()) ||
					(dwStyle & WS_HSCROLL);

	if (!bHasVertBar && !bHasHorzBar)
		return FALSE;

	BOOL bResult = FALSE;
	UINT uWheelScrollLines = 10;//_AfxGetMouseScrollLines();
	int nToScroll;
	int nDisplacement;

	if (bHasVertBar)
	{
		nToScroll = ::MulDiv(-zDelta, uWheelScrollLines, WHEEL_DELTA);
		if (nToScroll == -1 || uWheelScrollLines == WHEEL_PAGESCROLL)
		{
			nDisplacement = m_pageDev.cy;
			if (zDelta > 0)
				nDisplacement = -nDisplacement;
		}
		else
		{
			nDisplacement = nToScroll * m_lineDev.cy;
			nDisplacement = min(nDisplacement, m_pageDev.cy);
		}
		bResult = OnScrollBy(CSize(0, nDisplacement), TRUE);
	}
	else if (bHasHorzBar)
	{
		nToScroll = ::MulDiv(-zDelta, uWheelScrollLines, WHEEL_DELTA);
		if (nToScroll == -1 || uWheelScrollLines == WHEEL_PAGESCROLL)
		{
			nDisplacement = m_pageDev.cx;
			if (zDelta > 0)
				nDisplacement = -nDisplacement;
		}
		else
		{
			nDisplacement = nToScroll * m_lineDev.cx;
			nDisplacement = min(nDisplacement, m_pageDev.cx);
		}
		bResult = OnScrollBy(CSize(nDisplacement, 0), TRUE);
	}

	if (bResult)
		UpdateWindow();

	return bResult;
}
Ejemplo n.º 16
0
void ServerOpts2::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	// TODO: Add your message handler code here and/or call default
	int OldScrollPos = GetScrollPos(SB_VERT);
	CScrollBar* pLScrollBar = GetScrollBarCtrl(SB_VERT);

	int Min, Max;
	GetScrollRange(SB_VERT, &Min, &Max);
	RECT WindowRect;
	GetClientRect(&WindowRect);
	long WindowHeight = WindowRect.bottom - WindowRect.top;
	long PageSize = WindowHeight;
	long LineSize = PageSize/10;

	switch (nSBCode)
	{
	case SB_TOP : //   Scroll to top. 
		{
			SetScrollPos(SB_VERT, Min, TRUE);
			ScrollWindow(0, Min - OldScrollPos);
		}break;
	case SB_BOTTOM :  //Scroll to bottom.
		{
			SetScrollPos(SB_VERT, Max, TRUE);
			ScrollWindow(0, Max - OldScrollPos);
		}break;
	case SB_LINEDOWN : //  Scroll one line down.
		{
			if (OldScrollPos < Max)
			{
				SetScrollPos(SB_VERT, OldScrollPos+LineSize, TRUE);
				ScrollWindow(0, -LineSize);
			};
		};break;
	case SB_LINEUP : // Scroll one line up.
		{
			if (OldScrollPos > Min)
			{
                SetScrollPos(SB_VERT, OldScrollPos-LineSize, TRUE);
				ScrollWindow(0, LineSize);
			}
		}break;
	case SB_PAGEDOWN : //  Scroll one page down.
		{
			int NewPos = OldScrollPos + PageSize;
			if (NewPos > Max) NewPos = Max;
			SetScrollPos(SB_VERT, NewPos, TRUE);
			ScrollWindow(0, OldScrollPos - NewPos);
		}break;
	case SB_PAGEUP : //  Scroll one page up.
		{
			int NewPos = OldScrollPos - PageSize;
			if (NewPos < Min) NewPos = Min;
			SetScrollPos(SB_VERT, NewPos, TRUE);
			ScrollWindow(0, OldScrollPos - NewPos);
		}break;
	case SB_THUMBPOSITION : //  Scroll to the absolute position. The current position is provided in nPos.
//		{
//		}break;
	case SB_THUMBTRACK : //  Drag scroll box to specified position. The current position is provided in nPos.
		{
			ScrollWindow(0, OldScrollPos - nPos);
			SetScrollPos(SB_VERT, nPos, TRUE);
		}break;	
	case SB_ENDSCROLL ://  End scroll.
		{
		}break;
	};
	
	CSubDlg::OnVScroll(nSBCode, nPos, pScrollBar);
}