mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -23,6 +23,8 @@ class EE_API RichText : public Drawable {
|
||||
|
||||
enum class InlineClear { None, Left, Right, Both };
|
||||
|
||||
enum class WhiteSpaceWrapMode { Normal, Preserve, BreakSpaces };
|
||||
|
||||
struct FloatExclusion {
|
||||
Rectf rect;
|
||||
InlineFloat type{ InlineFloat::None };
|
||||
@@ -95,10 +97,22 @@ class EE_API RichText : public Drawable {
|
||||
*/
|
||||
void addSpan( const String& text, const FontStyleConfig& style );
|
||||
|
||||
void addSpan( const String::View& text, const FontStyleConfig& style );
|
||||
|
||||
void addSpan( String&& text, const FontStyleConfig& style );
|
||||
|
||||
void addSpan( const String& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight = 0,
|
||||
const BaselineAlignValue& baselineAlign = {}, InlineSource source = {} );
|
||||
|
||||
void addSpan( const String::View& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight = 0,
|
||||
const BaselineAlignValue& baselineAlign = {}, InlineSource source = {} );
|
||||
|
||||
void addSpan( String&& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight = 0,
|
||||
const BaselineAlignValue& baselineAlign = {}, InlineSource source = {} );
|
||||
|
||||
/**
|
||||
* @brief Adds a text span with individual style parameters.
|
||||
* @param text The text content.
|
||||
@@ -141,6 +155,14 @@ class EE_API RichText : public Drawable {
|
||||
/** @return Whether soft wrapping is enabled. */
|
||||
bool getLineWrap() const { return mLineWrap; }
|
||||
|
||||
void setWhiteSpaceWrapMode( WhiteSpaceWrapMode mode );
|
||||
|
||||
WhiteSpaceWrapMode getWhiteSpaceWrapMode() const { return mWhiteSpaceWrapMode; }
|
||||
|
||||
void setTabWidth( Uint32 tabWidth );
|
||||
|
||||
Uint32 getTabWidth() const { return mTabWidth; }
|
||||
|
||||
bool setExternalFloatExclusions( const std::vector<FloatExclusion>& exclusions );
|
||||
|
||||
const std::vector<FloatExclusion>& getExternalFloatExclusions() const {
|
||||
@@ -402,12 +424,30 @@ class EE_API RichText : public Drawable {
|
||||
const Rectf& padding, Float lineHeight,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source = {} );
|
||||
|
||||
void addInlineText( const String::View& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source = {} );
|
||||
|
||||
void addInlineText( String&& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source = {} );
|
||||
|
||||
/** Add an atomic inline-level box to the current inline context. */
|
||||
void addInlineAtomicBox( const Sizef& size, InlineFloat floatType, InlineClear clearType,
|
||||
Float baseline, bool isLineBreak,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source = {} );
|
||||
|
||||
protected:
|
||||
template <typename TextType>
|
||||
void addSpanImpl( TextType&& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source );
|
||||
|
||||
template <typename TextType>
|
||||
void addInlineTextImpl( TextType&& text, const FontStyleConfig& style, const Rectf& margin,
|
||||
const Rectf& padding, Float lineHeight,
|
||||
const BaselineAlignValue& baselineAlign, InlineSource source );
|
||||
|
||||
void rebuildInlineFragments();
|
||||
|
||||
std::vector<InlineItem> mInlineItems;
|
||||
@@ -427,6 +467,8 @@ class EE_API RichText : public Drawable {
|
||||
Float mLineHeight{ 0 };
|
||||
Float mTextIndent{ 0 };
|
||||
bool mLineWrap{ true };
|
||||
WhiteSpaceWrapMode mWhiteSpaceWrapMode{ WhiteSpaceWrapMode::Normal };
|
||||
Uint32 mTabWidth{ 8 };
|
||||
};
|
||||
|
||||
}} // namespace EE::Graphics
|
||||
|
||||
@@ -226,6 +226,7 @@ enum class PropertyId : Uint32 {
|
||||
LineSpacing = String::hash( "line-spacing" ),
|
||||
LineHeight = String::hash( "line-height" ),
|
||||
TextIndent = String::hash( "text-indent" ),
|
||||
TabSize = String::hash( "tab-size" ),
|
||||
GravityOwner = String::hash( "gravity-owner" ),
|
||||
Href = String::hash( "href" ),
|
||||
Focusable = String::hash( "focusable" ),
|
||||
|
||||
@@ -17,10 +17,11 @@ class EE_API UIRichText : public UIHTMLWidget {
|
||||
Preserve,
|
||||
PreserveBreaks,
|
||||
PreserveSpaces,
|
||||
BreakSpaces
|
||||
BreakSpaces,
|
||||
Discard
|
||||
};
|
||||
|
||||
static WhiteSpaceCollapse toWhiteSpaceCollapse( std::string val );
|
||||
static WhiteSpaceCollapse toWhiteSpaceCollapse( std::string_view val );
|
||||
|
||||
static std::string fromWhiteSpaceCollapse( WhiteSpaceCollapse val );
|
||||
|
||||
@@ -31,6 +32,10 @@ class EE_API UIRichText : public UIHTMLWidget {
|
||||
static void rebuildRichText( UILayout* container, RichText& richText,
|
||||
IntrinsicMode mode = IntrinsicMode::None );
|
||||
|
||||
static void setUseCodeEditorForPreCodeBlocks( bool enabled );
|
||||
|
||||
static bool getUseCodeEditorForPreCodeBlocks();
|
||||
|
||||
static UIRichText* New();
|
||||
|
||||
static UIRichText* NewWithTag( const std::string& tag );
|
||||
@@ -140,7 +145,7 @@ class EE_API UIRichText : public UIHTMLWidget {
|
||||
|
||||
void setLineWrap( bool lineWrap );
|
||||
|
||||
void applyWhiteSpace( std::string val );
|
||||
void applyWhiteSpace( std::string_view val );
|
||||
|
||||
Float getLineHeightPx() const;
|
||||
|
||||
@@ -150,6 +155,10 @@ class EE_API UIRichText : public UIHTMLWidget {
|
||||
|
||||
UIRichText* setTextIndentEq( const std::string& eq );
|
||||
|
||||
Uint32 getTabSize() const;
|
||||
|
||||
UIRichText* setTabSize( Uint32 tabSize );
|
||||
|
||||
bool isTextSelectionEnabled() const;
|
||||
|
||||
void setTextSelectionEnabled( bool active );
|
||||
@@ -185,6 +194,7 @@ class EE_API UIRichText : public UIHTMLWidget {
|
||||
mutable bool mLineHeightPxDirty{ true };
|
||||
mutable Float mTextIndentPxCache{ 0 };
|
||||
mutable bool mTextIndentPxDirty{ true };
|
||||
Uint32 mTabSize{ 8 };
|
||||
WhiteSpaceCollapse mWhiteSpaceCollapse{ WhiteSpaceCollapse::Collapse };
|
||||
bool mLineWrap{ true };
|
||||
TextTransform::Value mTextTransform{ TextTransform::None };
|
||||
|
||||
Reference in New Issue
Block a user