Skip to content

Commit

Permalink
[NUI] Add missing IsUsingXaml check to Text
Browse files Browse the repository at this point in the history
Signed-off-by: Bowon Ryu <[email protected]>
  • Loading branch information
wonrst committed Sep 11, 2024
1 parent b59a776 commit 2431e86
Show file tree
Hide file tree
Showing 4 changed files with 386 additions and 90 deletions.
130 changes: 107 additions & 23 deletions src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,14 @@ public void SetFontStyle(FontStyle fontStyle)
{
using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
{
SetValue(FontStyleProperty, fontStyleMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(FontStyleProperty, fontStyleMap);
}
else
{
SetInternalFontStyleProperty(this, null, fontStyleMap);
}
}
}

Expand All @@ -585,7 +592,7 @@ public void SetFontStyle(FontStyle fontStyle)
public FontStyle GetFontStyle()
{
FontStyle fontStyle;
using (var fontStyleMap = (PropertyMap)GetValue(FontStyleProperty))
using (var fontStyleMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(FontStyleProperty) : (PropertyMap)GetInternalFontStyleProperty(this))
{
fontStyle = TextMapHelper.GetFontStyleStruct(fontStyleMap);
}
Expand Down Expand Up @@ -1147,15 +1154,29 @@ public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
{
using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.LeftImageUrl))
{
SetValue(SelectionHandleImageLeftProperty, leftImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandleImageLeftProperty, leftImageMap);
}
else
{
SetInternalSelectionHandleImageLeftProperty(this, null, leftImageMap);
}
}
}

if (!String.IsNullOrEmpty(selectionHandleImage.RightImageUrl))
{
using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleImage.RightImageUrl))
{
SetValue(SelectionHandleImageRightProperty, rightImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandleImageRightProperty, rightImageMap);
}
else
{
SetInternalSelectionHandleImageRightProperty(this, null, rightImageMap);
}
}
}
}
Expand All @@ -1171,8 +1192,8 @@ public void SetSelectionHandleImage(SelectionHandleImage selectionHandleImage)
public SelectionHandleImage GetSelectionHandleImage()
{
SelectionHandleImage selectionHandleImage;
using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleImageLeftProperty))
using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleImageRightProperty))
using (var leftImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandleImageLeftProperty) : (PropertyMap)GetInternalSelectionHandleImageLeftProperty(this))
using (var rightImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandleImageRightProperty) : (PropertyMap)GetInternalSelectionHandleImageRightProperty(this))
{
selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
}
Expand Down Expand Up @@ -1274,15 +1295,29 @@ public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandleP
{
using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.LeftImageUrl))
{
SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandlePressedImageLeftProperty, leftImageMap);
}
else
{
SetInternalSelectionHandlePressedImageLeftProperty(this, null, leftImageMap);
}
}
}

if (!String.IsNullOrEmpty(selectionHandlePressedImage.RightImageUrl))
{
using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandlePressedImage.RightImageUrl))
{
SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandlePressedImageRightProperty, rightImageMap);
}
else
{
SetInternalSelectionHandlePressedImageRightProperty(this, null, rightImageMap);
}
}
}
}
Expand All @@ -1298,8 +1333,8 @@ public void SetSelectionHandlePressedImage(SelectionHandleImage selectionHandleP
public SelectionHandleImage GetSelectionHandlePressedImage()
{
SelectionHandleImage selectionHandleImage;
using (var leftImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty))
using (var rightImageMap = (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty))
using (var leftImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty) : (PropertyMap)GetInternalSelectionHandlePressedImageLeftProperty(this))
using (var rightImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty) : (PropertyMap)GetInternalSelectionHandlePressedImageRightProperty(this))
{
selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
}
Expand Down Expand Up @@ -1401,15 +1436,29 @@ public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMa
{
using (var leftImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.LeftImageUrl))
{
SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandleMarkerImageLeftProperty, leftImageMap);
}
else
{
SetInternalSelectionHandleMarkerImageLeftProperty(this, null, leftImageMap);
}
}
}

