void CXTPMarkupUIElement::InvalidateMeasureOverride(CXTPMarkupDrawingContext* pDC) { if (!m_bMeasureInProgress && !m_bNeverMeasured) { m_bMeasureDirty = TRUE; m_bArrangeDirty = TRUE; CSize sz = GetDesiredSize(); Measure(pDC, m_szPreviousAvailableSize); if (sz != GetDesiredSize()) { m_bMeasureDirty = TRUE; m_bArrangeDirty = TRUE; CXTPMarkupUIElement* pParent = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, GetVisualParent()); if (pParent) { pParent->InvalidateMeasureOverride(pDC); } else if (m_pMarkupContext) { m_pMarkupContext->OnInvalidateArrange(this); } } else { Arrange(m_rcFinalRect); InvalidateVisual(); } } }
void OnMouseMove(suic::MouseEventArg& e) { if (IsMouseCaptured()) { int iHorz = e.MousePoint().x - _prev.x; int iVert = e.MousePoint().y - _prev.y; int newPos = _trackStart; if (CoreFlags::Horizontal == _slider->GetOrientation()) { newPos += iHorz; if (newPos < 0) { newPos = 0; } if (newPos > _slider->RenderSize().cx - GetDesiredSize().cx) { newPos = _slider->RenderSize().cx - GetDesiredSize().cx; } iHorz = newPos - _trackPos; } else { newPos += iVert; if (newPos < 0) { newPos = 0; } if (newPos > _slider->RenderSize().cy - GetDesiredSize().cy) { newPos = _slider->RenderSize().cy - GetDesiredSize().cy; } iVert = newPos - _trackPos; } if (ThumbDragDelta && newPos != _trackPos) { _trackPos = newPos; DragDeltaEventArg de(iHorz, iVert); ThumbDragDelta(de); } } }
NS_IMETHODIMP nsLeafFrame::Reflow(nsPresContext* aPresContext, nsHTMLReflowMetrics& aMetrics, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsLeafFrame", aReflowState.reason); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d", aReflowState.availableWidth, aReflowState.availableHeight)); NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow"); // XXX add in code to check for width/height being set via css // and if set use them instead of calling GetDesiredSize. GetDesiredSize(aPresContext, aReflowState, aMetrics); nsMargin borderPadding; AddBordersAndPadding(aPresContext, aReflowState, aMetrics, borderPadding); if (aMetrics.mComputeMEW) { aMetrics.SetMEWToActualWidth(aReflowState.mStylePosition->mWidth.GetUnit()); } aStatus = NS_FRAME_COMPLETE; NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("exit nsLeafFrame::Reflow: size=%d,%d", aMetrics.width, aMetrics.height)); NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics); return NS_OK; }
// /// Called when a change occurs in the size of the margins of the tool box or size /// of the gadgets, LayoutSession gets the desired size and moves the window to /// adjust to the desired change in size. /// /// Assumes it is used as a client in a frame. // void TToolBox::LayoutSession() { TGadgetWindow::LayoutSession(); TSize sz; GetDesiredSize(sz); SetWindowPos(0, 0,0, sz.cx, sz.cy, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); }
void Slider::OnRender(suic::DrawingContext * drawing) { // 先绘制背景 suic::Rect rcdraw(0, 0, RenderSize().cx, RenderSize().cy); suic::TriggerPtr trg(GetStyle()->GetTrigger()); suic::ImageBrushPtr bkgnd(trg->GetValue(suic::BACKGROUND)); if (!bkgnd) { if (GetOrientation() == CoreFlags::Horizontal) { rcdraw.top = (RenderSize().cy - GetDesiredSize().cy) / 2; rcdraw.bottom = rcdraw.top + GetDesiredSize().cy; } else { rcdraw.left = (RenderSize().cx - GetDesiredSize().cx) / 2; rcdraw.right = rcdraw.left + GetDesiredSize().cx; } suic::UIRender::DrawBackground(drawing, trg, &rcdraw); } else { suic::Rect rect = bkgnd->GetContentBrounds(); if (GetOrientation() == CoreFlags::Horizontal) { rcdraw.top = (RenderSize().cy - rect.Height()) / 2; rcdraw.bottom = rcdraw.top + rect.Height(); } else { rcdraw.left = (RenderSize().cx - rect.Width()) / 2; rcdraw.right = rcdraw.left + rect.Width(); } bkgnd->Draw(drawing, &rcdraw); } }
/** SWidget interface */ virtual void OnArrangeChildren( const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren ) const override { for (int32 ChildIndex=0; ChildIndex < VisibleChildren.Num(); ++ChildIndex) { const auto Child = StaticCastSharedRef<SWorldTileItem>(VisibleChildren[ChildIndex]); const EVisibility ChildVisibility = Child->GetVisibility(); if (ArrangedChildren.Accepts(ChildVisibility)) { FVector2D ChildPos = Child->GetPosition(); ArrangedChildren.AddWidget(ChildVisibility, AllottedGeometry.MakeChild(Child, ChildPos - GetViewOffset(), Child->GetDesiredSize(), GetZoomAmount() )); } } }
suic::Size ScrollViewer::MeasureOverride(const suic::Size& availableSize) { _hScroll->Measure(availableSize); _vScroll->Measure(availableSize); suic::Size retSize(GetDesiredSize()); suic::ElementPtr cont(GetContent()); if (cont) { cont->Measure(availableSize); return cont->GetDesiredSize(); } else { return retSize; } }
void Add(const TSharedRef<SWidget>& InWidget) { TSharedPtr<SWidgetStackItem> NewItem; InsertSlot(0) .AutoHeight() [ SAssignNew(NewItem, SWidgetStackItem) [ InWidget ] ]; { auto Widget = Children[0].GetWidget(); Widget->SlatePrepass(); const float WidgetHeight = Widget->GetDesiredSize().Y; StartSlideOffset += WidgetHeight; // Fade in time is 1 second x the proportion of the slide amount that this widget takes up NewItem->FadeIn(WidgetHeight / StartSlideOffset); if (!SlideCurve.IsPlaying()) { SlideCurve.Play(AsShared()); } } const FVector2D NewSize = ComputeTotalSize(); if (NewSize != StartSizeOffset) { StartSizeOffset = NewSize; if (!SizeCurve.IsPlaying()) { SizeCurve.Play(AsShared()); } } }
SIZE SImagePlayer::GetImageSize() { CSize size = GetDesiredSize(NULL); SIZE sizeRet = {size.cx, size.cy}; return sizeRet; }