Day 3

  1. SlateCore\Public\Types\PaintArgs.h
/**
 * SWidget::OnPaint and SWidget::Paint use FPaintArgs as their
 * sole parameter in order to ease the burden of passing
 * through multiple fields.
 */
class SLATECORE_API FPaintArgs
{
public:
    FPaintArgs( const SWidget& Parent, FHittestGrid& InHittestGrid, FVector2D InWindowOffset, double InCurrentTime, float InDeltaTime );
    
    FORCEINLINE FPaintArgs WithNewParent(const SWidget* Parent) const
    {
        checkSlow(Parent);
        return WithNewParent(*Parent);
    }

    FORCEINLINE_DEBUGGABLE FPaintArgs WithNewParent(const SWidget& Parent) const
    {
        FPaintArgs Args = FPaintArgs(Parent, this->Grid, this->WindowOffset, this->CurrentTime, this->DeltaTime);
        Args.LastHittestIndex = this->LastHittestIndex;
        Args.LastRecordedVisibility = this->LastRecordedVisibility;
        Args.LayoutCache = this->LayoutCache;
        Args.ParentCacheNode = this->ParentCacheNode;
        Args.bIsCaching = this->bIsCaching;
        Args.bIsVolatilityPass = this->bIsVolatilityPass;

        return Args;
    }

    FPaintArgs EnableCaching(const TWeakPtr<ILayoutCache>& InLayoutCache, FCachedWidgetNode* InParentCacheNode, bool bEnableCaching, bool bEnableVolatility) const;
    FPaintArgs WithNewTime(double InCurrentTime, float InDeltaTime) const;
    FPaintArgs RecordHittestGeometry(const SWidget* Widget, const FGeometry& WidgetGeometry, int32 LayerId) const;
    FPaintArgs InsertCustomHitTestPath( TSharedRef<ICustomHitTestPath> CustomHitTestPath, int32 HitTestIndex ) const;

    FHittestGrid& GetGrid() const { return Grid; }
    int32 GetLastHitTestIndex() const { return LastHittestIndex; }
    EVisibility GetLastRecordedVisibility() const { return LastRecordedVisibility; }
    FVector2D GetWindowToDesktopTransform() const { return WindowOffset; }
    double GetCurrentTime() const { return CurrentTime; }
    float GetDeltaTime() const { return DeltaTime; }
    bool IsCaching() const { return bIsCaching; }
    bool IsVolatilityPass() const { return bIsVolatilityPass; }
    const TWeakPtr<ILayoutCache>& GetLayoutCache() const { return LayoutCache; }
    FCachedWidgetNode* GetParentCacheNode() const { return ParentCacheNode; }

private:
    const SWidget& ParentPtr;
    FHittestGrid& Grid;
    int32 LastHittestIndex;
    EVisibility LastRecordedVisibility;
    FVector2D WindowOffset;
    double CurrentTime;
    float DeltaTime;
    bool bIsCaching;
    bool bIsVolatilityPass;
    TWeakPtr<ILayoutCache> LayoutCache;
    FCachedWidgetNode* ParentCacheNode;
};

尚不理解该类的作用,需要后续调试。

  1. SlateCore\Public\Textures\SlateIcon.h
/**
 * Struct used to represent an icon in Slate
 */
struct SLATECORE_API FSlateIcon
{
    /**
     * Default constructor (empty icon).
     */
    FSlateIcon( );

    /**
     * Creates and initializes a new icon from a style set and style name
     *
     * @param InStyleSetName The name of the style set the icon can be found in.
     * @param StyleName The name of the style for the icon (assumes there may also be a ".Small" variant)
     */
    FSlateIcon( const FName& InStyleSetName, const FName& InStyleName );

    /**
     * Creates and initializes a new icon from a style set and style name
     *
     * @param InStyleSetName The name of the style set the icon can be found in.
     * @param StyleName The name of the style for the icon
     * @param InSmallStyleName The name of the style for the small icon
     */
    FSlateIcon( const FName& InStyleSetName, const FName& InStyleName, const FName& InSmallStyleName );

public:
    
