{
if (value != _span.LineBreakMode)
{
+ var previousMode = _span.LineBreakMode;
_span.LineBreakMode = value;
- ApplyTextAndStyle();
+ switch(value)
+ {
+ case LineBreakMode.NoWrap:
+ LineWrapType = WrapType.None;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.CharacterWrap:
+ LineWrapType = WrapType.Char;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.WordWrap:
+ LineWrapType = WrapType.Word;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.MixedWrap:
+ LineWrapType = WrapType.Mixed;
+ IsEllipsis = false;
+ break;
+ default:
+ LineWrapType = WrapType.None;
+ IsEllipsis = true;
+ break;
+ }
+ if (IsEllipsis || previousMode >= LineBreakMode.HeadTruncation)
+ {
+ ApplyTextAndStyle();
+ }
}
}
}
/// <value>The vertical text alignment.</value>
public TextAlignment VerticalTextAlignment
{
- // TODO. need to EFL new API
- get;
- set;
+ // README: It only work on Tizen 4.0
+ get
+ {
+ double valign = GetVerticalTextAlignment("elm.text");
+ if (valign == 0.0)
+ {
+ return TextAlignment.Start;
+ }
+ else if (valign == 0.5)
+ {
+ return TextAlignment.Center;
+ }
+ else if (valign == 1.0)
+ {
+ return TextAlignment.End;
+ }
+ else
+ {
+ return TextAlignment.Auto;
+ }
+ }
+ set
+ {
+ double valign = 0;
+ switch (value)
+ {
+ case TextAlignment.Auto:
+ valign = -1;
+ break;
+ case TextAlignment.None:
+ case TextAlignment.Start:
+ valign = 0;
+ break;
+ case TextAlignment.Center:
+ valign = 0.5;
+ break;
+ case TextAlignment.End:
+ valign = 1.0;
+ break;
+ }
+ SetVerticalTextAlignment("elm.text", valign);
+ }
}
/// <summary>
void SetInternalTextAndStyle(string formattedText, string textStyle)
{
- string emission = "elm,state,text,visible";
-
- if (string.IsNullOrEmpty(formattedText))
- {
- formattedText = null;
- textStyle = null;
- emission = "elm,state,text,hidden";
- }
-
base.Text = formattedText;
-
- var textblock = EdjeObject["elm.text"];
-
- if (textblock != null)
- {
- textblock.TextStyle = textStyle;
- }
-
- EdjeObject.EmitSignal(emission, "elm");
-
- switch (LineBreakMode)
- {
- case LineBreakMode.NoWrap:
- emission = "elm,state,horizontal,expandable";
- break;
- default:
- emission = "elm,state,horizontal,fixed";
- break;
- }
- EdjeObject.EmitSignal(emission, "elm");
+ TextStyle = textStyle;
}
}
}
switch (LineBreakMode)
{
- case LineBreakMode.NoWrap:
- _formattingString.Append("wrap=none");
- break;
-
- case LineBreakMode.CharacterWrap:
- _formattingString.Append("wrap=char");
- break;
-
- case LineBreakMode.WordWrap:
- _formattingString.Append("wrap=word");
- break;
-
- case LineBreakMode.MixedWrap:
- _formattingString.Append("wrap=mixed");
- break;
-
case LineBreakMode.HeadTruncation:
_formattingString.Append("ellipsis=0.0");
break;
_formattingString.Append("ellipsis=1.0");
break;
+ case LineBreakMode.NoWrap:
+ case LineBreakMode.CharacterWrap:
+ case LineBreakMode.WordWrap:
+ case LineBreakMode.MixedWrap:
case LineBreakMode.None:
break;
}