if (!String.IsNullOrEmpty(selectionHandleMarkerImage.RightImageUrl))
{
using (var rightImageMap = TextMapHelper.GetFileNameMap(selectionHandleMarkerImage.RightImageUrl))
{
SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(SelectionHandleMarkerImageRightProperty, rightImageMap);
}
else
{
SetInternalSelectionHandleMarkerImageRightProperty(this, null, rightImageMap);
}
}
}
}
Expand All @@ -1425,8 +1474,8 @@ public void SetSelectionHandleMarkerImage(SelectionHandleImage selectionHandleMa
public SelectionHandleImage GetSelectionHandleMarkerImage()
{
SelectionHandleImage selectionHandleImage;
using (var leftImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty))
using (var rightImageMap = (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty))
using (var leftImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty) : (PropertyMap)GetInternalSelectionHandleMarkerImageLeftProperty(this))
using (var rightImageMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty) : (PropertyMap)GetInternalSelectionHandleMarkerImageRightProperty(this))
{
selectionHandleImage = TextMapHelper.GetSelectionHandleImageStruct(leftImageMap, rightImageMap);
}
Expand Down Expand Up @@ -1669,7 +1718,14 @@ public void SetInputFontStyle(FontStyle fontStyle)
{
using (var fontStyleMap = TextMapHelper.GetFontStyleMap(fontStyle))
{
SetValue(InputFontStyleProperty, fontStyleMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(InputFontStyleProperty, fontStyleMap);
}
else
{
SetInternalInputFontStyleProperty(this, null, fontStyleMap);
}
}
}

Expand Down Expand Up @@ -1881,7 +1937,14 @@ public void SetUnderline(Underline underline)
{
using (var underlineMap = TextMapHelper.GetUnderlineMap(underline))
{
SetValue(UnderlineProperty, underlineMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(UnderlineProperty, underlineMap);
}
else
{
SetInternalUnderlineProperty(this, null, underlineMap);
}
}
}

Expand All @@ -1896,7 +1959,7 @@ public void SetUnderline(Underline underline)
public Underline GetUnderline()
{
Underline underline;
using (var underlineMap = (PropertyMap)GetValue(UnderlineProperty))
using (var underlineMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(UnderlineProperty) : (PropertyMap)GetInternalUnderlineProperty(this))
{
underline = TextMapHelper.GetUnderlineStruct(underlineMap);
}
Expand Down Expand Up @@ -1995,7 +2058,14 @@ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
{
using (var shadowMap = TextMapHelper.GetShadowMap(shadow))
{
SetValue(ShadowProperty, shadowMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(ShadowProperty, shadowMap);
}
else
{
SetInternalShadowProperty(this, null, shadowMap);
}
}
}

Expand All @@ -2010,7 +2080,7 @@ public void SetShadow(Tizen.NUI.Text.Shadow shadow)
public Tizen.NUI.Text.Shadow GetShadow()
{
Tizen.NUI.Text.Shadow shadow;
using (var shadowMap = (PropertyMap)GetValue(ShadowProperty))
using (var shadowMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(ShadowProperty) : (PropertyMap)GetInternalShadowProperty(this))
{
shadow = TextMapHelper.GetShadowStruct(shadowMap);
}
Expand Down Expand Up @@ -2172,7 +2242,14 @@ public void SetOutline(Outline outline)
{
using (var outlineMap = TextMapHelper.GetOutlineMap(outline))
{
SetValue(OutlineProperty, outlineMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(OutlineProperty, outlineMap);
}
else
{
SetInternalOutlineProperty(this, null, outlineMap);
}
}
}

Expand All @@ -2187,7 +2264,7 @@ public void SetOutline(Outline outline)
public Outline GetOutline()
{
Outline outline;
using (var outlineMap = (PropertyMap)GetValue(OutlineProperty))
using (var outlineMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(OutlineProperty) : (PropertyMap)GetInternalOutlineProperty(this))
{
outline = TextMapHelper.GetOutlineStruct(outlineMap);
}
Expand Down Expand Up @@ -3073,7 +3150,14 @@ public void SetPlaceholder(Placeholder placeholder)
{
using (var placeholderMap = TextMapHelper.GetPlaceholderMap(placeholder))
{
SetValue(PlaceholderProperty, placeholderMap);
if (NUIApplication.IsUsingXaml)
{
SetValue(PlaceholderProperty, placeholderMap);
}
else
{
SetInternalPlaceholderProperty(this, null, placeholderMap);
}
}
}

Expand All @@ -3088,7 +3172,7 @@ public void SetPlaceholder(Placeholder placeholder)
public Placeholder GetPlaceholder()
{
Placeholder placeholder;
using (var placeholderMap = (PropertyMap)GetValue(PlaceholderProperty))
using (var placeholderMap = NUIApplication.IsUsingXaml ? (PropertyMap)GetValue(PlaceholderProperty) : (PropertyMap)GetInternalPlaceholderProperty(this))
{
placeholder = TextMapHelper.GetPlaceholderStruct(placeholderMap);
}
Expand Down
Loading

0 comments on commit 2431e86

Please sign in to comment.