res/nui_component_default_radiobutton_n.png #common #mobile #mobile-emul #tv #wearable
res/nui_component_default_radiobutton_p.png #common #mobile #mobile-emul #tv #wearable
res/nui_component_default_radiobutton_s.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_popup_shadow.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_slider_thumb_bg_p.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_slider_thumb_n.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_dropdown_button_icon.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_dropdown_list_bg.png #common #mobile #mobile-emul #tv #wearable
Tizen.Account.AccountManager.dll #mobile #mobile-emul #tv #wearable
Tizen.Account.FidoClient.dll #mobile #mobile-emul #wearable
Tizen.Account.OAuth2.dll #mobile #mobile-emul #wearable
if (Count == 0) return;
int buttonWidth = (int)root.Size.Width / Count;
- int buttonHeight = (int)itemheight;
+ int buttonHeight = btStyle.Size.Height > itemheight ? (int)btStyle.Size.Height : (int)itemheight;
foreach (Button btnTemp in itemGroup)
{
btnTemp.Size = new Size(buttonWidth, buttonHeight);
if (newValue != null)
{
int selectedItemIndex = (int)newValue;
- if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex >= instance.adapter.GetItemCount())
+ if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
{
return;
}
- instance.UpdateSelectedItem(selectedItemIndex);
+ instance.SetListItemToSelected((uint)selectedItemIndex);
}
},
defaultValueCreator: (bindable) =>
/// </summary>
protected override void OnUpdate()
{
- float iconWidth = 0;
float buttonTextWidth = 0;
if (null != buttonText)
{
buttonText.Text = Style.Button.Text.Text.All;
- buttonText.PointSize = Style.Button.Text.PointSize?.All ?? 20;
+ buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? DefaultStyle.PointSizeNormal;
buttonTextWidth = buttonText.NaturalSize.Width;
}
- iconWidth = Style.Button.Icon.Size?.Width ?? 48;
- button.SizeWidth = iconWidth + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+ float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+ fitWidth += (button.IconPadding.Start + button.IconPadding.End);
+ button.Size.Width = Math.Max(button.Size.Width, fitWidth);
+ RelayoutRequest();
int numberOfItemsToAdd = adapter.GetItemCount();
}
}
// Set selection icon on View
- UpdateSelectedItem(selectedItemIndex);
+ if (selectedItemIndex > 0)
+ {
+ SetListItemToSelected((uint)selectedItemIndex, selectedItemView);
+ }
}
/// <summary>
tapGestureDetector = new TapGestureDetector();
}
View view = viewHolder.ItemView;
+ view.ApplyStyle(itemData.itemDataStyle);
view.TouchEvent += ListItemTouchEvent;
dropDownMenuFullList.Add(view);
}
}
}
- private void SetListItemToSelected(DropDownItemView targetItemView)
+ private void SetListItemToSelected(DropDownItemView view)
{
- // Set the DropDownItemView matching the targetItemView to selected.
- if (selectedItemView!=targetItemView)
+ if (dropDownMenuFullList == null || view == null || view == selectedItemView)
+ {
+ return;
+ }
+
+ uint newSelectedIndex = 0;
+ for (; newSelectedIndex < dropDownMenuFullList.ChildCount; newSelectedIndex++)
{
- if (selectedItemView!=null)
+ var itemView = dropDownMenuFullList.GetChildAt(newSelectedIndex) as DropDownItemView;
+ if (itemView == view)
{
- // clear selection status of currently selected item view
- selectedItemView.IsSelected = false;
+ SetListItemToSelected(newSelectedIndex, view);
+ return;
}
- // Set target item to selected
- targetItemView.IsSelected = true;
- selectedItemView = targetItemView;
}
}
+ private void SetListItemToSelected(uint index)
+ {
+ if (dropDownMenuFullList == null || index == selectedItemIndex)
+ {
+ return;
+ }
+
+ SetListItemToSelected(index, GetViewFromIndex(index) as DropDownItemView);
+ }
+
+ private void SetListItemToSelected(uint index, DropDownItemView view)
+ {
+ if (adapter == null)
+ {
+ return;
+ }
+
+ if (selectedItemView != null)
+ {
+ selectedItemView.IsSelected = false;
+ selectedItemView.ControlState = ControlStates.Normal;
+ adapter.GetData(selectedItemIndex).IsSelected = false;
+ }
+
+ if (view == null || index >= dropDownMenuFullList.ChildCount)
+ {
+ selectedItemIndex = -1;
+ selectedItemView = null;
+ return;
+ }
+
+ selectedItemIndex = (int)index;
+ selectedItemView = view;
+ selectedItemView.ControlState = ControlStates.Selected;
+ selectedItemView.IsSelected = true;
+ adapter.GetData(selectedItemIndex).IsSelected = true;
+ dropDownMenuFullList.Layout?.RequestLayout();
+ }
+
private bool ListItemTouchEvent(object sender, TouchEventArgs e)
{
PointStateType state = e.Touch.GetState(0);
switch (state)
{
case PointStateType.Down:
- if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ if (touchedView != null)
{
- touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
+ touchedView.ControlState = ControlStates.Pressed;
}
itemPressed = true; // if matched with a Up then a click event.
break;
case PointStateType.Motion:
- if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ if (touchedView != null)
{
- touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
+ touchedView.ControlState = ControlStates.Normal;
}
itemPressed = false;
break;
case PointStateType.Up:
- if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ if (touchedView != null)
{
- touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
-
if (itemPressed) // if Down was previously sent without motion (Scrolling) in-between then a clicked event occurred.
{
// List item clicked
return true;
}
- private void UpdateSelectedItem(int index)
- {
- if (null == adapter) return;
- if (null == dropDownMenuFullList) return;
- if (selectedItemIndex != -1)
- {
- DropDownDataItem data = adapter.GetData(selectedItemIndex);
- if(null != data)
- {
- data.IsSelected = false;
- }
- DropDownItemView listItemView = dropDownMenuFullList.GetChildAt((uint)selectedItemIndex) as DropDownItemView;
-
- SetListItemToSelected(listItemView);
- }
-
- if (index != -1)
- {
- DropDownDataItem data = adapter.GetData(index);
- if (null != data)
- {
- data.IsSelected = true;
- DropDownItemView listItemView = dropDownMenuFullList?.GetChildAt((uint)index) as DropDownItemView;
- if(listItemView)
- {
- SetListItemToSelected(listItemView);
- }
- }
- }
-
- selectedItemIndex = index;
- dropDownMenuFullList?.Layout?.RequestLayout();
- }
-
private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
{
button.Hide();
//[EditorBrowsable(EditorBrowsableState.Never)]
public class DropDownDataItem
{
- private DropDownItemStyle itemDataStyle = new DropDownItemStyle();
+ internal DropDownItemStyle itemDataStyle = new DropDownItemStyle();
/// <summary>
/// Creates a new instance of a DropDownItemData.
[EditorBrowsable(EditorBrowsableState.Never)]
public DropDownDataItem()
{
+ itemDataStyle = (DropDownItemStyle)StyleManager.Instance.GetComponentStyle(this.GetType());
Initialize();
}
private TextLabel titleText;
private ButtonGroup btGroup = null;
private Window window = null;
+ private Layer container = new Layer();
static Popup() { }
/// <summary>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Post(Window win)
+ public virtual void Post(Window targetWindow)
{
- if (null == win) return;
- window = win;
- window.Add(this);
+ if (targetWindow == null)
+ {
+ return;
+ }
+
+ window = targetWindow;
+ window.AddLayer(container);
+ container.RaiseToTop();
+ }
+
+ /// <summary>
+ /// Dismiss the dialog
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void Dismiss()
+ {
+ if (window == null)
+ {
+ return;
+ }
+
+ window.RemoveLayer(container);
+ window = null;
}
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
private void Initialize()
{
+ container.Add(this);
LeaveRequired = true;
PropertyChanged += PopupAttributesPropertyChanged;
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- protected ProgressStatusType state = ProgressStatusType.Indeterminate;
+ protected ProgressStatusType state = ProgressStatusType.Determinate;
private const float round = 0.5f;
private ImageView trackImage = null;
public enum ProgressStatusType
{
/// <summary>
- /// Show TrackImage
+ /// Show BufferImage
/// </summary>
/// <since_tizen> 6 </since_tizen>
Buffering,
/// <summary>
- /// Show ProgressImage
+ /// Show ProgressImage and BufferImage
/// </summary>
/// <since_tizen> 6 </since_tizen>
Determinate,
/// <summary>
- /// Show LoadingImage
+ /// Show TrackImage
/// </summary>
/// <since_tizen> 6 </since_tizen>
Indeterminate
}
else if (state == ProgressStatusType.Determinate)
{
- bufferImage.Hide();
+ bufferImage.Show();
progressImage.Show();
UpdateValue();
}
private IndicatorType indicatorType = IndicatorType.None;
private const float round = 0.5f;
// the minimum value
- private float? minValue = null;
+ private float minValue = 0;
// the maximum value
- private float? maxValue = null;
+ private float maxValue = 100;
// the current value
- private float? curValue = null;
+ private float curValue = 0;
// the size of the low indicator
private Size lowIndicatorSize = null;
// the size of the high indicator
{
get
{
- return minValue ?? 0;
+ return minValue;
}
set
{
{
get
{
- return maxValue ?? 100;
+ return maxValue;
}
set
{
{
get
{
- return curValue ?? 0;
+ return curValue;
}
set
{
if (null != slidingFinishedHandler)
{
SlidingFinishedArgs args = new SlidingFinishedArgs();
- args.CurrentValue = curValue.Value;
+ args.CurrentValue = curValue;
slidingFinishedHandler(this, args);
}
private void UpdateValue()
{
- if (slidedTrackImage == null || curValue == null || minValue == null || maxValue == null)
+ if (slidedTrackImage == null)
{
return;
}
if (valueChangedHandler != null)
{
ValueChangedArgs args = new ValueChangedArgs();
- args.CurrentValue = curValue.Value;
+ args.CurrentValue = curValue;
valueChangedHandler(this, args);
}
}
if (null != slidingFinishedHandler)
{
SlidingFinishedArgs args = new SlidingFinishedArgs();
- args.CurrentValue = curValue.Value;
+ args.CurrentValue = curValue;
slidingFinishedHandler(this, args);
}
}
if (null != valueChangedHandler)
{
ValueChangedArgs args = new ValueChangedArgs();
- args.CurrentValue = curValue.Value;
+ args.CurrentValue = curValue;
valueChangedHandler(this, args);
}
}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default DropDown style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultDropDownStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default DropDown style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ DropDownStyle style = new DropDownStyle
+ {
+ Position = new Position(50, 50),
+ // WidthResizePolicy = ResizePolicyType.FitToChildren,
+ // HeightResizePolicy = ResizePolicyType.FitToChildren,
+ // HeaderText = new TextLabelStyle
+ // {
+ // Text = new Selector<string> { All = "TitleArea" },
+ // PointSize = new Selector<float?> { All = 28 },
+ // TextColor = new Selector<Color> { All = new Color(0, 0, 0, 1) },
+ // FontFamily = "SamsungOneUI 500C",
+ // },
+ // BackgroundColor = new Selector<Color> { All = new Color(1, 1, 1, 1) },
+
+ Button = new ButtonStyle
+ {
+ ParentOrigin = ParentOrigin.TopLeft,
+ PivotPoint = PivotPoint.TopLeft,
+ BackgroundImage = new Selector<string>
+ {
+ Normal = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
+ Pressed = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png")
+ },
+ BackgroundImageBorder = (Rectangle)6,
+ Text = new TextLabelStyle
+ {
+ Text = "Select an item",
+ PointSize = DefaultStyle.PointSizeNormal,
+ TextColor = Color.Black,
+ },
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(28, 28),
+ ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_button_icon.png"),
+ },
+ IconRelativeOrientation = Button.IconOrientation.Right,
+ IconPadding = 6,
+ },
+ ListBackgroundImage = new ImageViewStyle
+ {
+ ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_list_bg.png"),
+ Border = (Rectangle)6,
+ Size = new Size(280, 360),
+ },
+ SpaceBetweenButtonTextAndIcon = 10,
+ ListPadding = 5,
+ };
+ return style;
+ }
+ }
+
+ /// <summary>
+ /// The default DropDownItem style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultDropDownItemStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default DropDownItem style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ DropDownItemStyle style = new DropDownItemStyle
+ {
+ Size = new Size(360, 50),
+ BackgroundColor = new Selector<Color>
+ {
+ Pressed = new Color(0.05f, 0.63f, 0.9f, 1),
+ Selected = new Color(0.8f, 0.8f, 0.8f, 1),
+ Normal = new Color(1, 1, 1, 1),
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = DefaultStyle.PointSizeNormal,
+ Position = new Position(28, 0),
+ Text = "List item",
+ },
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Popup style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultPopupStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Popup style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ PopupStyle style = new PopupStyle
+ {
+ Size = new Size(500, 280),
+ BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
+ ImageShadow = new ImageShadow
+ {
+ Url = DefaultStyle.GetResourcePath("nui_component_default_popup_shadow.png"),
+ Border = new Rectangle(24, 24, 24, 24),
+ Offset = new Vector2(-24, -24),
+ Extents = new Vector2(48, 48),
+ },
+ Title = new TextLabelStyle
+ {
+ PointSize = 16,
+ TextColor = Color.Black,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Bottom,
+ Padding = 20,
+ Text = "Title",
+ },
+ Buttons = new ButtonStyle
+ {
+ Size = new Size(0, 80),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(1, 1, 1, 1),
+ Pressed = new Color(1, 1, 1, 0.5f),
+ },
+ Overlay = new ImageViewStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
+ Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Color(0.05f, 0.63f, 0.9f, 1)
+ },
+ },
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Progress style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultProgressStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Progress style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ ProgressStyle style = new ProgressStyle
+ {
+ Size = new Size(200, 5),
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0, 0, 0, 0.1f),
+ },
+ Buffer = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f)
+ },
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1)
+ },
+
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Slider style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultSliderStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Slider style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ SliderStyle style = new SliderStyle
+ {
+ Size = new Size(200, 50),
+ TrackThickness = 5,
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0, 0, 0, 0.1f),
+ },
+
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
+ },
+
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(50, 50),
+ ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_n.png"),
+ BackgroundImage = new Selector<string>
+ {
+ Normal = "",
+ Pressed = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_bg_p.png"),
+ }
+ },
+
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Toast style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultToastStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Toast style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ ToastStyle style = new ToastStyle
+ {
+ WidthResizePolicy = ResizePolicyType.FitToChildren,
+ HeightResizePolicy = ResizePolicyType.FitToChildren,
+ BackgroundColor = new Color(0, 0, 0, 0.8f),
+ Text = new TextLabelStyle()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = Color.White,
+ Padding = new Extents(12, 12, 8, 8),
+ }
+ };
+ return style;
+ }
+ }
+}
PositionUsesPivotPoint = true,
ParentOrigin = Tizen.NUI.ParentOrigin.Center,
PivotPoint = Tizen.NUI.PivotPoint.Center,
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.UseNaturalSize,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
TextColor = Color.White
throw new ArgumentException("The argument targetTheme must be specified");
}
+ if (defaultThemeName.Equals(targetTheme))
+ {
+ // Ensure default component styles have loaded before override custom default style
+ LoadDefaultComponentStyle();
+ }
+
if (!componentStyleByTheme.ContainsKey(targetTheme))
{
componentStyleByTheme.Add(targetTheme, new Dictionary<Type, StyleBase>());
currentTheme = defaultThemeName;
}
- if (defaultThemeName.Equals(currentTheme) && !componentStyleByTheme.ContainsKey(defaultThemeName))
+ if (defaultThemeName.Equals(currentTheme))
{
LoadDefaultComponentStyle();
}
private void LoadDefaultComponentStyle()
{
+ if (componentStyleByTheme.ContainsKey(defaultThemeName))
+ {
+ return;
+ }
+
componentStyleByTheme.Add(defaultThemeName, new Dictionary<Type, StyleBase>());
var defaultComponentsStyle = componentStyleByTheme[defaultThemeName];
- defaultComponentsStyle.Add(typeof(Button), new DefaultButtonStyle());
- defaultComponentsStyle.Add(typeof(CheckBox), new DefaultCheckBoxStyle());
- defaultComponentsStyle.Add(typeof(RadioButton), new DefaultRadioButtonStyle());
- defaultComponentsStyle.Add(typeof(Switch), new DefaultSwitchStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Button), new DefaultButtonStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.CheckBox), new DefaultCheckBoxStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.RadioButton), new DefaultRadioButtonStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Switch), new DefaultSwitchStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Progress), new DefaultProgressStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Slider), new DefaultSliderStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Toast), new DefaultToastStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Popup), new DefaultPopupStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown), new DefaultDropDownStyle());
+ defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown.DropDownDataItem), new DefaultDropDownItemStyle());
}
}
}
if (Rectangle.IsNullOrZero(view.backgroundImageBorder))
{
- Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, new PropertyValue(url));
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.BACKGROUND, string.IsNullOrEmpty(url) ? new PropertyValue() : new PropertyValue(url));
}
else
{
}
/// <summary>
+ /// The type cast operator, ushort to Extents.
+ /// </summary>
+ /// <param name="value">A value of ushort type.</param>
+ /// <returns>return a Extents instance</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static implicit operator Extents(ushort value)
+ {
+ return new Extents(value, value, value, value);
+ }
+
+ /// <summary>
/// Constructor.
/// <param name="start">Start extent.</param>
/// <param name="end">End extent.</param>
{
}
+ /// <summary>
+ /// The type cast operator, int to Rectangle.
+ /// </summary>
+ /// <param name="value">A value of int type.</param>
+ /// <returns>return a Extents instance</returns>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static implicit operator Rectangle(int value)
+ {
+ return new Rectangle(value, value, value, value);
+ }
+
internal delegate void RectangleChangedCallback(int x, int y, int width, int height);
private RectangleChangedCallback callback = null;