    /**
     * Compare 2 slate icons for equality
     */
    friend bool operator==(const FSlateIcon& A, const FSlateIcon& B)
    {
        return A.bIsSet == B.bIsSet && A.StyleSetName == B.StyleSetName && A.StyleName == B.StyleName && A.SmallStyleName == B.SmallStyleName;
    }

    /**
     * Compare 2 slate icons for inequality
     */
    friend bool operator!=(const FSlateIcon& A, const FSlateIcon& B)
    {
        return !(A == B);
    }

public:

    /**
     * Gets the resolved icon.
     *
     * @return Icon brush, or FStyleDefaults::GetNoBrush() if the icon wasn't found.
     * @see GetSmallIcon
     */
    const FSlateBrush* GetIcon( ) const;

    /**
     * Optionally gets the resolved icon, returning nullptr if it's not defined
     *
     * @return Icon brush, or nullptr if the icon wasn't found.
     */
    const FSlateBrush* GetOptionalIcon( ) const;

    /**
     * Gets the resolved small icon.
     *
     * @return Icon brush, or FStyleDefaults::GetNoBrush() if the icon wasn't found.
     * @see GetIcon
     */
    const FSlateBrush* GetSmallIcon( ) const;


    /**
     * Optionally gets the resolved small icon, returning nullptr if it's not defined
     *
     * @return Icon brush, or nullptr if the icon wasn't found.
     */
    const FSlateBrush* GetOptionalSmallIcon( ) const;

    /**
     * Gets the name of the style for the icon.
     *
     * @return Style name.
     * @see GetStyleName, GetStyleSet, GetStyleSetName
     */
    const FName& GetSmallStyleName( ) const
    {
        return SmallStyleName;
    }

    /**
     * Gets the name of the style for the icon.
     *
     * @return Style name.
     * @see GetSmallStyleName, GetStyleSet, GetStyleSetName
     */
    const FName& GetStyleName( ) const
    {
        return StyleName;
    }

    /**
     * Gets the resolved style set.
     *
     * @return Style set, or nullptr if the style set wasn't found.
     * @see GetSmallStyleName, GetStyleName, GetStyleSetName
     */
    const class ISlateStyle* GetStyleSet( ) const;

    /**
     * Gets the name of the style set the icon can be found in.
     *
     * @return Style name.
     * @see GetSmallStyleName, GetStyleName, GetStyleSet
     */
    const FName& GetStyleSetName( ) const
    {
        return StyleSetName;
    }

    /**
     * Checks whether the icon is set to something.
     *
     * @return true if the icon is set, false otherwise.
     */
    const bool IsSet( ) const
    {
        return bIsSet;
    }

private:

    // The name of the style set the icon can be found in.
    FName StyleSetName;

    // The name of the style for the icon.
    FName StyleName;

    // The name of the style for the small icon.
    FName SmallStyleName;

    // Whether this icon has been explicitly set-up.
    bool bIsSet;
};

问题列表:
a. FSlateBrush是什么,有何作用.

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 81. □32 reward [rɪˈwɔ:d] n.报酬;v.酬谢;奖赏 派生:rewarding adj.有报...
    dreamhappy2009阅读 3,017评论 0 0
  • 学习地址 标签管理 标签tag是一个容易记住的有意义的名字,跟某个commit绑定在一起 创建标签$ git ta...
    fangmusan阅读 1,423评论 0 0
  • 敏姐,室内装潢设计师、私人订制服装设计师、私人订制发型师、形象设计师,我之所以称呼她这么多“师”,是因为这个蕙质兰...
    张一弘阅读 1,882评论 0 0
  • “听过那么多大道理,却还是过不好这一生"。 听到这句话,电影《后会无期》里面的女主角说这句话时候的神情,依稀浮现在...
    ACH思无邪阅读 1,594评论 0 1

友情链接更多精彩内容