//***************************************************************************** void CBCGPRibbonSlider::OnMouseMove (CPoint point) { ASSERT_VALID (this); CBCGPBaseRibbonElement::OnMouseMove (point); if (IsDisabled ()) { return; } int nHighlightedOld = m_nHighlighted; m_nHighlighted = GetHitTest (point); if (nHighlightedOld != m_nHighlighted) { Redraw (); } if (m_bIsPressed) { if (m_nPressed == nThumbIndex) { int nPos = GetPosFromPoint (point); if (nPos != m_nPos) { SetPos (nPos); NotifyCommand (); } } } }
//***************************************************************************** void CBCGPRibbonSlider::OnLButtonUp (CPoint point) { ASSERT_VALID (this); CBCGPBaseRibbonElement::OnLButtonUp (point); if (m_nPressed == m_nHighlighted && !IsDisabled ()) { switch (m_nPressed) { case nZoomInIndex: SetPos (m_nPos + m_nPageSize); break; case nZoomOutIndex: SetPos (m_nPos - m_nPageSize); break; default: SetPos (GetPosFromPoint (point)); break; } NotifyCommand (); } }
bool PG_ScrollBar::ScrollButton::eventMouseMotion(const SDL_MouseMotionEvent* motion) { PG_Point p; if(GetPressed()) { //SDL_GetMouseState(&x, &y); p = GetParent()->ScreenToClient(motion->x, motion->y); if(GetParent()->sb_direction == VERTICAL) { p.y -= offset.y; if(p.y < GetParent()->position[2].y) { p.y = GetParent()->position[2].y; } int maxy; if(!my_tickMode) { maxy = GetParent()->position[2].y + (GetParent()->position[2].h) - my_height; } else { maxy = GetParent()->my_height - my_height; } if(p.y > maxy) { p.y = maxy; } MoveWidget(GetParent()->position[2].x, p.y); } else { p.x -= offset.x; if(p.x < GetParent()->position[2].x) { p.x = GetParent()->position[2].x; } int maxx; if(!my_tickMode) { maxx = GetParent()->position[2].x + (GetParent()->position[2].w) - (my_width); } else { maxx = GetParent()->my_width - my_width; } if(p.x > maxx) { p.x = maxx; } MoveWidget(p.x, GetParent()->position[2].y); } int pos = GetPosFromPoint(p); if(GetParent()->scroll_current != pos || my_tickMode) { GetParent()->scroll_current = pos; GetParent()->sigScrollTrack(GetParent(), pos); } } return true; }