void _MediaSlider_::SetCurTime( bigtime_t curTime) { fCurTime = curTime; UpdateThumb(false); }
bool wxScrollBar::PerformAction(const wxControlAction& action, long numArg, const wxString& strArg) { int thumbOld = m_thumbPos; bool notify = false; // send an event about the change? wxEventType scrollType; // test for thumb move first as these events happen in quick succession if ( action == wxACTION_SCROLL_THUMB_MOVE ) { DoSetThumb(numArg); // VS: we have to force redraw here, otherwise the thumb will lack // behind mouse cursor UpdateThumb(); scrollType = wxEVT_SCROLLWIN_THUMBTRACK; } else if ( action == wxACTION_SCROLL_LINE_UP ) { scrollType = wxEVT_SCROLLWIN_LINEUP; ScrollLines(-1); } else if ( action == wxACTION_SCROLL_LINE_DOWN ) { scrollType = wxEVT_SCROLLWIN_LINEDOWN; ScrollLines(1); } else if ( action == wxACTION_SCROLL_PAGE_UP ) { scrollType = wxEVT_SCROLLWIN_PAGEUP; ScrollPages(-1); } else if ( action == wxACTION_SCROLL_PAGE_DOWN ) { scrollType = wxEVT_SCROLLWIN_PAGEDOWN; ScrollPages(1); } else if ( action == wxACTION_SCROLL_START ) { scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better? ScrollToStart(); } else if ( action == wxACTION_SCROLL_END ) { scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better? ScrollToEnd(); } else if ( action == wxACTION_SCROLL_THUMB_DRAG ) { // we won't use it but this line suppresses the compiler // warning about "variable may be used without having been // initialized" scrollType = wxEVT_NULL; } else if ( action == wxACTION_SCROLL_THUMB_RELEASE ) { // always notify about this notify = true; scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; } else return wxControl::PerformAction(action, numArg, strArg); // has scrollbar position changed? bool changed = m_thumbPos != thumbOld; if ( notify || changed ) { if ( IsStandalone() ) { // we should generate EVT_SCROLL events for the standalone // scrollbars and not the EVT_SCROLLWIN ones // // NB: we assume that scrollbar events are sequentially numbered // but this should be ok as other code relies on this as well scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP; wxScrollEvent event(scrollType, this->GetId(), m_thumbPos, IsVertical() ? wxVERTICAL : wxHORIZONTAL); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } else // part of the window { wxScrollWinEvent event(scrollType, m_thumbPos, IsVertical() ? wxVERTICAL : wxHORIZONTAL); event.SetEventObject(this); GetParent()->GetEventHandler()->ProcessEvent(event); } } return true; }
void wxScrollBar::OnInternalIdle() { UpdateThumb(); wxControl::OnInternalIdle(); }
void _MediaSlider_::ResetBitmap() { delete (fBitmap); //delete (fOffscreenView) is done for you implicitly BRect bounds = Bounds(); bounds.bottom = bounds.top + kSliderHeight - 1.0; fBitmap = new BBitmap(bounds, B_CMAP8, true); fOffscreenView = new BView(bounds, B_EMPTY_STRING, 0, 0); fBitmap->Lock(); fBitmap->AddChild(fOffscreenView); rgb_color viewColor = ViewColor(); rgb_color dark = tint_color(viewColor, B_DARKEN_1_TINT); fOffscreenView->BeginLineArray(6); fOffscreenView->AddLine(bounds.LeftBottom(), bounds.LeftTop(), dark); fOffscreenView->AddLine(bounds.LeftTop(), bounds.RightTop(), dark); fOffscreenView->AddLine(bounds.RightTop(), bounds.RightBottom(), kWhite); fOffscreenView->AddLine(bounds.RightBottom(), bounds.LeftBottom(), kWhite); bounds.InsetBy(1.0, 1.0); fOffscreenView->AddLine(bounds.LeftBottom(), bounds.LeftTop(), kBlack); fOffscreenView->AddLine(bounds.LeftTop(), bounds.RightTop(), kBlack); fOffscreenView->EndLineArray(); bounds.left++; bounds.top++; fOffscreenView->SetLowColor(kSliderBackgroundColor); fOffscreenView->FillRect(bounds, B_SOLID_LOW); int32 numInsets = (int32)floor(bounds.Width() / 6); BRect insetRect = bounds; insetRect.InsetBy(0.0, 3.0); insetRect.right = insetRect.left; fOffscreenView->BeginLineArray(numInsets * 2); for (int32 i = 0; i < numInsets; i++) { fOffscreenView->AddLine(insetRect.LeftTop(), insetRect.LeftBottom(), kSliderInsetDarkColor); insetRect.OffsetBy(1.0, 0.0); fOffscreenView->AddLine(insetRect.LeftTop(), insetRect.LeftBottom(), kSliderInsetLightColor); insetRect.OffsetBy(5.0, 0.0); } fOffscreenView->EndLineArray(); fOffscreenView->Sync(); fBitmap->Unlock(); UpdateThumb(true); }