int32 SSplitter::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const { FArrangedChildren ArrangedChildren( EVisibility::Visible ); ArrangeChildren( AllottedGeometry, ArrangedChildren ); int32 MaxLayerId = PaintArrangedChildren( Args, ArrangedChildren, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled ); const FSlateBrush* NormalHandleBrush = &Style->HandleNormalBrush; // Draw the splitter above any children MaxLayerId += 1; for( int32 ChildIndex = 0; ChildIndex < ArrangedChildren.Num(); ++ChildIndex ) { const FGeometry& GeometryAfterSplitter = ArrangedChildren[ FMath::Clamp(ChildIndex + 1, 0, ArrangedChildren.Num()-1) ].Geometry; const float HalfHitDetectionSplitterHandleSize = ( HitDetectionSplitterHandleSize / 2 ); const float HalfPhysicalSplitterHandleSize = ( PhysicalSplitterHandleSize / 2 ); FVector2D HandleSize; FVector2D HandlePosition; if ( Orientation == Orient_Horizontal ) { HandleSize.Set( PhysicalSplitterHandleSize, GeometryAfterSplitter.Size.Y ); HandlePosition.Set( -(HalfHitDetectionSplitterHandleSize + HalfPhysicalSplitterHandleSize), 0 ); } else { HandleSize.Set( GeometryAfterSplitter.Size.X, PhysicalSplitterHandleSize ); HandlePosition.Set( 0, -(HalfHitDetectionSplitterHandleSize + HalfPhysicalSplitterHandleSize) ); } if (HoveredHandleIndex != ChildIndex) { FSlateDrawElement::MakeBox( OutDrawElements, MaxLayerId, GeometryAfterSplitter.ToPaintGeometry( HandlePosition, HandleSize, 1.0f ), NormalHandleBrush, MyClippingRect, ShouldBeEnabled( bParentEnabled ), InWidgetStyle.GetColorAndOpacityTint() * NormalHandleBrush->TintColor.GetSpecifiedColor() ); } else { FSlateDrawElement::MakeBox( OutDrawElements, MaxLayerId, GeometryAfterSplitter.ToPaintGeometry( HandlePosition, HandleSize, 1.0f ), &Style->HandleHighlightBrush, MyClippingRect, ShouldBeEnabled( bParentEnabled ), InWidgetStyle.GetColorAndOpacityTint() * Style->HandleHighlightBrush.TintColor.GetSpecifiedColor() ); } } return MaxLayerId; }
int32 SPanel::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const { // REMOVE THIS: Currently adding a debug quad so that BoxPanels are visible during development // OutDrawElements.AddItem( FSlateDrawElement::MakeQuad( AllottedGeometry.AbsolutePosition, AllottedGeometry.Size ) ); FArrangedChildren ArrangedChildren(EVisibility::Visible); { // The box panel has no visualization of its own; it just visualizes its children. this->ArrangeChildren(AllottedGeometry, ArrangedChildren); } return PaintArrangedChildren(Args, ArrangedChildren, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled); }