本文整理汇总了C++中FWidgetStyle类的典型用法代码示例。如果您正苦于以下问题:C++ FWidgetStyle类的具体用法?C++ FWidgetStyle怎么用?C++ FWidgetStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FWidgetStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
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;
}
示例2: OnPaint
int32 FSlateTextUnderlineLineHighlighter::OnPaint(const FPaintArgs& Args, const FTextLayout::FLineView& Line, const float OffsetX, const float Width, const FTextBlockStyle& DefaultStyle, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
TSharedRef<FSlateFontCache> FontCache = FSlateApplication::Get().GetRenderer()->GetFontCache();
const uint16 MaxHeight = FontCache->GetMaxCharacterHeight(FontInfo, AllottedGeometry.Scale);
const int16 Baseline = FontCache->GetBaseline(FontInfo, AllottedGeometry.Scale);
int16 UnderlinePos, UnderlineThickness;
FontCache->GetUnderlineMetrics(FontInfo, AllottedGeometry.Scale, UnderlinePos, UnderlineThickness);
const FVector2D Location(Line.Offset.X + OffsetX, Line.Offset.Y + MaxHeight + Baseline - (UnderlinePos * 0.5f));
const FVector2D Size(Width, FMath::Max<int16>(1, UnderlineThickness));
// The block size and offset values are pre-scaled, so we need to account for that when converting the block offsets into paint geometry
const float InverseScale = Inverse(AllottedGeometry.Scale);
if (Size.X)
{
const FLinearColor LineColorAndOpacity = ColorAndOpacity.GetColor(InWidgetStyle);
const bool ShouldDropShadow = ShadowColorAndOpacity.A > 0.f && ShadowOffset.SizeSquared() > 0.f;
// A negative shadow offset should be applied as a positive offset to the underline to avoid clipping issues
const FVector2D DrawShadowOffset(
(ShadowOffset.X > 0.0f) ? ShadowOffset.X * AllottedGeometry.Scale : 0.0f,
(ShadowOffset.Y > 0.0f) ? ShadowOffset.Y * AllottedGeometry.Scale : 0.0f
);
const FVector2D DrawUnderlineOffset(
(ShadowOffset.X < 0.0f) ? -ShadowOffset.X * AllottedGeometry.Scale : 0.0f,
(ShadowOffset.Y < 0.0f) ? -ShadowOffset.Y * AllottedGeometry.Scale : 0.0f
);
// Draw the optional shadow
if (ShouldDropShadow)
{
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
AllottedGeometry.ToPaintGeometry(TransformVector(InverseScale, Size), FSlateLayoutTransform(TransformPoint(InverseScale, Location + DrawShadowOffset))),
&UnderlineBrush,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
ShadowColorAndOpacity * InWidgetStyle.GetColorAndOpacityTint()
);
}
// Draw underline
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
AllottedGeometry.ToPaintGeometry(TransformVector(InverseScale, Size), FSlateLayoutTransform(TransformPoint(InverseScale, Location + DrawUnderlineOffset))),
&UnderlineBrush,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
LineColorAndOpacity * InWidgetStyle.GetColorAndOpacityTint()
);
}
return LayerId;
}
示例3: OnPaint
int32 SColorWheel::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const bool bIsEnabled = ShouldBeEnabled(bParentEnabled);
const uint32 DrawEffects = bIsEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
Image,
MyClippingRect,
DrawEffects,
InWidgetStyle.GetColorAndOpacityTint() * Image->GetTint(InWidgetStyle));
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId + 1,
AllottedGeometry.ToPaintGeometry(CalcRelativeSelectedPosition() * AllottedGeometry.Size * 0.5f - SelectorImage->ImageSize * 0.5f, SelectorImage->ImageSize),
SelectorImage,
MyClippingRect,
DrawEffects,
InWidgetStyle.GetColorAndOpacityTint() * SelectorImage->GetTint(InWidgetStyle));
return LayerId + 1;
}
示例4: Location
int32 FSlateTextHighlightRunRenderer::OnPaint( const FPaintArgs& Args, const FTextLayout::FLineView& Line, const TSharedRef< ISlateRun >& Run, const TSharedRef< ILayoutBlock >& Block, const FTextBlockStyle& DefaultStyle, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
FVector2D Location( Block->GetLocationOffset() );
Location.Y = Line.Offset.Y;
// The block size and offset values are pre-scaled, so we need to account for that when converting the block offsets into paint geometry
const float InverseScale = Inverse(AllottedGeometry.Scale);
// Draw the actual highlight rectangle
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
AllottedGeometry.ToPaintGeometry(TransformVector(InverseScale, FVector2D( Block->GetSize().X, Line.Size.Y )), FSlateLayoutTransform(TransformPoint(InverseScale, Location))),
&DefaultStyle.HighlightShape,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
InWidgetStyle.GetColorAndOpacityTint() * DefaultStyle.HighlightColor
);
FLinearColor InvertedHighlightColor = FLinearColor::White - DefaultStyle.HighlightColor;
InvertedHighlightColor.A = InWidgetStyle.GetForegroundColor().A;
FWidgetStyle WidgetStyle( InWidgetStyle );
WidgetStyle.SetForegroundColor( InvertedHighlightColor );
return Run->OnPaint( Args, Line, Block, DefaultStyle, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, WidgetStyle, bParentEnabled );
}
示例5: OnPaint
int32 SColorBlock::OnPaint( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const FSlateBrush* GenericBrush = FCoreStyle::Get().GetBrush( "GenericWhiteBox" );
const ESlateDrawEffect::Type DrawEffects = ESlateDrawEffect::None;
FLinearColor InColor = Color.Get();
if (ColorIsHSV.Get())
{
InColor = InColor.HSVToLinearRGB();
}
if (IgnoreAlpha.Get())
{
InColor.A = 1.f;
}
const FColor DrawColor = InColor.ToFColor(bUseSRGB.Get());
if( ShowBackgroundForAlpha.Get() && DrawColor.A < 255 )
{
// If we are showing a background pattern and the colors is transparent, draw a checker pattern
const FSlateBrush* CheckerBrush = FCoreStyle::Get().GetBrush("ColorPicker.AlphaBackground");
FSlateDrawElement::MakeBox( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), CheckerBrush, MyClippingRect, DrawEffects );
}
// determine if it is HDR
const float MaxRGB = FMath::Max3(InColor.R, InColor.G, InColor.B);
if (MaxRGB > 1.f)
{
FLinearColor NormalizedLinearColor = InColor / MaxRGB;
NormalizedLinearColor.A = InColor.A;
const FColor DrawNormalizedColor = InWidgetStyle.GetColorAndOpacityTint() * NormalizedLinearColor.ToFColor(bUseSRGB.Get());
FLinearColor ClampedLinearColor = InColor;
ClampedLinearColor.A = InColor.A * MaxRGB;
const FColor DrawClampedColor = InWidgetStyle.GetColorAndOpacityTint() * ClampedLinearColor.ToFColor(bUseSRGB.Get());
TArray<FSlateGradientStop> GradientStops;
GradientStops.Add( FSlateGradientStop( FVector2D::ZeroVector, DrawNormalizedColor ) );
GradientStops.Add( FSlateGradientStop( AllottedGeometry.Size * 0.5f, DrawClampedColor ) );
GradientStops.Add( FSlateGradientStop( AllottedGeometry.Size, DrawNormalizedColor ) );
FSlateDrawElement::MakeGradient(
OutDrawElements,
LayerId + 1,
AllottedGeometry.ToPaintGeometry(),
GradientStops,
(AllottedGeometry.Size.X > AllottedGeometry.Size.Y) ? Orient_Vertical : Orient_Horizontal,
MyClippingRect,
DrawEffects
);
}
else
{
FSlateDrawElement::MakeBox( OutDrawElements, LayerId + 1, AllottedGeometry.ToPaintGeometry(), GenericBrush, MyClippingRect, DrawEffects, InWidgetStyle.GetColorAndOpacityTint() * DrawColor );
}
return LayerId + 1;
}
示例6: OnPaintTimeSlider
int32 FSequencerTimeSliderController::OnPaintTimeSlider( bool bMirrorLabels, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const bool bEnabled = bParentEnabled;
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
const float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
const float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
const float LocalSequenceLength = LocalViewRangeMax-LocalViewRangeMin;
FVector2D Scale = FVector2D(1.0f,1.0f);
if ( LocalSequenceLength > 0)
{
FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );
const float MajorTickHeight = 9.0f;
FDrawTickArgs Args;
Args.AllottedGeometry = AllottedGeometry;
Args.bMirrorLabels = bMirrorLabels;
Args.bOnlyDrawMajorTicks = false;
Args.TickColor = FLinearColor::White;
Args.ClippingRect = MyClippingRect;
Args.DrawEffects = DrawEffects;
Args.StartLayer = LayerId;
Args.TickOffset = bMirrorLabels ? 0.0f : FMath::Abs( AllottedGeometry.Size.Y - MajorTickHeight );
Args.MajorTickHeight = MajorTickHeight;
DrawTicks( OutDrawElements, RangeToScreen, Args );
const float HandleSize = 13.0f;
float HalfSize = FMath::TruncToFloat(HandleSize/2.0f);
// Draw the scrub handle
const float XPos = RangeToScreen.InputToLocalX( TimeSliderArgs.ScrubPosition.Get() );
// Should draw above the text
const int32 ArrowLayer = LayerId + 2;
FPaintGeometry MyGeometry = AllottedGeometry.ToPaintGeometry( FVector2D( XPos-HalfSize, 0 ), FVector2D( HandleSize, AllottedGeometry.Size.Y ) );
FLinearColor ScrubColor = InWidgetStyle.GetColorAndOpacityTint();
// @todo Sequencer this color should be specified in the style
ScrubColor.A = ScrubColor.A*0.5f;
ScrubColor.B *= 0.1f;
ScrubColor.G *= 0.2f;
FSlateDrawElement::MakeBox(
OutDrawElements,
ArrowLayer,
MyGeometry,
bMirrorLabels ? ScrubHandleUp : ScrubHandleDown,
MyClippingRect,
DrawEffects,
ScrubColor
);
return ArrowLayer;
}
return LayerId;
}
示例7: ShouldBeEnabled
int32 SBorder::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const FSlateBrush* BrushResource = BorderImage.Get();
const bool bEnabled = ShouldBeEnabled(bParentEnabled);
const bool bShowDisabledEffect = ShowDisabledEffect.Get();
ESlateDrawEffect::Type DrawEffects = bShowDisabledEffect && !bEnabled ? ESlateDrawEffect::DisabledEffect : ESlateDrawEffect::None;
if ( BrushResource && BrushResource->DrawAs != ESlateBrushDrawType::NoDrawType )
{
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
BrushResource,
MyClippingRect,
DrawEffects,
BrushResource->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint() * BorderBackgroundColor.Get().GetColor( InWidgetStyle )
);
}
FWidgetStyle CompoundedWidgetStyle = FWidgetStyle(InWidgetStyle)
.BlendColorAndOpacityTint(ColorAndOpacity.Get())
.SetForegroundColor( ForegroundColor.Get() );
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyClippingRect.IntersectionWith( AllottedGeometry.GetClippingRect() ), OutDrawElements, LayerId, CompoundedWidgetStyle, bEnabled );
}
示例8: OnPaint
int32 SPropertyTableCell::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
if ( CellBackground && CellBackground->DrawAs != ESlateBrushDrawType::NoDrawType )
{
const FSlateBrush* Background = CellBackground;
if ( Cell->GetTable()->GetCurrentCell() == Cell )
{
Background = GetCurrentCellBorder();
}
else if ( Cell->GetTable()->GetSelectedCells().Contains( Cell.ToSharedRef() ) )
{
Background = FEditorStyle::GetBrush( Style, ".ReadOnlySelectedCellBorder" );
}
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
Background,
MyClippingRect,
ESlateDrawEffect::None,
Background->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint()
);
}
return SCompoundWidget::OnPaint( Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled );
}
示例9: OnPaint
int32 SSpinningImage::OnPaint( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const FSlateBrush* ImageBrush = Image.Get();
if ((ImageBrush != NULL) && (ImageBrush->DrawAs != ESlateBrushDrawType::NoDrawType))
{
const bool bIsEnabled = ShouldBeEnabled(bParentEnabled);
const uint32 DrawEffects = bIsEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FColor FinalColorAndOpacity( InWidgetStyle.GetColorAndOpacityTint() * ColorAndOpacity.Get().GetColor(InWidgetStyle) * ImageBrush->GetTint( InWidgetStyle ) );
const float Angle = Curve.GetLerpLooping() * 2.0f * PI;
FSlateDrawElement::MakeRotatedBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
ImageBrush,
MyClippingRect,
DrawEffects,
Angle,
TOptional<FVector2D>(), // Will auto rotate about center
FSlateDrawElement::RelativeToElement,
FinalColorAndOpacity
);
}
return LayerId;
}
示例10: OnPaint
int32 SCircularThrobber::OnPaint( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
const FColor FinalColorAndOpacity( InWidgetStyle.GetColorAndOpacityTint() * PieceImage->GetTint( InWidgetStyle ) );
const float Scale = AllottedGeometry.Scale;
const float OffsetX = (AllottedGeometry.Size.X * Scale * 0.5f) - (PieceImage->ImageSize.X * Scale * 0.5f);
const float OffsetY = (AllottedGeometry.Size.Y * Scale * 0.5f) - (PieceImage->ImageSize.Y * Scale * 0.5f);
FPaintGeometry PaintGeom = AllottedGeometry.ToPaintGeometry();
FVector2D Origin = PaintGeom.DrawPosition;
Origin.X += OffsetX;
Origin.Y += OffsetY;
const float DeltaAngle = NumPieces > 0 ? 2 * PI / NumPieces : 0;
const float Phase = Curve.GetLerpLooping() * 2 * PI;
for (int32 PieceIdx = 0; PieceIdx < NumPieces; ++PieceIdx)
{
PaintGeom.DrawPosition.X = Origin.X + FMath::Sin(DeltaAngle * PieceIdx + Phase) * OffsetX;
PaintGeom.DrawPosition.Y = Origin.Y + FMath::Cos(DeltaAngle * PieceIdx + Phase) * OffsetY;
PaintGeom.DrawSize = PieceImage->ImageSize * Scale * (PieceIdx + 1) / NumPieces;
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, PaintGeom, PieceImage, MyClippingRect, ESlateDrawEffect::None, InWidgetStyle.GetColorAndOpacityTint() );
}
return LayerId;
}
示例11: OnPaint
int32 SClippingHorizontalBox::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
// Get the clipped children info
FArrangedChildren ClippedArrangedChildren(EVisibility::Visible);
ArrangeChildren(AllottedGeometry, ClippedArrangedChildren);
// Get the non-clipped children info
// @todo umg: One should not call the virtual OnArrangeChildren, one should only call ArrangeChildren.
FArrangedChildren ArrangedChildren(EVisibility::Visible);
SBoxPanel::OnArrangeChildren(AllottedGeometry, ArrangedChildren);
if ((ClippedArrangedChildren.Num() != 0) && (ArrangedChildren.Num() != 0))
{
int32 IndexClippedAt = ClippedArrangedChildren.Num() - 1;
const FArrangedWidget& LastCippedChild = ClippedArrangedChildren[IndexClippedAt];
const FArrangedWidget& FirstChild = ArrangedChildren[0];
const FArrangedWidget& LastChild = ArrangedChildren[ArrangedChildren.Num() - 1];
float BorderLocalWidth = AllottedGeometry.Size.X;
// If only the last child/block, which is the wrap button, is being clipped
if (IndexClippedAt == ArrangedChildren.Num() - 2)
{
// Only recalculate the alloted geometry size if said size is fitted to the toolbar/menubar
if (FMath::TruncToInt(AllottedGeometry.AbsolutePosition.X + AllottedGeometry.Size.X * AllottedGeometry.Scale) <= FMath::TruncToInt(LastChild.Geometry.AbsolutePosition.X + LastChild.Geometry.Size.X * LastChild.Geometry.Scale))
{
// Calculate the size of the custom border
BorderLocalWidth = (LastCippedChild.Geometry.AbsolutePosition.X + LastCippedChild.Geometry.Size.X * LastCippedChild.Geometry.Scale - FirstChild.Geometry.AbsolutePosition.X) / AllottedGeometry.Scale;
}
}
else
{
// Children/blocks are being clipped, calculate the size of the custom border
const FArrangedWidget& NextChild = (IndexClippedAt + 1 < ClippedArrangedChildren.Num())? ClippedArrangedChildren[IndexClippedAt + 1]: LastCippedChild;
BorderLocalWidth = (NextChild.Geometry.AbsolutePosition.X + NextChild.Geometry.Size.X * NextChild.Geometry.Scale - FirstChild.Geometry.AbsolutePosition.X) / AllottedGeometry.Scale;
}
bool bEnabled = ShouldBeEnabled( bParentEnabled );
ESlateDrawEffect::Type DrawEffects = !bEnabled ? ESlateDrawEffect::DisabledEffect : ESlateDrawEffect::None;
FSlateColor BorderBackgroundColor = FLinearColor::White;
// Draw the custom border
FSlateDrawElement::MakeBox(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(FVector2D(BorderLocalWidth, AllottedGeometry.Size.Y), FSlateLayoutTransform()),
BackgroundBrush,
MyClippingRect,
DrawEffects,
BackgroundBrush->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint() * BorderBackgroundColor.GetColor(InWidgetStyle)
);
}
return SHorizontalBox::OnPaint(Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
}
示例12: OnPaint
int32 SGraphBar::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
// Used to track the layer ID we will return.
int32 RetLayerId = LayerId;
bool bEnabled = ShouldBeEnabled( bParentEnabled );
const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FLinearColor ColorAndOpacitySRGB = InWidgetStyle.GetColorAndOpacityTint();
static const FLinearColor SelectedBarColor(FLinearColor::White);
// Paint inside the border only.
const FVector2D BorderPadding = FTaskGraphStyle::Get()->GetVector("TaskGraph.ProgressBar.BorderPadding");
const FSlateRect ForegroundClippingRect = AllottedGeometry.GetClippingRect().InsetBy(FMargin(BorderPadding.X, BorderPadding.Y)).IntersectionWith(MyClippingRect);
FSlateDrawElement::MakeBox(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(),
BackgroundImage,
MyClippingRect,
DrawEffects,
ColorAndOpacitySRGB
);
// Draw all bars
for( int32 EventIndex = 0; EventIndex < Events.Num(); ++EventIndex )
{
TSharedPtr< FVisualizerEvent > Event = Events[ EventIndex ];
float StartX, EndX;
if( CalculateEventGeometry( Event.Get(), AllottedGeometry, StartX, EndX ) )
{
// Draw Event bar
FSlateDrawElement::MakeBox(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(
FVector2D( StartX, 0.0f ),
FVector2D( EndX - StartX, AllottedGeometry.Size.Y )),
Event->IsSelected ? SelectedImage : FillImage,
ForegroundClippingRect,
DrawEffects,
Event->IsSelected ? SelectedBarColor : ColorPalette[Event->ColorIndex % (sizeof(ColorPalette) / sizeof(ColorPalette[0]))]
);
}
}
return RetLayerId - 1;
}
示例13: Location
int32 FSlateSimpleRunHighlighter::OnPaint( const FTextLayout::FLineView& Line, const TSharedRef< ISlateRun >& Run, const TSharedRef< ILayoutBlock >& Block, const FTextBlockStyle& DefaultStyle, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
FVector2D Location( Block->GetLocationOffset() );
Location.Y = Line.Offset.Y;
// Draw the actual highlight rectangle
FSlateDrawElement::MakeBox(
OutDrawElements,
++LayerId,
FPaintGeometry( AllottedGeometry.AbsolutePosition + Location, FVector2D( Block->GetSize().X, Line.Size.Y ), AllottedGeometry.Scale ),
&DefaultStyle.HighlightShape,
MyClippingRect,
bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect,
InWidgetStyle.GetColorAndOpacityTint() * DefaultStyle.HighlightColor
);
FLinearColor InvertedForeground = FLinearColor::White - InWidgetStyle.GetForegroundColor();
InvertedForeground.A = InWidgetStyle.GetForegroundColor().A;
FWidgetStyle WidgetStyle( InWidgetStyle );
WidgetStyle.SetForegroundColor( InvertedForeground );
return Run->OnPaint( Line, Block, DefaultStyle, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, WidgetStyle, bParentEnabled );
}
示例14: OnPaint
int32 SVirtualJoystick::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
int32 RetLayerId = LayerId;
if (bVisible)
{
FLinearColor ColorAndOpacitySRGB = InWidgetStyle.GetColorAndOpacityTint();
ColorAndOpacitySRGB.A = FMath::RoundToInt(255.f * CurrentOpacity);
for (int32 ControlIndex = 0; ControlIndex < Controls.Num(); ControlIndex++)
{
const FControlInfo& Control = Controls[ControlIndex];
if (Control.Image2.IsValid())
{
FSlateDrawElement::MakeBox(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(
Control.VisualCenter - FVector2D(Control.CorrectedVisualSize.X * 0.5f, Control.CorrectedVisualSize.Y * 0.5f),
Control.CorrectedVisualSize),
Control.Image2.Get(),
MyClippingRect,
ESlateDrawEffect::None,
ColorAndOpacitySRGB
);
}
if (Control.Image1.IsValid())
{
FSlateDrawElement::MakeBox(
OutDrawElements,
RetLayerId++,
AllottedGeometry.ToPaintGeometry(
Control.VisualCenter + Control.ThumbPosition - FVector2D(Control.CorrectedThumbSize.X * 0.5f, Control.CorrectedThumbSize.Y * 0.5f),
Control.CorrectedThumbSize),
Control.Image1.Get(),
MyClippingRect,
ESlateDrawEffect::None,
ColorAndOpacitySRGB
);
}
}
}
return RetLayerId;
}
示例15: OnPaint
int32 SImage::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
#if SLATE_HD_STATS
SCOPE_CYCLE_COUNTER( STAT_SlateOnPaint_SImage );
#endif
const FSlateBrush* ImageBrush = Image.Get();
if ((ImageBrush != nullptr) && (ImageBrush->DrawAs != ESlateBrushDrawType::NoDrawType))
{
const bool bIsEnabled = ShouldBeEnabled(bParentEnabled);
const uint32 DrawEffects = bIsEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
const FColor FinalColorAndOpacity( InWidgetStyle.GetColorAndOpacityTint() * ColorAndOpacity.Get().GetColor(InWidgetStyle) * ImageBrush->GetTint( InWidgetStyle ) );
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), ImageBrush, MyClippingRect, DrawEffects, FinalColorAndOpacity );
}
return LayerId;
}