--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Base attributes.
+ /// </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 abstract class Attributes
+ {
+ /// <summary>
+ /// Clone the Attributes, each derived class need to override this method.
+ /// </summary>
+ /// <returns> Return the attributes clone.</returns>
+ /// 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 abstract Attributes Clone();
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// ButtonAttributes is a class which saves Button's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ButtonAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a ButtonAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ButtonAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a ButtonAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create ButtonAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ButtonAttributes(ButtonAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+
+ IsSelectable = attributes.IsSelectable;
+ IconRelativeOrientation = attributes.IconRelativeOrientation;
+
+ if (attributes.ShadowImageAttributes != null)
+ {
+ ShadowImageAttributes = attributes.ShadowImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.BackgroundImageAttributes != null)
+ {
+ BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.OverlayImageAttributes != null)
+ {
+ OverlayImageAttributes = attributes.OverlayImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.TextAttributes != null)
+ {
+ TextAttributes = attributes.TextAttributes.Clone() as TextAttributes;
+ }
+
+ if (attributes.IconAttributes != null)
+ {
+ IconAttributes = attributes.IconAttributes.Clone() as ImageAttributes;
+ }
+ }
+ /// <summary>
+ /// Shadow image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ShadowImageAttributes
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Background image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Overlay image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes OverlayImageAttributes
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Text's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes TextAttributes
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Icon's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes IconAttributes
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Flag to decide button can be selected or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool? IsSelectable
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Icon relative orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Button.IconOrientation? IconRelativeOrientation
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new ButtonAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// DropDownAttributes is a class which saves DropDown's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class DropDownAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a DropDownAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownAttributes() : base()
+ {
+ SpaceBetweenButtonTextAndIcon = 0;
+ Space = new Vector4(0, 0, 0, 0);
+ ListRelativeOrientation = DropDown.ListOrientation.Left;
+ ListMargin = new Vector4(0, 0, 0, 0);
+ FocusedItemIndex = 0;
+ }
+ /// <summary>
+ /// Creates a new instance of a DropDownAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create DropDownAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownAttributes(DropDownAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+
+ if (attributes.ButtonAttributes != null)
+ {
+ ButtonAttributes = attributes.ButtonAttributes.Clone() as ButtonAttributes;
+ }
+
+ if (attributes.HeaderTextAttributes != null)
+ {
+ HeaderTextAttributes = attributes.HeaderTextAttributes.Clone() as TextAttributes;
+ }
+
+ if (attributes.ListBackgroundImageAttributes != null)
+ {
+ ListBackgroundImageAttributes = attributes.ListBackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.Space != null)
+ {
+ Space = new Vector4(attributes.Space.X, attributes.Space.Y, attributes.Space.Z, attributes.Space.W);
+ }
+
+ if (attributes.ListMargin != null)
+ {
+ ListMargin = new Vector4(attributes.ListMargin.X, attributes.ListMargin.Y, attributes.ListMargin.Z, attributes.ListMargin.W);
+ }
+
+ if (attributes.ListSize2D != null)
+ {
+ ListSize2D = new Size2D(attributes.ListSize2D.Width, attributes.ListSize2D.Height);
+ }
+
+ if (attributes.ListPadding != null)
+ {
+ ListPadding = attributes.ListPadding;
+ }
+
+ SpaceBetweenButtonTextAndIcon = attributes.SpaceBetweenButtonTextAndIcon;
+ ListRelativeOrientation = attributes.ListRelativeOrientation;
+ FocusedItemIndex = attributes.FocusedItemIndex;
+ }
+
+ /// <summary>
+ /// DropDown button's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ButtonAttributes ButtonAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Header text's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes HeaderTextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Space between button text and button icon.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SpaceBetweenButtonTextAndIcon
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// List background image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ListBackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Space in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector4 Space
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// List relative orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDown.ListOrientation ListRelativeOrientation
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// List margin.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector4 ListMargin
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Focused item index.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FocusedItemIndex
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// List size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D ListSize2D
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// List padding.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Extents ListPadding
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new DropDownAttributes(this);
+ }
+ }
+
+ /// <summary>
+ /// DropDownItemAttributes is a class which saves DropDownItem's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class DropDownItemAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a DropDownItemAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a DropDownItemAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create DropDownItemAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemAttributes(DropDownItemAttributes attributes) : base(attributes)
+ {
+ if (attributes.TextAttributes != null)
+ {
+ TextAttributes = attributes.TextAttributes.Clone() as TextAttributes;
+ }
+
+ if (attributes.IconAttributes != null)
+ {
+ IconAttributes = attributes.IconAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.CheckImageAttributes != null)
+ {
+ CheckImageAttributes = attributes.CheckImageAttributes.Clone() as ImageAttributes;
+ }
+
+ CheckImageRightSpace = attributes.CheckImageRightSpace;
+ IsSelected = attributes.IsSelected;
+ }
+
+ /// <summary>
+ /// Text's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes TextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Icon's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes IconAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Check image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes CheckImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Right space from check image.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImageRightSpace
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Flag to decide item is selected or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelected
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new DropDownItemAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The image view attributes class.
+ /// </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 class ImageAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Construct ImageAttributes.
+ /// </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 ImageAttributes() : base() { }
+ /// <summary>
+ /// Construct with specified attribute.
+ /// </summary>
+ /// <param name="attributes">The specified ImageAttributes.</param>
+ /// 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 ImageAttributes(ImageAttributes attributes) : base(attributes)
+ {
+ if (attributes == null)
+ {
+ return;
+ }
+
+ if (attributes.ResourceUrl != null)
+ {
+ ResourceUrl = attributes.ResourceUrl.Clone() as StringSelector;
+ }
+
+ if (attributes.Border != null)
+ {
+ Border = attributes.Border.Clone() as RectangleSelector;
+ }
+ }
+ /// <summary>
+ /// Image URL.
+ /// </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 StringSelector ResourceUrl
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Image border.
+ /// </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 RectangleSelector Border
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <returns> Return the attributes clone.</returns>
+ /// 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 override Attributes Clone()
+ {
+ return new ImageAttributes(this);
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// InputFieldAttributes is a class which saves InputField's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class InputFieldAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a InputFieldAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InputFieldAttributes() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of a InputFieldAttributes with attributes.
+ /// </summary>
+ /// <param name="attrs">Create InputFieldAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InputFieldAttributes(InputFieldAttributes attrs) : base(attrs)
+ {
+ if (null == attrs)
+ {
+ return;
+ }
+ if (null != attrs.BackgroundImageAttributes)
+ {
+ BackgroundImageAttributes = attrs.BackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+ if (null != attrs.InputBoxAttributes)
+ {
+ InputBoxAttributes = attrs.InputBoxAttributes.Clone() as TextFieldAttributes;
+ }
+ if (null != attrs.Space)
+ {
+ Space = attrs.Space;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets background image attributes of input field.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets input box attributes of input field.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextFieldAttributes InputBoxAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets space.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int? Space
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new InputFieldAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// LoadingAttributes is a class which saves Loading's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class LoadingAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a LoadingAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 LoadingAttributes() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of a LoadingAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create LoadingAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 LoadingAttributes(LoadingAttributes attributes) : base(attributes)
+ {
+ if(null == attributes)
+ {
+ return;
+ }
+
+ if (null != attributes.FPS)
+ {
+ FPS = attributes.FPS.Clone() as IntSelector;
+ }
+ if (null != attributes.LoadingSize)
+ {
+ LoadingSize = attributes.LoadingSize;
+ }
+ if (null != attributes.ImageArray)
+ {
+ ImageArray = attributes.ImageArray;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets loading image resource array.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string[] ImageArray
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets loading image size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D LoadingSize
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets loading frame per second.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 IntSelector FPS
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new LoadingAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// PaginationAttributes used to config the pagination represent.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class PaginationAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a PaginationAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 PaginationAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a PaginationAttributes using attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 PaginationAttributes(PaginationAttributes attributes) : base(attributes)
+ {
+ if (attributes == null)
+ {
+ return;
+ }
+
+ if (attributes.IndicatorSize != null)
+ {
+ IndicatorSize = new Size2D(attributes.IndicatorSize.Width, attributes.IndicatorSize.Height);
+ }
+ if (attributes.IndicatorBackgroundURL != null)
+ {
+ IndicatorBackgroundURL = attributes.IndicatorBackgroundURL.Clone() as string;
+ }
+ if (attributes.IndicatorSelectURL != null)
+ {
+ IndicatorSelectURL = attributes.IndicatorSelectURL.Clone() as string;
+ }
+ IndicatorSpacing = attributes.IndicatorSpacing;
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D IndicatorSize
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the background resource of indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IndicatorBackgroundURL
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the resource of the select indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IndicatorSelectURL
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the space of the indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IndicatorSpacing
+ {
+ get;
+ set;
+ }
+
+
+ /// <summary>
+ /// Retrieves a copy of PaginationAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new PaginationAttributes(this);
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// PopupAttributes is a class which saves Popup's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class PopupAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a PopupAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 PopupAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a PopupAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create PopupAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 PopupAttributes(PopupAttributes attributes) : base(attributes)
+ {
+ if (attributes.ShadowImageAttributes != null)
+ {
+ ShadowImageAttributes = attributes.ShadowImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.BackgroundImageAttributes != null)
+ {
+ BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.TitleTextAttributes != null)
+ {
+ TitleTextAttributes = attributes.TitleTextAttributes.Clone() as TextAttributes;
+ }
+
+ if (attributes.ButtonAttributes != null)
+ {
+ ButtonAttributes = attributes.ButtonAttributes.Clone() as ButtonAttributes;
+ }
+
+ ShadowOffset = new Vector4(attributes.ShadowOffset.W, attributes.ShadowOffset.X, attributes.ShadowOffset.Y, attributes.ShadowOffset.Z);
+ }
+
+ /// <summary>
+ /// Shadow image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ShadowImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Background image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Title Text's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes TitleTextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Shadow offset.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector4 ShadowOffset
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Popup button's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ButtonAttributes ButtonAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new PopupAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// ProgressAttributes is a class which saves Progress's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ProgressAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a ProgressAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ProgressAttributes() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of a ProgressAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create ProgressAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ProgressAttributes(ProgressAttributes attributes) : base(attributes)
+ {
+ if (null == attributes)
+ {
+ return;
+ }
+
+ if (null != attributes.TrackImageAttributes)
+ {
+ TrackImageAttributes = attributes.TrackImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (null != attributes.ProgressImageAttributes)
+ {
+ ProgressImageAttributes = attributes.ProgressImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (null != attributes.BufferImageAttributes)
+ {
+ BufferImageAttributes = attributes.BufferImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (null != attributes.LoadingImageAttributes)
+ {
+ LoadingImageAttributes = attributes.LoadingImageAttributes.Clone() as ImageAttributes;
+ }
+ }
+
+ /// <summary>
+ /// Get or set Track Image Attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes TrackImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set Progress Image Attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ProgressImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set Buffer Image Attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BufferImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set LoadingImageAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes LoadingImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new ProgressAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// ScrollBarAttributes is a class which saves Scrollbar's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ScrollBarAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a ScrollBarAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBarAttributes() : base()
+ {
+ Direction = ScrollBar.DirectionType.Horizontal;
+ }
+
+ /// <summary>
+ /// Creates a new instance of a ScrollBarAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create ScrollBarAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBarAttributes(ScrollBarAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+
+ if (attributes.TrackImageAttributes != null)
+ {
+ TrackImageAttributes = attributes.TrackImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.ThumbImageAttributes != null)
+ {
+ ThumbImageAttributes = attributes.ThumbImageAttributes.Clone() as ImageAttributes;
+ }
+
+ Direction = attributes.Direction;
+ Duration = attributes.Duration;
+ }
+
+ /// <summary>
+ /// Get or set track image attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes TrackImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set thumb image attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ThumbImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set direction type
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBar.DirectionType? Direction
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set duration
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint Duration
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new ScrollBarAttributes(this);
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// SelectButtonAttributes is a class which saves SelectButton's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SelectButtonAttributes : ButtonAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a SelectButtonAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectButtonAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a SelectButtonAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create SelectButtonAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectButtonAttributes(SelectButtonAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+ if (attributes.CheckImageAttributes != null)
+ {
+ CheckImageAttributes = attributes.CheckImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.CheckBackgroundImageAttributes != null)
+ {
+ CheckBackgroundImageAttributes = attributes.CheckBackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.CheckShadowImageAttributes != null)
+ {
+ CheckShadowImageAttributes = attributes.CheckShadowImageAttributes.Clone() as ImageAttributes;
+ }
+ }
+
+ /// <summary>
+ /// Check image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes CheckImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Background image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes CheckBackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Shadow image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes CheckShadowImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new SelectButtonAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// SliderAttributes is a class which saves Slider's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SliderAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a SliderAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SliderAttributes() : base()
+ {
+ IndicatorType = Slider.IndicatorType.None;
+ }
+
+ /// <summary>
+ /// Creates a new instance of a SliderAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create SliderAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SliderAttributes(SliderAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+ if (attributes.BackgroundTrackAttributes != null)
+ {
+ BackgroundTrackAttributes = attributes.BackgroundTrackAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.SlidedTrackAttributes != null)
+ {
+ SlidedTrackAttributes = attributes.SlidedTrackAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.ThumbBackgroundAttributes != null)
+ {
+ ThumbBackgroundAttributes = attributes.ThumbBackgroundAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.ThumbAttributes != null)
+ {
+ ThumbAttributes = attributes.ThumbAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.LowIndicatorImageAttributes != null)
+ {
+ LowIndicatorImageAttributes = attributes.LowIndicatorImageAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.HighIndicatorImageAttributes != null)
+ {
+ HighIndicatorImageAttributes = attributes.HighIndicatorImageAttributes.Clone() as ImageAttributes;
+ }
+ if (attributes.LowIndicatorTextAttributes != null)
+ {
+ LowIndicatorTextAttributes = attributes.LowIndicatorTextAttributes.Clone() as TextAttributes;
+ }
+ if (attributes.HighIndicatorTextAttributes != null)
+ {
+ HighIndicatorTextAttributes = attributes.HighIndicatorTextAttributes.Clone() as TextAttributes;
+ }
+ if (attributes.TrackThickness != null)
+ {
+ TrackThickness = attributes.TrackThickness;
+ }
+ if (attributes.SpaceBetweenTrackAndIndicator != null)
+ {
+ SpaceBetweenTrackAndIndicator = attributes.SpaceBetweenTrackAndIndicator;
+ }
+ IndicatorType = attributes.IndicatorType;
+ }
+
+ /// <summary>
+ /// Get or set background track attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BackgroundTrackAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set slided track attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes SlidedTrackAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set thumb attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ThumbAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set thumb background attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes ThumbBackgroundAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set low indicator image attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes LowIndicatorImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set high indicator image attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes HighIndicatorImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or low indicator text attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes LowIndicatorTextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set high indicator text attributes
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes HighIndicatorTextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set track thickness
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint? TrackThickness
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set space between track and indicator
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint? SpaceBetweenTrackAndIndicator
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set Indicator type
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Slider.IndicatorType IndicatorType
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new SliderAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// SwitchAttributes is a class which saves Switch's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SwitchAttributes : ButtonAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a SwitchAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SwitchAttributes() : base() { }
+ /// <summary>
+ /// Creates a new instance of a SwitchAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create SwitchAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SwitchAttributes(SwitchAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+ if (attributes.SwitchHandlerImageAttributes != null)
+ {
+ SwitchHandlerImageAttributes = attributes.SwitchHandlerImageAttributes.Clone() as ImageAttributes;
+ }
+
+ if (attributes.SwitchBackgroundImageAttributes != null)
+ {
+ SwitchBackgroundImageAttributes = attributes.SwitchBackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+ }
+
+ /// <summary>
+ /// Handler image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes SwitchHandlerImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Background image's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes SwitchBackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new SwitchAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// TabAttributes is a class which saves Tab's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class TabAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a TabAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TabAttributes() : base()
+ {
+ Space = new Vector4(0, 0, 0, 0);
+ IsNatureTextWidth = false;
+ ItemGap = 0;
+ }
+
+ /// <summary>
+ /// Creates a new instance of a TabAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create TabAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TabAttributes(TabAttributes attributes) : base(attributes)
+ {
+ if (null == attributes)
+ {
+ return;
+ }
+
+ if (attributes.UnderLineAttributes != null)
+ {
+ UnderLineAttributes = attributes.UnderLineAttributes.Clone() as ViewAttributes;
+ }
+
+ if (attributes.TextAttributes != null)
+ {
+ TextAttributes = attributes.TextAttributes.Clone() as TextAttributes;
+ }
+
+ if (attributes.Space != null)
+ {
+ Space = new Vector4(attributes.Space.X, attributes.Space.Y, attributes.Space.Z, attributes.Space.W);
+ }
+ else
+ {
+ Space = new Vector4(0, 0, 0, 0);
+ }
+ ItemGap = attributes.ItemGap;
+ IsNatureTextWidth = attributes.IsNatureTextWidth;
+ }
+
+ /// <summary>
+ /// UnderLine's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewAttributes UnderLineAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Text's attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes TextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Flag to decide if item is fill with item text's natural width.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsNatureTextWidth
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gap between items.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ItemGap
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Space in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector4 Space
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new TabAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The Text Attributes class.
+ /// </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 class TextAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Construct TextAttributes.
+ /// </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 TextAttributes() : base() { }
+ /// <summary>
+ /// Construct with specified attribute.
+ /// </summary>
+ /// <param name="attributes">The specified TextAttributes.</param>
+ /// 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 TextAttributes(TextAttributes attributes) : base(attributes)
+ {
+ if(attributes == null)
+ {
+ return;
+ }
+ if (attributes.Text != null)
+ {
+ Text = attributes.Text.Clone() as StringSelector;
+ }
+
+ if (attributes.TranslatableText != null)
+ {
+ TranslatableText = attributes.TranslatableText.Clone() as StringSelector;
+ }
+
+ if (attributes.MultiLine != null)
+ {
+ MultiLine = attributes.MultiLine;
+ }
+
+ if (attributes.HorizontalAlignment != null)
+ {
+ HorizontalAlignment = attributes.HorizontalAlignment;
+ }
+
+ if (attributes.VerticalAlignment != null)
+ {
+ VerticalAlignment = attributes.VerticalAlignment;
+ }
+
+ if (attributes.EnableMarkup != null)
+ {
+ EnableMarkup = attributes.EnableMarkup;
+ }
+
+ if (attributes.EnableAutoScroll != null)
+ {
+ EnableAutoScroll = attributes.EnableAutoScroll;
+ }
+
+ if (attributes.AutoScrollSpeed != null)
+ {
+ AutoScrollSpeed = attributes.AutoScrollSpeed;
+ }
+
+ if (attributes.AutoScrollLoopCount != null)
+ {
+ AutoScrollLoopCount = attributes.AutoScrollLoopCount;
+ }
+
+ if (attributes.AutoScrollGap != null)
+ {
+ AutoScrollGap = attributes.AutoScrollGap;
+ }
+
+ if (attributes.AutoScrollLoopDelay != null)
+ {
+ AutoScrollLoopDelay = attributes.AutoScrollLoopDelay;
+ }
+
+ if (attributes.AutoScrollStopMode != null)
+ {
+ AutoScrollStopMode = attributes.AutoScrollStopMode;
+ }
+
+ if (attributes.LineSpacing != null)
+ {
+ LineSpacing = attributes.LineSpacing;
+ }
+
+ if (attributes.TextColor != null)
+ {
+ TextColor = attributes.TextColor.Clone() as ColorSelector;
+ }
+
+ if (attributes.FontFamily != null)
+ {
+ FontFamily = attributes.FontFamily;
+ }
+
+ if (attributes.PointSize != null)
+ {
+ PointSize = attributes.PointSize.Clone() as FloatSelector;
+ }
+
+ if (attributes.ShadowOffset != null)
+ {
+ ShadowOffset = attributes.ShadowOffset.Clone() as Vector2Selector;
+ }
+
+ if (attributes.ShadowColor != null)
+ {
+ ShadowColor = attributes.ShadowColor.Clone() as ColorSelector;
+ }
+
+ if (attributes.OutstrokeColor != null)
+ {
+ OutstrokeColor = attributes.OutstrokeColor.Clone() as ColorSelector;
+ }
+ if (attributes.OutstrokeThickness != null)
+ {
+ OutstrokeThickness = attributes.OutstrokeThickness.Clone() as IntSelector;
+ }
+ }
+ /// <summary>
+ /// TextLabel Text
+ /// </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 StringSelector Text
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// The TranslatableText property
+ /// </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 StringSelector TranslatableText
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel MultiLine
+ /// </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 bool? MultiLine
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel HorizontalAlignment
+ /// </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 HorizontalAlignment? HorizontalAlignment
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel VerticalAlignment
+ /// </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 VerticalAlignment? VerticalAlignment
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel EnableMarkup
+ /// </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 bool? EnableMarkup
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel EnableAutoScroll
+ /// </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 bool? EnableAutoScroll
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel AutoScrollSpeed
+ /// </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 int? AutoScrollSpeed
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel AutoScrollLoopCount
+ /// </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 int? AutoScrollLoopCount
+{
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel AutoScrollGap
+ /// </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 float? AutoScrollGap
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel AutoScrollLoopDelay
+ /// </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 float? AutoScrollLoopDelay
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel AutoScrollStopMode
+ /// </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 AutoScrollStopMode? AutoScrollStopMode
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel LineSpacing
+ /// </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 float? LineSpacing
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel TextColor
+ /// </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 ColorSelector TextColor
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel FontFamily
+ /// </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 string FontFamily
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel PointSize
+ /// </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 FloatSelector PointSize
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel ShadowOffset
+ /// </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 Vector2Selector ShadowOffset
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel ShadowColor
+ /// </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 ColorSelector ShadowColor
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel OutstrokeColor
+ /// </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 ColorSelector OutstrokeColor
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// TextLabel OutstrokeThickness
+ /// </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 IntSelector OutstrokeThickness
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Attributes's clone function.
+ /// </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 override Attributes Clone()
+ {
+ return new TextAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// TextFieldAttributes is a class which saves TextField's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class TextFieldAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a TextField.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextFieldAttributes() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of a TextField with style.
+ /// </summary>
+ /// <param name="attributes">Create TextField by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextFieldAttributes(TextFieldAttributes attributes) : base(attributes)
+ {
+ if(null == attributes)
+ {
+ return;
+ }
+ if (null != attributes.Text)
+ {
+ Text = attributes.Text.Clone() as StringSelector;
+ }
+ if (null != attributes.PlaceholderText)
+ {
+ PlaceholderText = attributes.PlaceholderText.Clone() as StringSelector;
+ }
+ if (null != attributes.TranslatablePlaceholderText)
+ {
+ TranslatablePlaceholderText = attributes.TranslatablePlaceholderText.Clone() as StringSelector;
+ }
+ if (null != attributes.HorizontalAlignment)
+ {
+ HorizontalAlignment = attributes.HorizontalAlignment;
+ }
+ if (null != attributes.VerticalAlignment)
+ {
+ VerticalAlignment = attributes.VerticalAlignment;
+ }
+ if (null != attributes.EnableMarkup)
+ {
+ EnableMarkup = attributes.EnableMarkup;
+ }
+ if (null != attributes.TextColor)
+ {
+ TextColor = attributes.TextColor.Clone() as ColorSelector;
+ }
+ if (null != attributes.PlaceholderTextColor)
+ {
+ PlaceholderTextColor = attributes.PlaceholderTextColor.Clone() as ColorSelector;
+ }
+ if (null != attributes.PrimaryCursorColor)
+ {
+ PrimaryCursorColor = attributes.PrimaryCursorColor.Clone() as ColorSelector;
+ }
+ if (null != attributes.SecondaryCursorColor)
+ {
+ SecondaryCursorColor = attributes.SecondaryCursorColor.Clone() as ColorSelector;
+ }
+ if (null != attributes.FontFamily)
+ {
+ FontFamily = attributes.FontFamily;
+ }
+ if (null != attributes.PointSize)
+ {
+ PointSize = attributes.PointSize.Clone() as FloatSelector;
+ }
+ if (null != attributes.EnableCursorBlink)
+ {
+ EnableCursorBlink = attributes.EnableCursorBlink;
+ }
+ if (null != attributes.EnableSelection)
+ {
+ EnableSelection = attributes.EnableSelection;
+ }
+ if (null != attributes.CursorWidth)
+ {
+ CursorWidth = attributes.CursorWidth;
+ }
+ if (null != attributes.EnableEllipsis)
+ {
+ EnableEllipsis = attributes.EnableEllipsis;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector Text
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets place holder text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector PlaceholderText
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets translatable place holder text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector TranslatablePlaceholderText
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets horizontal alignment of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignment? HorizontalAlignment
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets vertical alignment of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 VerticalAlignment? VerticalAlignment
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets enable mark up.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool? EnableMarkup
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets text color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector TextColor
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets place holder text color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector PlaceholderTextColor
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets primary cursor color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector PrimaryCursorColor
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets secondary cursor color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector SecondaryCursorColor
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets font family of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets point size of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector PointSize
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets enable cursor blink.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool? EnableCursorBlink
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets enable selection.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool? EnableSelection
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets cursor width.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int? CursorWidth
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets if enable ellipsis.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool? EnableEllipsis
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new TextFieldAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// ToastAttributes is a class which saves Toast's ux data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ToastAttributes : ViewAttributes
+ {
+ /// <summary>
+ /// Creates a new instance of a ToastAttributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ToastAttributes() : base() { }
+
+ /// <summary>
+ /// Creates a new instance of a ToastAttributes with attributes.
+ /// </summary>
+ /// <param name="attributes">Create ToastAttributes by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ToastAttributes(ToastAttributes attributes) : base(attributes)
+ {
+ if(null == attributes)
+ {
+ return;
+ }
+ if(null != attributes.BackgroundImageAttributes)
+ {
+ BackgroundImageAttributes = attributes.BackgroundImageAttributes.Clone() as ImageAttributes;
+ }
+ if(null != attributes.TextAttributes)
+ {
+ TextAttributes = attributes.TextAttributes.Clone() as TextAttributes;
+ }
+ TextLineHeight = attributes.TextLineHeight;
+ TextLineSpace = attributes.TextLineSpace;
+ Duration = attributes.Duration;
+ }
+
+ /// <summary>
+ /// Gets or sets background image attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ImageAttributes BackgroundImageAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets text attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 TextAttributes TextAttributes
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets toast text line height.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint? TextLineHeight
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets toast text line space.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint? TextLineSpace
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets toast show duration time.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint? Duration
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Attributes's clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes Clone()
+ {
+ return new ToastAttributes(this);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The base class for Children attributes in Components.
+ /// </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 class ViewAttributes : Attributes
+ {
+ /// <summary>
+ /// Construct ViewAttributes.
+ /// </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 ViewAttributes() : base() { }
+ /// <summary>
+ /// Constructs a ViewAttributes that is a copy of attrs.
+ /// </summary>
+ /// <param name="attributes">Construct Attributes</param>
+ /// 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 ViewAttributes(ViewAttributes attributes)
+ {
+ if (attributes == null)
+ {
+ return;
+ }
+
+ if (attributes.Position2D != null)
+ {
+ Position2D = new Position2D(attributes.Position2D.X, attributes.Position2D.Y);
+ }
+
+ if (attributes.Size2D != null)
+ {
+ Size2D = new Size2D(attributes.Size2D.Width, attributes.Size2D.Height);
+ }
+
+ if (attributes.BackgroundColor != null)
+ {
+ BackgroundColor = attributes.BackgroundColor.Clone() as ColorSelector;
+ }
+
+ if (attributes.PositionUsesPivotPoint != null)
+ {
+ PositionUsesPivotPoint = attributes.PositionUsesPivotPoint;
+ }
+
+ if (attributes.ParentOrigin != null)
+ {
+ ParentOrigin = new Position(attributes.ParentOrigin.X, attributes.ParentOrigin.Y, attributes.ParentOrigin.Z);
+ }
+
+ if (attributes.PivotPoint != null)
+ {
+ PivotPoint = new Position(attributes.PivotPoint.X, attributes.PivotPoint.Y, attributes.PivotPoint.Z);
+ }
+
+ if (attributes.WidthResizePolicy != null)
+ {
+ WidthResizePolicy = attributes.WidthResizePolicy;
+ }
+
+ if (attributes.HeightResizePolicy != null)
+ {
+ HeightResizePolicy = attributes.HeightResizePolicy;
+ }
+
+ if (attributes.MinimumSize != null)
+ {
+ MinimumSize = new Size2D(attributes.MinimumSize.Width, attributes.MinimumSize.Height);
+ }
+
+ if (attributes.SizeModeFactor != null)
+ {
+ SizeModeFactor = new Vector3(attributes.SizeModeFactor.X, attributes.SizeModeFactor.Y, attributes.SizeModeFactor.Z);
+ }
+
+ if (attributes.Opacity != null)
+ {
+ Opacity = attributes.Opacity.Clone() as FloatSelector;
+ }
+
+ PaddingLeft = attributes.PaddingLeft;
+ PaddingRight = attributes.PaddingRight;
+ PaddingTop = attributes.PaddingTop;
+ PaddingBottom = attributes.PaddingBottom;
+ }
+ /// <summary>
+ /// View Position
+ /// </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 Position2D Position2D
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View Size
+ /// </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 Size2D Size2D
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View BackgroundColor
+ /// </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 ColorSelector BackgroundColor
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View PositionUsesPivotPoint
+ /// </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 bool? PositionUsesPivotPoint
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View ParentOrigin
+ /// </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 Position ParentOrigin
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View PivotPoint
+ /// </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 Position PivotPoint
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View WidthResizePolicy
+ /// </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 ResizePolicyType? WidthResizePolicy
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View HeightResizePolicy
+ /// </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 ResizePolicyType? HeightResizePolicy
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View MinimumSize
+ /// </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 Size2D MinimumSize
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View SizeModeFactor
+ /// </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 Vector3 SizeModeFactor
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View Opacity
+ /// </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 FloatSelector Opacity
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View left padding
+ /// </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 int PaddingLeft
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View right padding
+ /// </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 int PaddingRight
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View top padding
+ /// </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 int PaddingTop
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// View bottom padding
+ /// </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 int PaddingBottom
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Attributes's clone function.
+ /// </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 override Attributes Clone()
+ {
+ return new ViewAttributes(this);
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Button is one kind of common component, a button clearly describes what action will occur when the user selects it.
+ /// Button may contain text or an icon.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Button : Control
+ {
+ private ImageView backgroundImage;
+ private ImageView shadowImage;
+ private ImageView overlayImage;
+
+ private TextLabel buttonText;
+ private ImageView buttonIcon;
+
+ private ButtonAttributes buttonAttributes;
+ private EventHandler<StateChangeEventArgs> stateChangeHander;
+
+ private bool isSelected = false;
+ private bool isEnabled = true;
+ private bool isPressed = false;
+ /// <summary>
+ /// Creates a new instance of a Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Button() : base()
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Button with style.
+ /// </summary>
+ /// <param name="style">Create Button by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Button(string style) : base(style)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Button with attributes.
+ /// </summary>
+ /// <param name="attributes">Create Button by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Button(ButtonAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ClickEventArgs> ClickEvent;
+ /// <summary>
+ /// An event for the button state changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<StateChangeEventArgs> StateChangedEvent
+ {
+ add
+ {
+ stateChangeHander += value;
+ }
+ remove
+ {
+ stateChangeHander -= value;
+ }
+ }
+ /// <summary>
+ /// Icon orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum IconOrientation
+ {
+ /// <summary>
+ /// Top.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Top,
+ /// <summary>
+ /// Bottom.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Bottom,
+ /// <summary>
+ /// Left.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Left,
+ /// <summary>
+ /// Right.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Right,
+ }
+ /// <summary>
+ /// Flag to decide Button can be selected or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelectable
+ {
+ get
+ {
+ return buttonAttributes?.IsSelectable ?? false;
+ }
+ set
+ {
+ buttonAttributes.IsSelectable = value;
+ }
+ }
+ /// <summary>
+ /// Background image's resource url in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string BackgroundImageURL
+ {
+ get
+ {
+ return buttonAttributes?.BackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (buttonAttributes.BackgroundImageAttributes.ResourceUrl == null)
+ {
+ buttonAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ buttonAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Background image's border in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle BackgroundImageBorder
+ {
+ get
+ {
+ return buttonAttributes?.BackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (buttonAttributes.BackgroundImageAttributes.Border == null)
+ {
+ buttonAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ buttonAttributes.BackgroundImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Shadow image's resource url in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ShadowImageURL
+ {
+ get
+ {
+ return buttonAttributes?.ShadowImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ if (buttonAttributes.ShadowImageAttributes.ResourceUrl == null)
+ {
+ buttonAttributes.ShadowImageAttributes.ResourceUrl = new StringSelector();
+ }
+ buttonAttributes.ShadowImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Shadow image's border in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle ShadowImageBorder
+ {
+ get
+ {
+ return buttonAttributes?.ShadowImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ if (buttonAttributes.ShadowImageAttributes.Border == null)
+ {
+ buttonAttributes.ShadowImageAttributes.Border = new RectangleSelector();
+ }
+ buttonAttributes.ShadowImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Overlay image's resource url in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string OverlayImageURL
+ {
+ get
+ {
+ return buttonAttributes?.OverlayImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateOverlayAttributes();
+ if (buttonAttributes.OverlayImageAttributes.ResourceUrl == null)
+ {
+ buttonAttributes.OverlayImageAttributes.ResourceUrl = new StringSelector();
+ }
+ buttonAttributes.OverlayImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Overlay image's border in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle OverlayImageBorder
+ {
+ get
+ {
+ return buttonAttributes?.OverlayImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateOverlayAttributes();
+ if (buttonAttributes.OverlayImageAttributes.Border == null)
+ {
+ buttonAttributes.OverlayImageAttributes.Border = new RectangleSelector();
+ }
+ buttonAttributes.OverlayImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Text string in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Text
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.Text?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ if(buttonAttributes.TextAttributes.Text == null)
+ {
+ buttonAttributes.TextAttributes.Text = new StringSelector();
+ }
+ buttonAttributes.TextAttributes.Text.All = value;
+
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Translate text string in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string TranslatableText
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.TranslatableText?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ if (buttonAttributes.TextAttributes.TranslatableText == null)
+ {
+ buttonAttributes.TextAttributes.TranslatableText = new StringSelector();
+ }
+ buttonAttributes.TextAttributes.TranslatableText.All = value;
+
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Text point size in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float PointSize
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (buttonAttributes.TextAttributes.PointSize == null)
+ {
+ buttonAttributes.TextAttributes.PointSize = new FloatSelector();
+ }
+ buttonAttributes.TextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+ /// <summary>
+ /// Text font family in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+ /// <summary>
+ /// Text color in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TextColor
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (buttonAttributes.TextAttributes.TextColor == null)
+ {
+ buttonAttributes.TextAttributes.TextColor = new ColorSelector();
+ }
+ buttonAttributes.TextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+ /// <summary>
+ /// Text horizontal alignment in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignment TextAlignment
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.HorizontalAlignment = value;
+ RelayoutRequest();
+ }
+ }
+ /// <summary>
+ /// Icon image's resource url in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IconURL
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateIconAttributes();
+ if (buttonAttributes.IconAttributes.ResourceUrl == null)
+ {
+ buttonAttributes.IconAttributes.ResourceUrl = new StringSelector();
+ }
+ buttonAttributes.IconAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Text string selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector TextSelector
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.Text;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.Text = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Translateable text string selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector TranslatableTextSelector
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.TranslatableText;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.TranslatableText = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Text color selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector TextColorSelector
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.TextColor;
+ }
+ set
+ {
+ if(value != null)
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Text font size selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector PointSizeSelector
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PointSize;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.PointSize = value.Clone() as FloatSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Icon image's resource url selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector IconURLSelector
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateIconAttributes();
+ buttonAttributes.IconAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Background image's resource url selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector BackgroundImageURLSelector
+ {
+ get
+ {
+ return buttonAttributes?.BackgroundImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ buttonAttributes.BackgroundImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Background image's border selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RectangleSelector BackgroundImageBorderSelector
+ {
+ get
+ {
+ return buttonAttributes?.BackgroundImageAttributes?.Border;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ buttonAttributes.BackgroundImageAttributes.Border = value.Clone() as RectangleSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Shadow image's resource url selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector ShadowImageURLSelector
+ {
+ get
+ {
+ return buttonAttributes?.ShadowImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ buttonAttributes.ShadowImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Shadow image's border selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RectangleSelector ShadowImageBorderSelector
+ {
+ get
+ {
+ return buttonAttributes?.ShadowImageAttributes?.Border;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ buttonAttributes.ShadowImageAttributes.Border = value.Clone() as RectangleSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Overlay image's resource url selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector OverlayImageURLSelector
+ {
+ get
+ {
+ return buttonAttributes?.OverlayImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateOverlayAttributes();
+ buttonAttributes.OverlayImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Overlay image's border selector in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RectangleSelector OverlayImageBorderSelector
+ {
+ get
+ {
+ return buttonAttributes?.OverlayImageAttributes?.Border;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateOverlayAttributes();
+ buttonAttributes.OverlayImageAttributes.Border = value.Clone() as RectangleSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+ /// <summary>
+ /// Flag to decide selected state in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ set
+ {
+ isSelected = value;
+ UpdateState();
+ }
+ }
+ /// <summary>
+ /// Flag to decide enable or disable in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsEnabled
+ {
+ get
+ {
+ return isEnabled;
+ }
+ set
+ {
+ isEnabled = value;
+ UpdateState();
+ }
+ }
+
+ /// <summary>
+ /// Icon relative orientation in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 IconOrientation? IconRelativeOrientation
+ {
+ get
+ {
+ return buttonAttributes?.IconRelativeOrientation;
+ }
+ set
+ {
+ if(buttonAttributes != null && buttonAttributes.IconRelativeOrientation != value)
+ {
+ buttonAttributes.IconRelativeOrientation = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Icon left padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IconPaddingLeft
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.PaddingLeft ?? 0;
+ }
+ set
+ {
+ CreateIconAttributes();
+ buttonAttributes.IconAttributes.PaddingLeft = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Icon right padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IconPaddingRight
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.PaddingRight ?? 0;
+ }
+ set
+ {
+ CreateIconAttributes();
+ buttonAttributes.IconAttributes.PaddingRight = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Icon top padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IconPaddingTop
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.PaddingTop ?? 0;
+ }
+ set
+ {
+ CreateIconAttributes();
+ buttonAttributes.IconAttributes.PaddingTop = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Icon bottom padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IconPaddingBottom
+ {
+ get
+ {
+ return buttonAttributes?.IconAttributes?.PaddingBottom ?? 0;
+ }
+ set
+ {
+ CreateIconAttributes();
+ buttonAttributes.IconAttributes.PaddingBottom = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text left padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingLeft
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PaddingLeft ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.PaddingLeft = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text right padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingRight
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PaddingRight ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.PaddingRight = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text top padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingTop
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PaddingTop ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.PaddingTop = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text bottom padding in Button, work only when show icon and text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingBottom
+ {
+ get
+ {
+ return buttonAttributes?.TextAttributes?.PaddingBottom ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ buttonAttributes.TextAttributes.PaddingBottom = value;
+ RelayoutRequest();
+ }
+ }
+ /// <summary>
+ /// Dispose Button and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (buttonIcon != null)
+ {
+ buttonIcon.Relayout -= OnIconRelayout;
+ Utility.Dispose(buttonIcon);
+ }
+ if (buttonText != null)
+ {
+ Utility.Dispose(buttonText);
+ }
+ if (overlayImage != null)
+ {
+ Utility.Dispose(overlayImage);
+ }
+ if (backgroundImage != null)
+ {
+ Utility.Dispose(backgroundImage);
+ }
+ if (shadowImage != null)
+ {
+ Utility.Dispose(shadowImage);
+ }
+ }
+
+ base.Dispose(type);
+ }
+ /// <summary>
+ /// Called after a key event is received by the view that has had its focus set.
+ /// </summary>
+ /// <param name="key">The key event.</param>
+ /// <returns>True if the key event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnKey(Key key)
+ {
+ if (key.State == Key.StateType.Down)
+ {
+ if (key.KeyPressedName == "Return")
+ {
+ isPressed = true;
+ UpdateState();
+ if(isEnabled)
+ {
+ ClickEventArgs eventArgs = new ClickEventArgs();
+ OnClick(eventArgs);
+ }
+ }
+ }
+ else if (key.State == Key.StateType.Up)
+ {
+ if (key.KeyPressedName == "Return")
+ {
+ isPressed = false;
+ if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true)
+ {
+ isSelected = !isSelected;
+ }
+ UpdateState();
+ }
+ }
+ return base.OnKey(key);
+ }
+ /// <summary>
+ /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusGained()
+ {
+ base.OnFocusGained();
+ UpdateState();
+ }
+ /// <summary>
+ /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusLost()
+ {
+ base.OnFocusLost();
+ UpdateState();
+ }
+ /// <summary>
+ /// Tap gesture event callback.
+ /// </summary>
+ /// <param name="source">Source which recieved touch event.</param>
+ /// <param name="e">Tap gesture event argument.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
+ {
+ if (isEnabled)
+ {
+ ClickEventArgs eventArgs = new ClickEventArgs();
+ OnClick(eventArgs);
+ base.OnTapGestureDetected(source, e);
+ }
+ }
+
+ /// <summary>
+ /// Called after a touch event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="touch">The touch event.</param>
+ /// <returns>True if the event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnTouch(Touch touch)
+ {
+ PointStateType state = touch.GetState(0);
+
+ switch(state)
+ {
+ case PointStateType.Down:
+ isPressed = true;
+ UpdateState();
+ return true;
+ case PointStateType.Interrupted:
+ isPressed = false;
+ UpdateState();
+ return true;
+ case PointStateType.Up:
+ isPressed = false;
+ if (buttonAttributes.IsSelectable != null && buttonAttributes.IsSelectable == true)
+ {
+ isSelected = !isSelected;
+ }
+ UpdateState();
+ return true;
+ default:
+ break;
+ }
+ return base.OnTouch(touch);
+ }
+ /// <summary>
+ /// Get Button attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new ButtonAttributes();
+ }
+ /// <summary>
+ /// Update Button by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (buttonAttributes.ShadowImageAttributes != null)
+ {
+ if(shadowImage == null)
+ {
+ shadowImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ this.Add(shadowImage);
+ }
+ ApplyAttributes(shadowImage, buttonAttributes.ShadowImageAttributes);
+ }
+
+ if (buttonAttributes.BackgroundImageAttributes != null)
+ {
+ if(backgroundImage == null)
+ {
+ backgroundImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ this.Add(backgroundImage);
+ }
+ ApplyAttributes(backgroundImage, buttonAttributes.BackgroundImageAttributes);
+ }
+
+ if (buttonAttributes.OverlayImageAttributes != null)
+ {
+ if(overlayImage == null)
+ {
+ overlayImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ this.Add(overlayImage);
+ }
+ ApplyAttributes(overlayImage, buttonAttributes.OverlayImageAttributes);
+ }
+
+ if (buttonAttributes.TextAttributes != null)
+ {
+ if(buttonText == null)
+ {
+ buttonText = new TextLabel();
+ this.Add(buttonText);
+ }
+ ApplyAttributes(buttonText, buttonAttributes.TextAttributes);
+ }
+
+ if (buttonAttributes.IconAttributes != null)
+ {
+ if(buttonIcon == null)
+ {
+ buttonIcon = new ImageView();
+ buttonIcon.Relayout += OnIconRelayout;
+ this.Add(buttonIcon);
+ }
+ ApplyAttributes(buttonIcon, buttonAttributes.IconAttributes);
+ }
+
+ MeasureText();
+ LayoutChild();
+
+ Sensitive = isEnabled ? true : false;
+ }
+
+ /// <summary>
+ /// Update Button State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void UpdateState()
+ {
+ ControlStates sourceState = State;
+ ControlStates targetState;
+
+ if(isEnabled)
+ {
+ targetState = isPressed ? ControlStates.Pressed : (IsFocused ? (IsSelected ? ControlStates.SelectedFocused : ControlStates.Focused) : (IsSelected ? ControlStates.Selected : ControlStates.Normal));
+ }
+ else
+ {
+ targetState = IsSelected ? ControlStates.DisabledSelected : (IsFocused ? ControlStates.DisabledFocused : ControlStates.Disabled);
+ }
+ if(sourceState != targetState)
+ {
+ State = targetState;
+
+ OnUpdate();
+
+ StateChangeEventArgs e = new StateChangeEventArgs
+ {
+ PreviousState = sourceState,
+ CurrentState = targetState
+ };
+ stateChangeHander?.Invoke(this, e);
+ }
+ }
+ /// <summary>
+ /// It is hijack by using protected, attributes copy problem when class inherited from Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ private void Initialize()
+ {
+ buttonAttributes = attributes as ButtonAttributes;
+ if (buttonAttributes == null)
+ {
+ throw new Exception("Button attribute parse error.");
+ }
+
+ ApplyAttributes(this, buttonAttributes);
+ LayoutDirectionChanged += OnLayoutDirectionChanged;
+ }
+
+ /// <summary>
+ /// Measure text, it can be override.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void MeasureText()
+ {
+ if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
+ {
+ return;
+ }
+ buttonText.WidthResizePolicy = ResizePolicyType.Fixed;
+ buttonText.HeightResizePolicy = ResizePolicyType.Fixed;
+ int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft;
+ int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight;
+ int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop;
+ int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom;
+
+ int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft;
+ int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight;
+ int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop;
+ int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom;
+
+ if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom)
+ {
+ buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight;
+ buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom - iconPaddingTop - iconPaddingBottom - buttonIcon.SizeHeight;
+ }
+ else
+ {
+ buttonText.SizeWidth = SizeWidth - textPaddingLeft - textPaddingRight - iconPaddingLeft - iconPaddingRight - buttonIcon.SizeWidth;
+ buttonText.SizeHeight = SizeHeight - textPaddingTop - textPaddingBottom;
+ }
+ }
+ /// <summary>
+ /// Layout child, it can be override.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void LayoutChild()
+ {
+ if (buttonAttributes.IconRelativeOrientation == null || buttonIcon == null || buttonText == null)
+ {
+ return;
+ }
+
+ int textPaddingLeft = buttonAttributes.TextAttributes.PaddingLeft;
+ int textPaddingRight = buttonAttributes.TextAttributes.PaddingRight;
+ int textPaddingTop = buttonAttributes.TextAttributes.PaddingTop;
+ int textPaddingBottom = buttonAttributes.TextAttributes.PaddingBottom;
+
+ int iconPaddingLeft = buttonAttributes.IconAttributes.PaddingLeft;
+ int iconPaddingRight = buttonAttributes.IconAttributes.PaddingRight;
+ int iconPaddingTop = buttonAttributes.IconAttributes.PaddingTop;
+ int iconPaddingBottom = buttonAttributes.IconAttributes.PaddingBottom;
+
+ switch (IconRelativeOrientation)
+ {
+ case IconOrientation.Top:
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.TopCenter;
+ buttonIcon.PivotPoint = NUI.PivotPoint.TopCenter;
+ buttonIcon.Position2D = new Position2D(0, iconPaddingTop);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.BottomCenter;
+ buttonText.PivotPoint = NUI.PivotPoint.BottomCenter;
+ buttonText.Position2D = new Position2D(0, -textPaddingBottom);
+ break;
+ case IconOrientation.Bottom:
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.BottomCenter;
+ buttonIcon.PivotPoint = NUI.PivotPoint.BottomCenter;
+ buttonIcon.Position2D = new Position2D(0, -iconPaddingBottom);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.TopCenter;
+ buttonText.PivotPoint = NUI.PivotPoint.TopCenter;
+ buttonText.Position2D = new Position2D(0, textPaddingTop);
+ break;
+ case IconOrientation.Left:
+ if (LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
+ buttonIcon.Position2D = new Position2D(iconPaddingLeft, 0);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
+ buttonText.Position2D = new Position2D(-textPaddingRight, 0);
+ }
+ else
+ {
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
+ buttonIcon.Position2D = new Position2D(-iconPaddingLeft, 0);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
+ buttonText.Position2D = new Position2D(textPaddingRight, 0);
+ }
+
+ break;
+ case IconOrientation.Right:
+ if (LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ buttonIcon.PivotPoint = NUI.PivotPoint.CenterLeft;
+ buttonIcon.Position2D = new Position2D(iconPaddingRight, 0);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ buttonText.PivotPoint = NUI.PivotPoint.CenterRight;
+ buttonText.Position2D = new Position2D(-textPaddingLeft, 0);
+ }
+ else
+ {
+ buttonIcon.PositionUsesPivotPoint = true;
+ buttonIcon.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ buttonIcon.PivotPoint = NUI.PivotPoint.CenterRight;
+ buttonIcon.Position2D = new Position2D(-iconPaddingRight, 0);
+
+ buttonText.PositionUsesPivotPoint = true;
+ buttonText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ buttonText.PivotPoint = NUI.PivotPoint.CenterLeft;
+ buttonText.Position2D = new Position2D(textPaddingLeft, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ ButtonAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonAttributes;
+ if(tempAttributes != null)
+ {
+ attributes = buttonAttributes = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
+ {
+ MeasureText();
+ LayoutChild();
+ }
+
+ private void OnClick(ClickEventArgs eventArgs)
+ {
+ ClickEvent?.Invoke(this, eventArgs);
+ }
+
+ private void OnIconRelayout(object sender, EventArgs e)
+ {
+ MeasureText();
+ LayoutChild();
+ }
+
+ private void CreateBackgroundAttributes()
+ {
+ if (buttonAttributes.BackgroundImageAttributes == null)
+ {
+ buttonAttributes.BackgroundImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ }
+ }
+
+ private void CreateShadowAttributes()
+ {
+ if (buttonAttributes.ShadowImageAttributes == null)
+ {
+ buttonAttributes.ShadowImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ }
+ }
+
+ private void CreateOverlayAttributes()
+ {
+ if (buttonAttributes.OverlayImageAttributes == null)
+ {
+ buttonAttributes.OverlayImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ }
+ }
+
+ private void CreateTextAttributes()
+ {
+ if (buttonAttributes.TextAttributes == null)
+ {
+ buttonAttributes.TextAttributes = new TextAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center
+ };
+ }
+ }
+
+ private void CreateIconAttributes()
+ {
+ if (buttonAttributes.IconAttributes == null)
+ {
+ buttonAttributes.IconAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+ };
+ }
+ }
+ /// <summary>
+ /// ClickEventArgs is a class to record button click event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ClickEventArgs : EventArgs
+ {
+ }
+ /// <summary>
+ /// StateChangeEventArgs is a class to record button state change event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class StateChangeEventArgs : EventArgs
+ {
+ /// <summary> previous state of Button </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ControlStates PreviousState;
+ /// <summary> current state of Button </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ControlStates CurrentState;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// 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 class CheckBox : SelectButton
+ {
+ /// <summary>
+ /// Creates a new instance of a CheckBox.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBox() : base() { }
+ /// <summary>
+ /// Creates a new instance of a CheckBox with style.
+ /// </summary>
+ /// <param name="style"></param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBox(string style) : base(style) { }
+ /// <summary>
+ /// Creates a new instance of a CheckBox with attributes.
+ /// </summary>
+ /// <param name="attrs"></param>
+ /// 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 CheckBox(SelectButtonAttributes attrs) : base(attrs) { }
+
+ /// <summary>
+ /// Get CheckBoxGroup to which this CheckBox belong.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBoxGroup ItemGroup
+ {
+ get
+ {
+ return itemGroup as CheckBoxGroup;
+ }
+ internal set
+ {
+ itemGroup = value;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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 System.Collections.Generic;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The CheckboxGroup class is used to group together a set of CheckBox control
+ /// </summary>
+ /// <code>
+ /// CheckBoxGroup checkGroup = new CheckBoxGroup();
+ /// CheckBox check1 = new CheckBox();
+ /// CheckBox check2 = new CheckBox();
+ /// checkGroup.Add(check1);
+ /// checkGroup.Add(check2);
+ /// </code>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class CheckBoxGroup : SelectGroup
+ {
+ /// <summary>
+ /// Construct CheckBoxGroup
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBoxGroup() : base()
+ {
+
+ }
+
+ /// <summary>
+ /// Add CheckBox to the end of CheckBoxGroup.
+ /// </summary>
+ /// <param name="check">The CheckBox to be added to the CheckBoxGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Add(CheckBox check)
+ {
+ base.AddSelection(check);
+ check.ItemGroup = this;
+ }
+
+ /// <summary>
+ /// Remove CheckBox from the CheckBoxGroup.
+ /// </summary>
+ /// <param name="check">The CheckBox to remove from the CheckBoxGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Remove(CheckBox check)
+ {
+ base.RemoveSelection(check);
+ check.ItemGroup = null;
+ }
+
+ /// <summary>
+ /// Get the CheckBox object at the specified index.
+ /// </summary>
+ /// <param name="index">The item index</param>
+ /// <returns>CheckBox</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBox GetItemByIndex(int index)
+ {
+ return itemGroup[index] as CheckBox;
+ }
+
+ /// <summary>
+ /// Get the index array of checked items.
+ /// </summary>
+ /// <returns>The array of index</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int[] GetCheckedIndexArray()
+ {
+ List<int> selectedItemsList = new List<int>();
+ for (int i = 0; i < itemGroup.Count; i++)
+ {
+ if (itemGroup[i].IsSelected)
+ {
+ selectedItemsList.Add(i);
+ }
+ }
+
+ return selectedItemsList.ToArray();
+ }
+
+
+ /// <summary>
+ /// Get the CheckBox array of checked items.
+ /// </summary>
+ /// <returns>The array of CheckBox</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckBox[] GetCheckedItemArray()
+ {
+ List<CheckBox> selectedList = new List<CheckBox>();
+
+ foreach (CheckBox check in itemGroup)
+ {
+ if (check.IsSelected)
+ {
+ selectedList.Add(check);
+ }
+ }
+
+ return selectedList.ToArray();
+ }
+
+ /// <summary>
+ /// Determines whether every checkboxes in the CheckBoxGroup are checked
+ /// </summary>
+ /// <returns>If all of CheckBoxes are checked, return true. otherwise false</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsCheckedAll()
+ {
+ foreach (CheckBox cb in itemGroup)
+ {
+ if (!cb.IsSelected)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// Check or Uncheck all of child checkboxes by the specified value
+ /// </summary>
+ /// <param name="state">The boolean state of the check box</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 CheckingAll(bool state)
+ {
+ foreach (CheckBox cb in itemGroup)
+ {
+ cb.IsSelected = state;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The control component is base class of tv nui components. It's abstract class, so cann't instantiate and can only be inherited.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract class Control : VisualView
+ {
+ /// <summary>
+ /// Control style.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string style;
+ /// <summary>
+ /// Control attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Attributes attributes;
+
+ private TapGestureDetector tapGestureDetector = new TapGestureDetector();
+ private bool isFocused = false;
+
+ /// <summary>
+ /// Construct an empty Control.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Control() : base()
+ {
+ Initialize(null);
+ }
+
+ /// <summary>
+ /// Construct with attributes
+ /// </summary>
+ /// <param name="attributes">Create attributes customized by user</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Control(Attributes attributes) : base()
+ {
+ Initialize(null);
+ this.attributes = attributes.Clone();
+ }
+
+ /// <summary>
+ /// Construct with style
+ /// </summary>
+ /// <param name="style">Style to be applied</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Control(string style) : base()
+ {
+ Initialize(style);
+ }
+
+ /// <summary>
+ /// Get/Set the control state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 new ControlStates State
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Whether focusable when touch
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal bool StateFocusableOnTouchMode
+ {
+ get;
+ set;
+ }
+
+ internal bool IsFocused
+ {
+ get
+ {
+ return isFocused || HasFocus();
+ }
+ }
+ /// <summary>
+ /// Apply attributes for View, Image or TextLabel.
+ /// </summary>
+ /// <param name="view">View which will be applied attrs</param>
+ /// <param name="attrs">Attributes for View, Image or TextLabel</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void ApplyAttributes(View view, ViewAttributes attrs)
+ {
+ if (view == null || attrs == null)
+ {
+ return;
+ }
+
+ if (attrs.Position2D != null)
+ {
+ view.Position2D = attrs.Position2D;
+ }
+ if (attrs.Size2D != null)
+ {
+ view.Size2D = attrs.Size2D;
+ }
+ if (attrs.MinimumSize != null)
+ {
+ view.MinimumSize = attrs.MinimumSize;
+ }
+ if (attrs.BackgroundColor?.GetValue(State) != null)
+ {
+ view.BackgroundColor = attrs.BackgroundColor.GetValue(State);
+ }
+ if (attrs.PositionUsesPivotPoint != null)
+ {
+ view.PositionUsesPivotPoint = attrs.PositionUsesPivotPoint.Value;
+ }
+ if (attrs.ParentOrigin != null)
+ {
+ view.ParentOrigin = attrs.ParentOrigin;
+ }
+ if (attrs.PivotPoint != null)
+ {
+ view.PivotPoint = attrs.PivotPoint;
+ }
+ if (attrs.WidthResizePolicy!= null)
+ {
+ view.WidthResizePolicy = attrs.WidthResizePolicy.Value;
+ }
+ if (attrs.HeightResizePolicy != null)
+ {
+ view.HeightResizePolicy = attrs.HeightResizePolicy.Value;
+ }
+ if (attrs.SizeModeFactor != null)
+ {
+ view.SizeModeFactor = attrs.SizeModeFactor;
+ }
+ if (attrs.Opacity?.GetValue(State) != null)
+ {
+ view.Opacity = attrs.Opacity.GetValue(State).Value;
+ }
+
+ ImageView image = view as ImageView;
+ ImageAttributes imageAttrs = attrs as ImageAttributes;
+ if (image != null && imageAttrs != null)
+ {
+ if (imageAttrs.ResourceUrl?.GetValue(State) != null)
+ {
+ image.ResourceUrl = imageAttrs.ResourceUrl.GetValue(State);
+ }
+ if (imageAttrs.Border?.GetValue(State) != null)
+ {
+ image.Border = imageAttrs.Border.GetValue(State);
+ }
+
+ }
+
+ TextLabel text = view as TextLabel;
+ TextAttributes textAttrs = attrs as TextAttributes;
+ if (text != null && textAttrs != null)
+ {
+ if (textAttrs.Text?.GetValue(State) != null )
+ {
+ text.Text = textAttrs.Text.GetValue(State);
+ }
+ if (textAttrs.TranslatableText?.GetValue(State) != null)
+ {
+ text.TranslatableText = textAttrs.TranslatableText.GetValue(State);
+ }
+ if (textAttrs.MultiLine != null)
+ {
+ text.MultiLine = textAttrs.MultiLine.Value;
+ }
+ if (textAttrs.HorizontalAlignment != null)
+ {
+ text.HorizontalAlignment = textAttrs.HorizontalAlignment.Value;
+ }
+ if (textAttrs.VerticalAlignment != null)
+ {
+ text.VerticalAlignment = textAttrs.VerticalAlignment.Value;
+ }
+ if (textAttrs.EnableMarkup != null)
+ {
+ text.EnableMarkup = textAttrs.EnableMarkup.Value;
+ }
+ if (textAttrs.AutoScrollLoopCount != null)
+ {
+ text.AutoScrollLoopCount = textAttrs.AutoScrollLoopCount.Value;
+ }
+ if (textAttrs.AutoScrollSpeed != null)
+ {
+ text.AutoScrollSpeed = textAttrs.AutoScrollSpeed.Value;
+ }
+ if (textAttrs.AutoScrollGap != null)
+ {
+ text.AutoScrollGap = textAttrs.AutoScrollGap.Value;
+ }
+ if (textAttrs.AutoScrollLoopDelay != null)
+ {
+ text.AutoScrollLoopDelay = textAttrs.AutoScrollLoopDelay.Value;
+ }
+ if (textAttrs.AutoScrollStopMode != null)
+ {
+ text.AutoScrollStopMode = textAttrs.AutoScrollStopMode.Value;
+ }
+ if (textAttrs.LineSpacing != null)
+ {
+ text.LineSpacing = textAttrs.LineSpacing.Value;
+ }
+ if (textAttrs.TextColor?.GetValue(State) != null)
+ {
+ text.TextColor = textAttrs.TextColor.GetValue(State);
+ }
+ if (textAttrs.FontFamily != null)
+ {
+ text.FontFamily = textAttrs.FontFamily;
+ }
+ if (textAttrs.PointSize?.GetValue(State) != null)
+ {
+ text.PointSize = textAttrs.PointSize.GetValue(State).Value;
+ }
+
+ int thickness = 0;
+
+ if (textAttrs.OutstrokeThickness?.GetValue(State) != null)
+ {
+ thickness = textAttrs.OutstrokeThickness.GetValue(State).Value;
+ }
+ if (textAttrs.OutstrokeColor?.GetValue(State) != null)
+ {
+ Color outstrokeColor = textAttrs.OutstrokeColor.GetValue(State);
+ PropertyMap outlineMap = new PropertyMap();
+ outlineMap.Add("color", new PropertyValue(new Color(outstrokeColor.R, outstrokeColor.G, outstrokeColor.B, outstrokeColor.A)));
+ outlineMap.Add("width", new PropertyValue(thickness));
+ text.Outline = outlineMap;
+ }
+ else
+ {
+ text.Outline = new PropertyMap();
+ }
+ }
+
+ TextField textField = view as TextField;
+ TextFieldAttributes textFieldAttrs = attrs as TextFieldAttributes;
+ if (textField != null && textFieldAttrs != null)
+ {
+ if (textFieldAttrs.Text?.GetValue(State) != null)
+ {
+ textField.Text = textFieldAttrs.Text.GetValue(State);
+ }
+ if (textFieldAttrs.PlaceholderText?.GetValue(State) != null)
+ {
+ textField.PlaceholderText = textFieldAttrs.PlaceholderText.GetValue(State);
+ }
+ if (textFieldAttrs.TranslatablePlaceholderText?.GetValue(State) != null)
+ {
+ textField.TranslatablePlaceholderText = textFieldAttrs.TranslatablePlaceholderText.GetValue(State);
+ }
+ if (textFieldAttrs.HorizontalAlignment != null)
+ {
+ textField.HorizontalAlignment = textFieldAttrs.HorizontalAlignment.Value;
+ }
+ if (textFieldAttrs.VerticalAlignment != null)
+ {
+ textField.VerticalAlignment = textFieldAttrs.VerticalAlignment.Value;
+ }
+ if (textFieldAttrs.EnableMarkup != null)
+ {
+ textField.EnableMarkup = textFieldAttrs.EnableMarkup.Value;
+ }
+ if (textFieldAttrs.TextColor?.GetValue(State) != null)
+ {
+ textField.TextColor = textFieldAttrs.TextColor.GetValue(State);
+ }
+ if (textFieldAttrs.PlaceholderTextColor?.GetValue(State) != null)
+ {
+ textField.PlaceholderTextColor = textFieldAttrs.PlaceholderTextColor.GetValue(State);
+ }
+ if (textFieldAttrs.PrimaryCursorColor?.GetValue(State) != null)
+ {
+ textField.PrimaryCursorColor = textFieldAttrs.PrimaryCursorColor.GetValue(State);
+ }
+ if (textFieldAttrs.SecondaryCursorColor?.GetValue(State) != null)
+ {
+ textField.SecondaryCursorColor = textFieldAttrs.SecondaryCursorColor.GetValue(State);
+ }
+ if (textFieldAttrs.FontFamily != null)
+ {
+ textField.FontFamily = textFieldAttrs.FontFamily;
+ }
+ if (textFieldAttrs.PointSize?.GetValue(State) != null)
+ {
+ textField.PointSize = textFieldAttrs.PointSize.GetValue(State).Value;
+ }
+ if (textFieldAttrs.EnableCursorBlink != null)
+ {
+ textField.EnableCursorBlink = textFieldAttrs.EnableCursorBlink.Value;
+ }
+ if (textFieldAttrs.EnableSelection != null)
+ {
+ textField.EnableSelection = textFieldAttrs.EnableSelection.Value;
+ }
+ if (textFieldAttrs.CursorWidth != null)
+ {
+ textField.CursorWidth = textFieldAttrs.CursorWidth.Value;
+ }
+ if (textFieldAttrs.EnableEllipsis != null)
+ {
+ textField.Ellipsis = textFieldAttrs.EnableEllipsis.Value;
+ }
+ }
+ }
+ /// <summary>
+ /// Dispose Control and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ StyleManager.Instance.ThemeChangedEvent -= OnThemeChangedEvent;
+ tapGestureDetector.Detected -= OnTapGestureDetected;
+ tapGestureDetector.Detach(this);
+ }
+ base.Dispose(type);
+ }
+ /// <summary>
+ /// Get attribues, it is abstract function and must be override.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract Attributes GetAttributes();
+ /// <summary>
+ /// Called after a key event is received by the view that has had its focus set.
+ /// </summary>
+ /// <param name="key">The key event.</param>
+ /// <returns>True if the key event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnKey(Key key)
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Called after the size negotiation has been finished for this control.<br />
+ /// The control is expected to assign this given size to itself or its children.<br />
+ /// Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize, or after changing specific properties.<br />
+ /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).<br />
+ /// </summary>
+ /// <param name="size">The allocated size.</param>
+ /// <param name="container">The control should add views to this container that it is not able to allocate a size for.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnRelayout(Vector2 size, RelayoutContainer container)
+ {
+ OnUpdate();
+ }
+
+ /// <summary>
+ /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is gained.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusGained()
+ {
+ isFocused = true;
+ }
+
+ /// <summary>
+ /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when the focus is lost.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusLost()
+ {
+ isFocused = false;
+ }
+
+ /// <summary>
+ /// Tap gesture callback.
+ /// </summary>
+ /// <param name="source">The sender</param>
+ /// <param name="e">The tap gesture event data</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
+ {
+ }
+ /// <summary>
+ /// Called after a touch event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="touch">The touch event.</param>
+ /// <returns>True if the event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnTouch(Touch touch)
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Update by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnUpdate()
+ {
+ }
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <param name="sender">The sender</param>
+ /// <param name="e">The event data</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ }
+
+ private void Initialize(string style)
+ {
+ attributes = (style == null) ? GetAttributes() : GetAttributes(style);
+ State = ControlStates.Normal;
+
+ LeaveRequired = true;
+
+ StateFocusableOnTouchMode = false;
+
+ tapGestureDetector.Attach(this);
+ tapGestureDetector.Detected += OnTapGestureDetected;
+
+ StyleManager.Instance.ThemeChangedEvent += OnThemeChangedEvent;
+ }
+
+ private Attributes GetAttributes(string style)
+ {
+ Attributes attributes = StyleManager.Instance.GetAttributes(style);
+ if(attributes == null)
+ {
+ throw new InvalidOperationException($"There is no style {style}");
+ }
+ this.style = style;
+ return attributes;
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// DropDown is one kind of common component, a dropdown allows the user click dropdown button to choose one value from a list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class DropDown : Control
+ {
+ #region DropDown
+ private Button button = null;
+ private TextLabel headerText = null;
+ private TextLabel buttonText = null;
+ private ImageView listBackgroundImage = null;
+ private FlexibleView list = null;
+ private DropDownListBridge adapter = new DropDownListBridge();
+ private DropDownAttributes dropDownAttributes = null;
+ private DropDownItemView touchedView = null;
+ private int selectedItemIndex = -1;
+
+ /// <summary>
+ /// Creates a new instance of a DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDown() : base()
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a DropDown with style.
+ /// </summary>
+ /// <param name="style">Create DropDown by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDown(string style) : base(style)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a DropDown with attributes.
+ /// </summary>
+ /// <param name="attributes">Create DropDown by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDown(DropDownAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 delegate void ClickEventHandler<ClickEventArgs>(object sender, ClickEventArgs e);
+
+ /// <summary>
+ /// An event for the item clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event ClickEventHandler<ItemClickEventArgs> ItemClickEvent;
+
+ /// <summary>
+ /// List orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum ListOrientation
+ {
+ /// <summary>
+ /// Left.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Left,
+ /// <summary>
+ /// Right.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Right,
+ }
+
+ /// <summary>
+ /// Header text string in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string HeaderText
+ {
+ get
+ {
+ return dropDownAttributes.HeaderTextAttributes?.Text.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateHeaderTextAttributes();
+ if (dropDownAttributes.HeaderTextAttributes.Text == null)
+ {
+ dropDownAttributes.HeaderTextAttributes.Text = new StringSelector();
+ }
+ dropDownAttributes.HeaderTextAttributes.Text.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Header text point size in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float HeaderTextPointSize
+ {
+ get
+ {
+ return dropDownAttributes.HeaderTextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateHeaderTextAttributes();
+ if (dropDownAttributes.HeaderTextAttributes.PointSize == null)
+ {
+ dropDownAttributes.HeaderTextAttributes.PointSize = new FloatSelector();
+ }
+ dropDownAttributes.HeaderTextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Header text font family in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string HeaderTextFontFamily
+ {
+ get
+ {
+ return dropDownAttributes.HeaderTextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateHeaderTextAttributes();
+ dropDownAttributes.HeaderTextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Header text color in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color HeaderTextColor
+ {
+ get
+ {
+ return dropDownAttributes.HeaderTextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateHeaderTextAttributes();
+ if (dropDownAttributes.HeaderTextAttributes.TextColor == null)
+ {
+ dropDownAttributes.HeaderTextAttributes.TextColor = new ColorSelector();
+ }
+ dropDownAttributes.HeaderTextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Header text color selector in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector HeaderTextColorSelector
+ {
+ get
+ {
+ return dropDownAttributes.HeaderTextAttributes?.TextColor;
+ }
+ set
+ {
+ CreateHeaderTextAttributes();
+ if (value != null)
+ {
+ dropDownAttributes.HeaderTextAttributes.TextColor = value.Clone() as ColorSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button text string in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ButtonText
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.TextAttributes?.Text.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonTextAttributes();
+ if (dropDownAttributes.ButtonAttributes.TextAttributes.Text == null)
+ {
+ dropDownAttributes.ButtonAttributes.TextAttributes.Text = new StringSelector();
+ }
+ dropDownAttributes.ButtonAttributes.TextAttributes.Text.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button text point size in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float ButtonTextPointSize
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateButtonTextAttributes();
+ if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize == null)
+ {
+ dropDownAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector();
+ }
+ dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text font family in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ButtonTextFontFamily
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateButtonTextAttributes();
+ dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text color in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color ButtonTextColor
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateButtonTextAttributes();
+ if (dropDownAttributes.ButtonAttributes.TextAttributes.TextColor == null)
+ {
+ dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector();
+ }
+ dropDownAttributes.ButtonAttributes.TextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text color selector in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector ButtonTextColorSelector
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.TextAttributes?.TextColor;
+ }
+ set
+ {
+ CreateButtonTextAttributes();
+ if (value != null)
+ {
+ dropDownAttributes.ButtonAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button icon image's resource url in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ButtonIconImageURL
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.IconAttributes?.ResourceUrl.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonIconAttributes();
+ if (dropDownAttributes.ButtonAttributes.IconAttributes.ResourceUrl == null)
+ {
+ dropDownAttributes.ButtonAttributes.IconAttributes.ResourceUrl = new StringSelector();
+ }
+ dropDownAttributes.ButtonAttributes.IconAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button icon image's size in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D ButtonIconSize2D
+ {
+ get
+ {
+ return dropDownAttributes.ButtonAttributes?.IconAttributes?.Size2D;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonIconAttributes();
+ dropDownAttributes.ButtonAttributes.IconAttributes.Size2D = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Space between button text and button icon in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SpaceBetweenButtonTextAndIcon
+ {
+ get
+ {
+ return dropDownAttributes.SpaceBetweenButtonTextAndIcon;
+ }
+ set
+ {
+ dropDownAttributes.SpaceBetweenButtonTextAndIcon = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Left space in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int LeftSpace
+ {
+ get
+ {
+ return (int)dropDownAttributes.Space.X;
+ }
+ set
+ {
+ dropDownAttributes.Space.X = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Right space in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int RightSpace
+ {
+ get
+ {
+ return (int)dropDownAttributes.Space.Y;
+ }
+ set
+ {
+ dropDownAttributes.Space.Y = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// List background image's resource url in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ListBackgroundImageURL
+ {
+ get
+ {
+ return dropDownAttributes.ListBackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateListBackgroundAttributes();
+ if (dropDownAttributes.ListBackgroundImageAttributes.ResourceUrl == null)
+ {
+ dropDownAttributes.ListBackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ dropDownAttributes.ListBackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// List background image's border in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle ListBackgroundImageBorder
+ {
+ get
+ {
+ return dropDownAttributes.ListBackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateListBackgroundAttributes();
+ if (dropDownAttributes.ListBackgroundImageAttributes.Border == null)
+ {
+ dropDownAttributes.ListBackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ dropDownAttributes.ListBackgroundImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// List relative orientation in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ListOrientation ListRelativeOrientation
+ {
+ get
+ {
+ return dropDownAttributes.ListRelativeOrientation;
+ }
+ set
+ {
+ dropDownAttributes.ListRelativeOrientation = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Left space in list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ListLeftMargin
+ {
+ get
+ {
+ return (int)dropDownAttributes.ListMargin.X;
+ }
+ set
+ {
+ dropDownAttributes.ListMargin.X = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Right space in list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ListRigthMargin
+ {
+ get
+ {
+ return (int)dropDownAttributes.ListMargin.Y;
+ }
+ set
+ {
+ dropDownAttributes.ListMargin.Y = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Top space in list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ListTopMargin
+ {
+ get
+ {
+ return (int)dropDownAttributes.ListMargin.Z;
+ }
+ set
+ {
+ dropDownAttributes.ListMargin.Z = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Focused item index in list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FocusedItemIndex
+ {
+ get
+ {
+ return dropDownAttributes.FocusedItemIndex;
+ }
+ set
+ {
+ dropDownAttributes.FocusedItemIndex = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Selected item index in list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SelectedItemIndex
+ {
+ get
+ {
+ return selectedItemIndex;
+ }
+ set
+ {
+ if (value == selectedItemIndex || adapter == null || value >= adapter.GetItemCount())
+ {
+ return;
+ }
+ UpdateSelectedItem(value);
+ }
+ }
+
+ /// <summary>
+ /// List size in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D ListSize2D
+ {
+ get
+ {
+ return dropDownAttributes.ListSize2D;
+ }
+ set
+ {
+ dropDownAttributes.ListSize2D = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// List padding in DropDown.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Extents ListPadding
+ {
+ get
+ {
+ return dropDownAttributes.ListPadding;
+ }
+ set
+ {
+ dropDownAttributes.ListPadding = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Add list item by item data. The added item will be added to end of all items automatically.
+ /// </summary>
+ /// <param name="itemData">Item data which will apply to tab item view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AddItem(DropDownItemData itemData)
+ {
+ adapter.InsertData(-1, itemData);
+ }
+
+ /// <summary>
+ /// Delete list item by index.
+ /// </summary>
+ /// <param name="index">Position index where will be deleted.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DeleteItem(int index)
+ {
+ if(index < 0 || index >= adapter.GetItemCount())
+ {
+ return;
+ }
+
+ if (selectedItemIndex == index)
+ {
+ selectedItemIndex = -1;
+ }
+ else if(selectedItemIndex > index)
+ {
+ selectedItemIndex--;
+ }
+
+ adapter.RemoveData(index);
+ }
+
+ /// <summary>
+ /// Insert list item by item data. The inserted item will be added to the special position by index automatically.
+ /// </summary>
+ /// <param name="item">Item data which will apply to tab item view.</param>
+ /// <param name="index">Position index where will be inserted.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InsertItem(DropDownItemData item, int index)
+ {
+ if (index < 0 || index >= adapter.GetItemCount())
+ {
+ return;
+ }
+
+ if (selectedItemIndex >= index)
+ {
+ selectedItemIndex++;
+ }
+
+ adapter.InsertData(index, item);
+ }
+
+ /// <summary>
+ /// Add scroll bar to list.
+ /// </summary>
+ /// <param name="scrollBar">Scroll bar defined by user which will be added to list.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AttachScrollBar(ScrollBar scrollBar)
+ {
+ if (list == null)
+ {
+ return;
+ }
+ list.AttachScrollBar(scrollBar);
+ }
+
+ /// <summary>
+ /// Detach scroll bar to list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DetachScrollBar()
+ {
+ if (list == null)
+ {
+ return;
+ }
+ list.DetachScrollBar();
+ }
+
+ /// <summary>
+ /// Update DropDown by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (dropDownAttributes.HeaderTextAttributes != null)
+ {
+ if (headerText == null)
+ {
+ CreateHeaderText();
+ }
+ ApplyAttributes(headerText, dropDownAttributes.HeaderTextAttributes);
+ }
+
+
+ if (dropDownAttributes.ButtonAttributes != null)
+ {
+ if (button == null)
+ {
+ CreateButton();
+ }
+ if (dropDownAttributes.Space != null)
+ {
+ button.Position2D.X = (int)dropDownAttributes.Space.X;
+ }
+
+ if (dropDownAttributes.ButtonAttributes.TextAttributes != null)
+ {
+ ApplyAttributes(buttonText, dropDownAttributes.ButtonAttributes.TextAttributes);
+ button.TextSelector = dropDownAttributes.ButtonAttributes.TextAttributes.Text;
+ if (dropDownAttributes.ButtonAttributes.TextAttributes.PointSize != null)
+ {
+ button.PointSize = dropDownAttributes.ButtonAttributes.TextAttributes.PointSize.All.Value;
+ }
+ button.FontFamily = dropDownAttributes.ButtonAttributes.TextAttributes.FontFamily;
+ button.TextColorSelector = dropDownAttributes.ButtonAttributes.TextAttributes.TextColor;
+ }
+ if (dropDownAttributes.ButtonAttributes.IconAttributes != null)
+ {
+ button.IconURLSelector = dropDownAttributes.ButtonAttributes.IconAttributes.ResourceUrl;
+ int iconWidth = 0;
+ int buttonTextWidth = 0;
+ if (dropDownAttributes.ButtonAttributes.IconAttributes.Size2D != null)
+ {
+ iconWidth = dropDownAttributes.ButtonAttributes.IconAttributes.Size2D.Width;
+ }
+ if (buttonText.NaturalSize2D != null)
+ {
+ buttonTextWidth = buttonText.NaturalSize2D.Width;
+ }
+ button.SizeWidth = iconWidth + dropDownAttributes.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+ }
+ }
+
+ if (dropDownAttributes.ListBackgroundImageAttributes != null)
+ {
+ if (listBackgroundImage == null)
+ {
+ CreateListBackgroundImage();
+ CreateList();
+ }
+ ApplyAttributes(listBackgroundImage, dropDownAttributes.ListBackgroundImageAttributes);
+ list.FocusedItemIndex = dropDownAttributes.FocusedItemIndex;
+ list.Size2D = dropDownAttributes.ListSize2D;
+ list.Padding = dropDownAttributes.ListPadding;
+
+ int listBackgroundImageX = 0;
+ int listBackgroundImageY = 0;
+ if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Left)
+ {
+ if (dropDownAttributes.ListMargin != null)
+ {
+ listBackgroundImageX = (int)dropDownAttributes.ListMargin.X;
+ listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z;
+ }
+ }
+ else if (dropDownAttributes.ListRelativeOrientation == ListOrientation.Right)
+ {
+ if (dropDownAttributes.ListMargin != null)
+ {
+ int listWidth = 0;
+ if (list.Size2D != null)
+ {
+ listWidth = list.Size2D.Width;
+ }
+ listBackgroundImageX = Size2D.Width - listWidth - (int)dropDownAttributes.ListMargin.Y;
+ listBackgroundImageY = (int)dropDownAttributes.ListMargin.Z;
+ }
+ }
+ listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
+ }
+ }
+
+ /// <summary>
+ /// Dispose DropDown and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (headerText != null)
+ {
+ Utility.Dispose(headerText);
+ }
+
+ if (buttonText != null)
+ {
+ Utility.Dispose(buttonText);
+ }
+
+ if (button != null)
+ {
+ Utility.Dispose(button);
+ }
+
+ if (list != null)
+ {
+ if (listBackgroundImage != null)
+ {
+ Utility.Dispose(listBackgroundImage);
+ }
+
+ Utility.Dispose(list);
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Get DropDown attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new DropDownAttributes();
+ }
+
+ private void Initialize()
+ {
+ dropDownAttributes = attributes as DropDownAttributes;
+ if (dropDownAttributes == null)
+ {
+ throw new Exception("DropDown attribute parse error.");
+ }
+ ApplyAttributes(this, dropDownAttributes);
+ }
+
+ private void OnClickEvent(object sender, ItemClickEventArgs e)
+ {
+ ItemClickEvent?.Invoke(sender, e);
+ }
+
+ private void CreateHeaderText()
+ {
+ headerText = new TextLabel();
+ headerText.Name = "DropDownHeaderText";
+ Add(headerText);
+ }
+
+ private void CreateButton()
+ {
+ button = new Button()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ IconRelativeOrientation = Button.IconOrientation.Right,
+ };
+ button.Name = "DropDownButton";
+ button.ClickEvent += ButtonClickEvent;
+ Add(button);
+
+ buttonText = new TextLabel()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ };
+ buttonText.Name = "DropDownButtonText";
+ Add(buttonText);
+ buttonText.Hide();
+ }
+
+ private void CreateList()
+ {
+ list = new FlexibleView();
+ list.Name = "DropDownList";
+ LinearLayoutManager layoutManager = new LinearLayoutManager(LinearLayoutManager.VERTICAL);
+ list.SetLayoutManager(layoutManager);
+ list.SetAdapter(adapter);
+ list.Focusable = true;
+ list.ItemTouchEvent += ListItemTouchEvent;
+ list.ItemClickEvent += ListItemClickEvent;
+ listBackgroundImage.Add(list);
+ listBackgroundImage.Hide();
+ }
+
+ private void ListItemClickEvent(object sender, FlexibleView.ItemClickEventArgs e)
+ {
+ if (e.ClickedView != null)
+ {
+ UpdateSelectedItem(e.ClickedView.AdapterPosition);
+
+ ItemClickEventArgs args = new ItemClickEventArgs();
+ args.Index = e.ClickedView.AdapterPosition;
+ args.Text = (e.ClickedView.ItemView as DropDownItemView)?.Text;
+ OnClickEvent(this, args);
+ }
+
+ listBackgroundImage.Hide();
+ }
+
+ private void ListItemTouchEvent(object sender, FlexibleView.ItemTouchEventArgs e)
+ {
+ PointStateType state = e.Touch.GetState(0);
+ switch (state)
+ {
+ case PointStateType.Down:
+ if (e.TouchedView != null)
+ {
+ touchedView = e.TouchedView.ItemView as DropDownItemView;
+ if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ {
+ touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Pressed);
+ }
+ }
+ break;
+ case PointStateType.Motion:
+ if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ {
+ touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Normal);
+ }
+ break;
+ case PointStateType.Up:
+ if (touchedView != null && touchedView.BackgroundColorSelector != null)
+ {
+ touchedView.BackgroundColor = touchedView.BackgroundColorSelector.GetValue(ControlStates.Selected);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void UpdateSelectedItem(int index)
+ {
+ if (selectedItemIndex != -1)
+ {
+ DropDownItemData data = adapter.GetData(selectedItemIndex);
+ if(data != null)
+ {
+ data.IsSelected = false;
+ }
+ DropDownItemView view = list?.FindViewHolderForAdapterPosition(selectedItemIndex)?.ItemView as DropDownItemView;
+ if (view != null)
+ {
+ view.IsSelected = false;
+ }
+ }
+
+ if (index != -1)
+ {
+ DropDownItemData data = adapter.GetData(index);
+ if (data != null)
+ {
+ data.IsSelected = true;
+ }
+ DropDownItemView view = list?.FindViewHolderForAdapterPosition(index)?.ItemView as DropDownItemView;
+ if (view != null)
+ {
+ view.IsSelected = true;
+ button.Text = view.Text;
+ }
+ }
+
+ selectedItemIndex = index;
+ }
+
+ private void CreateListBackgroundImage()
+ {
+ listBackgroundImage = new ImageView
+ {
+ Name = "ListBackgroundImage",
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.FitToChildren,
+ HeightResizePolicy = ResizePolicyType.FitToChildren,
+ };
+ Add(listBackgroundImage);
+ }
+
+ private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
+ {
+ listBackgroundImage.Show();
+ }
+
+ private void CreateHeaderTextAttributes()
+ {
+ if (dropDownAttributes.HeaderTextAttributes == null)
+ {
+ dropDownAttributes.HeaderTextAttributes = new TextAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ };
+ }
+ }
+
+ private void CreateButtonAttributes()
+ {
+ if (dropDownAttributes.ButtonAttributes == null)
+ {
+ dropDownAttributes.ButtonAttributes = new ButtonAttributes();
+ }
+ }
+
+ private void CreateButtonTextAttributes()
+ {
+ CreateButtonAttributes();
+
+ if (dropDownAttributes.ButtonAttributes.TextAttributes == null)
+ {
+ dropDownAttributes.ButtonAttributes.TextAttributes = new TextAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ Position2D = new Position2D(0, 0),
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Center,
+ };
+ }
+ }
+
+ private void CreateButtonIconAttributes()
+ {
+ CreateButtonAttributes();
+
+ if (dropDownAttributes.ButtonAttributes.IconAttributes == null)
+ {
+ dropDownAttributes.ButtonAttributes.IconAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight,
+ PivotPoint = Tizen.NUI.PivotPoint.CenterRight,
+ };
+ }
+ }
+
+ private void CreateListBackgroundAttributes()
+ {
+ if (dropDownAttributes.ListBackgroundImageAttributes == null)
+ {
+ dropDownAttributes.ListBackgroundImageAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+ #endregion
+
+ #region ItemClickEventArgs
+ /// <summary>
+ /// ItemClickEventArgs is a class to record item click event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ItemClickEventArgs : EventArgs
+ {
+ /// <summary> Clicked item index of DropDown's list </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int Index;
+ /// <summary> Clicked item text string of DropDown's list </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Text;
+ }
+ #endregion
+
+ #region DropDownItemData
+ /// <summary>
+ /// DropDownItemData is a class to record all data which will be applied to DropDown item.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class DropDownItemData
+ {
+ private DropDownItemAttributes itemDataAttributes = new DropDownItemAttributes();
+
+ /// <summary>
+ /// Creates a new instance of a DropDownItemData.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemData()
+ {
+ Initalize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a DropDownItemData with style.
+ /// </summary>
+ /// <param name="style">Create DropDownItemData by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemData(string style)
+ {
+ if(style != null)
+ {
+ Attributes attributes = StyleManager.Instance.GetAttributes(style);
+ if(attributes == null)
+ {
+ throw new InvalidOperationException($"There is no style {style}");
+ }
+ itemDataAttributes = attributes as DropDownItemAttributes;
+ }
+ Initalize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a DropDownItemData with attributes.
+ /// </summary>
+ /// <param name="attributes">Create DropDownItemData by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemData(DropDownItemAttributes attributes)
+ {
+ itemDataAttributes = attributes.Clone() as DropDownItemAttributes;
+ Initalize();
+ }
+
+ /// <summary>
+ /// DropDown item size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D Size2D
+ {
+ get
+ {
+ return itemDataAttributes.Size2D;
+ }
+ set
+ {
+ itemDataAttributes.Size2D = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item background color selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector BackgroundColorSelector
+ {
+ get
+ {
+ return itemDataAttributes.BackgroundColor;
+ }
+ set
+ {
+ if (itemDataAttributes.BackgroundColor == null)
+ {
+ itemDataAttributes.BackgroundColor = value.Clone() as ColorSelector;
+ }
+ else
+ {
+ itemDataAttributes.BackgroundColor = value.Clone();
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// DropDown item text string.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Text
+ {
+ get
+ {
+ return itemDataAttributes.TextAttributes?.Text?.All;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (itemDataAttributes.TextAttributes.Text == null)
+ {
+ itemDataAttributes.TextAttributes.Text = new StringSelector { All = value };
+ }
+ else
+ {
+ itemDataAttributes.TextAttributes.Text.All = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// DropDown item text's point size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float PointSize
+ {
+ get
+ {
+ return itemDataAttributes.TextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (itemDataAttributes.TextAttributes.PointSize == null)
+ {
+ itemDataAttributes.TextAttributes.PointSize = new FloatSelector { All = value };
+ }
+ else
+ {
+ itemDataAttributes.TextAttributes.PointSize.All = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// DropDown item text's font family.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get
+ {
+ return itemDataAttributes.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateTextAttributes();
+ itemDataAttributes.TextAttributes.FontFamily = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item text's position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Position2D TextPosition2D
+ {
+ get
+ {
+ return itemDataAttributes.TextAttributes?.Position2D;
+ }
+ set
+ {
+ CreateTextAttributes();
+ itemDataAttributes.TextAttributes.Position2D = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's icon's resource url.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IconResourceUrl
+ {
+ get
+ {
+ return itemDataAttributes.IconAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateIconAttributes();
+ if (itemDataAttributes.IconAttributes.ResourceUrl == null)
+ {
+ itemDataAttributes.IconAttributes.ResourceUrl = new StringSelector { All = value };
+ }
+ else
+ {
+ itemDataAttributes.IconAttributes.ResourceUrl.All = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's icon's size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D IconSize2D
+ {
+ get
+ {
+ return itemDataAttributes.IconAttributes?.Size2D;
+ }
+ set
+ {
+ CreateIconAttributes();
+ itemDataAttributes.IconAttributes.Size2D = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's icon's position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Position2D IconPosition2D
+ {
+ get
+ {
+ return itemDataAttributes.IconAttributes.Position2D;
+ }
+ set
+ {
+ CreateIconAttributes();
+ itemDataAttributes.IconAttributes.Position2D = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's check image's resource url.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string CheckImageResourceUrl
+ {
+ get
+ {
+ return itemDataAttributes.CheckImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ if (itemDataAttributes.CheckImageAttributes.ResourceUrl == null)
+ {
+ itemDataAttributes.CheckImageAttributes.ResourceUrl = new StringSelector { All = value };
+ }
+ else
+ {
+ itemDataAttributes.CheckImageAttributes.ResourceUrl.All = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's check image's size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D CheckImageSize2D
+ {
+ get
+ {
+ return itemDataAttributes.CheckImageAttributes?.Size2D;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ itemDataAttributes.CheckImageAttributes.Size2D = value;
+ }
+ }
+
+ /// <summary>
+ /// DropDown item's check image's right space.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImageRightSpace
+ {
+ get
+ {
+ return itemDataAttributes.CheckImageRightSpace;
+ }
+ set
+ {
+ itemDataAttributes.CheckImageRightSpace = value;
+ }
+ }
+
+ /// <summary>
+ /// Flag to decide DropDown item is selected or not.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelected
+ {
+ get
+ {
+ return itemDataAttributes.IsSelected;
+ }
+ set
+ {
+ itemDataAttributes.IsSelected = value;
+ }
+ }
+
+ private void Initalize()
+ {
+ if (itemDataAttributes == null)
+ {
+ throw new Exception("Button attribute parse error.");
+ }
+ }
+
+ private void CreateTextAttributes()
+ {
+ if(itemDataAttributes.TextAttributes == null)
+ {
+ itemDataAttributes.TextAttributes = new TextAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ };
+ }
+ }
+
+ private void CreateIconAttributes()
+ {
+ if (itemDataAttributes.IconAttributes == null)
+ {
+ itemDataAttributes.IconAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+
+ private void CreateCheckImageAttributes()
+ {
+ if (itemDataAttributes.CheckImageAttributes == null)
+ {
+ itemDataAttributes.CheckImageAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+ }
+ #endregion
+
+ #region DropDownItemView
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal class DropDownItemView : Control
+ {
+ private TextLabel mText = null;
+ private ImageView mIcon = null;
+ private ImageView mCheck = null;
+
+ /// 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 DropDownItemView() : base()
+ {
+ }
+
+ /// 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 ColorSelector BackgroundColorSelector
+ {
+ get;
+ set;
+ }
+
+ /// 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 string Text
+ {
+ get
+ {
+ if(mText == null)
+ {
+ return null;
+ }
+ return mText.Text;
+ }
+ set
+ {
+ CreateText();
+ mText.Text = value;
+ }
+ }
+
+ /// 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 string FontFamily
+ {
+ get
+ {
+ if (mText == null)
+ {
+ return null;
+ }
+ return mText.FontFamily;
+ }
+ set
+ {
+ CreateText();
+ mText.FontFamily = value;
+ }
+ }
+
+ /// 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 float PointSize
+ {
+ get
+ {
+ if (mText == null)
+ {
+ return 0;
+ }
+ return mText.PointSize;
+ }
+ set
+ {
+ CreateText();
+ mText.PointSize = value;
+ }
+ }
+
+ /// 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 Color TextColor
+ {
+ get
+ {
+ if (mText == null)
+ {
+ return null;
+ }
+ return mText.TextColor;
+ }
+ set
+ {
+ CreateText();
+ mText.TextColor = value;
+ }
+ }
+
+ /// 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 Position2D TextPosition2D
+ {
+ get
+ {
+ if (mText == null)
+ {
+ return null;
+ }
+ return mText.Position2D;
+ }
+ set
+ {
+ CreateText();
+ mText.Position2D = value;
+ }
+ }
+
+ /// 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 string IconResourceUrl
+ {
+ get
+ {
+ if (mIcon == null)
+ {
+ return null;
+ }
+ return mIcon.ResourceUrl;
+ }
+ set
+ {
+ CreateIcon();
+ mIcon.ResourceUrl = value;
+ }
+ }
+
+ /// 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 Size2D IconSize2D
+ {
+ get
+ {
+ if (mIcon == null)
+ {
+ return null;
+ }
+ return mIcon.Size2D;
+ }
+ set
+ {
+ CreateIcon();
+ mIcon.Size2D = value;
+ }
+ }
+
+ /// 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 Position2D IconPosition2D
+ {
+ get
+ {
+ if (mIcon == null)
+ {
+ return null;
+ }
+ return mIcon.Position2D;
+ }
+ set
+ {
+ CreateIcon();
+ mIcon.Position2D = value;
+ }
+ }
+
+ /// 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 string CheckResourceUrl
+ {
+ get
+ {
+ if (mCheck == null)
+ {
+ return null;
+ }
+ return mCheck.ResourceUrl;
+ }
+ set
+ {
+ CreateCheckImage();
+ mCheck.ResourceUrl = value;
+ }
+ }
+
+ /// 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 Position2D CheckPosition2D
+ {
+ get
+ {
+ if (mCheck == null)
+ {
+ return null;
+ }
+ return mCheck.Position2D;
+ }
+ set
+ {
+ CreateCheckImage();
+ mCheck.Position2D = value;
+ }
+ }
+
+ /// 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 Size2D CheckImageSize2D
+ {
+ get
+ {
+ if (mCheck == null)
+ {
+ return null;
+ }
+ return mCheck.Size2D;
+ }
+ set
+ {
+ CreateCheckImage();
+ mCheck.Size2D = value;
+ }
+ }
+
+ /// 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 bool IsSelected
+ {
+ get
+ {
+ if (mCheck == null)
+ {
+ return false;
+ }
+ return mCheck.Visibility;
+ }
+ set
+ {
+ CreateCheckImage();
+ if(value)
+ {
+ mCheck.Show();
+ }
+ else
+ {
+ mCheck.Hide();
+ }
+ }
+ }
+
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (mText != null)
+ {
+ Remove(mText);
+ mText.Dispose();
+ mText = null;
+ }
+
+ if (mIcon != null)
+ {
+ Remove(mIcon);
+ mIcon.Dispose();
+ mIcon = null;
+ }
+
+ if (mCheck != null)
+ {
+ Remove(mCheck);
+ mCheck.Dispose();
+ mCheck = null;
+ }
+ }
+ base.Dispose(type);
+ }
+
+ /// 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 override Attributes GetAttributes()
+ {
+ return null;
+ }
+
+ private void CreateIcon()
+ {
+ if(mIcon == null)
+ {
+ mIcon = new ImageView()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ Add(mIcon);
+ }
+ }
+
+ private void CreateText()
+ {
+ if (mText == null)
+ {
+ mText = new TextLabel()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ };
+ Add(mText);
+ }
+ }
+
+ private void CreateCheckImage()
+ {
+ if (mCheck == null)
+ {
+ mCheck = new ImageView()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ Add(mCheck);
+ }
+ mCheck.Hide();
+ }
+ }
+ #endregion
+
+ #region DropDownListBridge
+
+ /// <summary>
+ /// DropDownListBridge is bridge to contact item data and item view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class DropDownListBridge : FlexibleView.Adapter
+ {
+ private List<DropDownItemData> mDatas = new List<DropDownItemData>();
+
+ /// <summary>
+ /// Creates a new instance of a DropDownListBridge.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownListBridge()
+ {
+ }
+
+ /// <summary>
+ /// Insert data. The inserted data will be added to the special position by index automatically.
+ /// </summary>
+ /// <param name="position">Position index where will be inserted.</param>
+ /// <param name="data">Item data which will apply to tab item view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InsertData(int position, DropDownItemData data)
+ {
+ if(position == -1)
+ {
+ position = mDatas.Count;
+ }
+ mDatas.Insert(position, data);
+ NotifyItemInserted(position);
+ }
+
+ /// <summary>
+ /// Remove data by position.
+ /// </summary>
+ /// <param name="position">Position index where will be removed.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RemoveData(int position)
+ {
+ mDatas.RemoveAt(position);
+ NotifyItemRemoved(position);
+ }
+
+ /// <summary>
+ /// Get data by position.
+ /// </summary>
+ /// <param name="position">Position index where will be gotten.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DropDownItemData GetData(int position)
+ {
+ return mDatas[position];
+ }
+
+ /// <summary>
+ /// Get view holder by view type.
+ /// </summary>
+ /// <param name="viewType">Create item view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override FlexibleView.ViewHolder OnCreateViewHolder(int viewType)
+ {
+ FlexibleView.ViewHolder viewHolder = new FlexibleView.ViewHolder(new DropDownItemView());
+
+ return viewHolder;
+ }
+
+ /// <summary>
+ /// Binder view holder, it can be override.
+ /// </summary>
+ /// <param name="holder">View holder.</param>
+ /// <param name="position">Position index where will be gotten.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnBindViewHolder(FlexibleView.ViewHolder holder, int position)
+ {
+ DropDownItemData listItemData = mDatas[position];
+ if(listItemData == null)
+ {
+ return;
+ }
+ DropDownItemView listItemView = holder.ItemView as DropDownItemView;
+ listItemView.Name = "Item" + position;
+ if (listItemData.Size2D != null)
+ {
+ holder.ItemView.Size2D = listItemData.Size2D;
+ }
+
+ if (listItemView != null)
+ {
+ listItemView.BackgroundColorSelector = listItemData.BackgroundColorSelector;
+ if (listItemData.Text != null)
+ {
+ listItemView.Text = listItemData.Text;
+ listItemView.PointSize = listItemData.PointSize;
+ listItemView.FontFamily = listItemData.FontFamily;
+ listItemView.TextPosition2D = listItemData.TextPosition2D;
+ }
+
+ if (listItemData.IconResourceUrl != null)
+ {
+ listItemView.IconResourceUrl = listItemData.IconResourceUrl;
+ listItemView.IconSize2D = listItemData.IconSize2D;
+ listItemView.IconPosition2D = new Position2D(listItemData.IconPosition2D.X, (listItemView.Size2D.Height - listItemView.IconSize2D.Height) / 2);
+ }
+
+ if (listItemData.CheckImageResourceUrl != null)
+ {
+ listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
+ listItemView.CheckImageSize2D = listItemData.CheckImageSize2D;
+ listItemView.CheckPosition2D = new Position2D(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize2D.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize2D.Height) / 2);
+ }
+
+ listItemView.IsSelected = listItemData.IsSelected;
+ }
+ }
+
+ /// <summary>
+ /// Destroy view holder, it can be override.
+ /// </summary>
+ /// <param name="holder">View holder.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnDestroyViewHolder(FlexibleView.ViewHolder holder)
+ {
+ if (holder.ItemView != null)
+ {
+ holder.ItemView.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Get item count, it can be override.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override int GetItemCount()
+ {
+ return mDatas.Count;
+ }
+ }
+ #endregion
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// A flexible view for providing a limited window into a large data set.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class FlexibleView : Control
+ {
+ /// <summary>
+ /// Constant value: -1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int NO_POSITION = -1;
+ /// <summary>
+ /// Constant value: -1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int INVALID_TYPE = -1;
+
+ private Adapter mAdapter;
+ private LayoutManager mLayout;
+ private Recycler mRecycler;
+ private RecycledViewPool mRecyclerPool;
+ private ChildHelper mChildHelper;
+
+ private PanGestureDetector mPanGestureDetector;
+
+ private int mFocusedItemIndex = NO_POSITION;
+
+ private AdapterHelper mAdapteHelper;
+
+ private ScrollBar mScrollBar = null;
+ private Timer mScrollBarShowTimer = null;
+
+ private EventHandler<ItemClickEventArgs> clickEventHandlers;
+ private EventHandler<ItemTouchEventArgs> touchEventHandlers;
+
+ /// <summary>
+ /// Creates a FlexibleView instance.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FlexibleView()
+ {
+ mRecyclerPool = new RecycledViewPool(this);
+
+ mRecycler = new Recycler(this);
+ mRecycler.SetRecycledViewPool(mRecyclerPool);
+
+ mChildHelper = new ChildHelper(this);
+
+ mPanGestureDetector = new PanGestureDetector();
+ mPanGestureDetector.Attach(this);
+ mPanGestureDetector.Detected += OnPanGestureDetected;
+
+ mAdapteHelper = new AdapterHelper(this);
+
+ ClippingMode = ClippingModeType.ClipToBoundingBox;
+ }
+
+ /// <summary>
+ /// Item click event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ItemClickEventArgs> ItemClickEvent
+ {
+ add
+ {
+ clickEventHandlers += value;
+ }
+
+ remove
+ {
+ clickEventHandlers -= value;
+ }
+ }
+
+
+ /// <summary>
+ /// Item touch event.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ItemTouchEventArgs> ItemTouchEvent
+ {
+ add
+ {
+ touchEventHandlers += value;
+ }
+
+ remove
+ {
+ touchEventHandlers -= value;
+ }
+ }
+
+ /// <summary>
+ /// overwrite the Padding.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 new Extents Padding
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the focused item index(adapter position).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FocusedItemIndex
+ {
+ get
+ {
+ return mFocusedItemIndex;
+ }
+ set
+ {
+ if (value == mFocusedItemIndex)
+ {
+ return;
+ }
+
+ if (mAdapter == null)
+ {
+ return;
+ }
+
+ if (mLayout == null)
+ {
+ return;
+ }
+
+ ViewHolder nextFocusView = FindViewHolderForAdapterPosition(value);
+ if (nextFocusView == null)
+ {
+ mLayout.ScrollToPosition(value);
+ }
+ else
+ {
+ mLayout.RequestChildRectangleOnScreen(this, nextFocusView, mRecycler, true);
+ DispatchFocusChanged(value);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Set a new adapter to provide child views on demand.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SetAdapter(Adapter adapter)
+ {
+ if (adapter == null)
+ {
+ return;
+ }
+ mAdapter = adapter;
+
+ mAdapter.ItemEvent += OnItemEvent;
+ }
+
+ /// <summary>
+ /// Retrieves the previously set adapter or null if no adapter is set.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Adapter GetAdapter()
+ {
+ return mAdapter;
+ }
+
+ /// <summary>
+ /// Set the FlexibleView.LayoutManager that this FlexibleView will use.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SetLayoutManager(LayoutManager layoutManager)
+ {
+ mLayout = layoutManager;
+
+ mLayout.SetRecyclerView(this);
+
+ if (mLayout.CanScrollHorizontally())
+ {
+ mPanGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
+ }
+ else if (mLayout.CanScrollVertically())
+ {
+ mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
+ }
+ }
+
+ /// <summary>
+ /// Return the FlexibleView.LayoutManager currently responsible for layout policy for this FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 LayoutManager GetLayoutManager()
+ {
+ return mLayout;
+ }
+
+
+ /// <summary>
+ /// Convenience method to scroll to a certain position
+ /// </summary>
+ /// <param name="position">Adapter position</param>
+ /// <param name="offset">The distance (in pixels) between the start edge of the item view and start edge of the FlexibleView.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollToPositionWithOffset(int position, int offset)
+ {
+ mLayout.ScrollToPositionWithOffset(position, offset);
+ }
+
+ /// <summary>
+ /// Move focus by direction.
+ /// </summary>
+ /// <param name="direction">Direction. Should be "Left", "Right", "Up" or "Down" </param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 MoveFocus(FlexibleView.LayoutManager.Direction direction)
+ {
+ mLayout.MoveFocus(direction, mRecycler);
+ }
+
+ /// <summary>
+ /// Attach a scrollbar to this FlexibleView.
+ /// </summary>
+ /// <param name="scrollBar">ScrollBar</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AttachScrollBar(ScrollBar scrollBar)
+ {
+ if (scrollBar == null)
+ {
+ return;
+ }
+ mScrollBar = scrollBar;
+ Add(mScrollBar);
+ }
+
+ /// <summary>
+ /// Detach the scrollbar from this FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DetachScrollBar()
+ {
+ if (mScrollBar == null)
+ {
+ return;
+ }
+ Remove(mScrollBar);
+ mScrollBar = null;
+ }
+
+ /// <summary>
+ /// Return the ViewHolder for the item in the given position of the data set as of the latest layout pass.
+ /// This method checks only the children of RecyclerView. If the item at the given position is not laid out, it will not create a new one.
+ /// </summary>
+ /// <param name="position">The position of the item in the data set of the adapter</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder FindViewHolderForLayoutPosition(int position)
+ {
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ if (mChildHelper.GetChildAt(i) is ViewHolder holder)
+ {
+ if (holder.LayoutPosition == position)
+ {
+ return holder;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Return the ViewHolder for the item in the given position of the data set.
+ /// This method checks only the children of RecyclerView. If the item at the given position is not laid out, it will not create a new one.
+ /// </summary>
+ /// <param name="position">The position of the item in the data set of the adapter</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder FindViewHolderForAdapterPosition(int position)
+ {
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ if (mChildHelper.GetChildAt(i) is ViewHolder holder)
+ {
+ if (holder.AdapterPosition == position)
+ {
+ return holder;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// you can override it to clean-up your own resources.
+ /// </summary>
+ /// <param name="type">DisposeTypes</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (mAdapter != null)
+ {
+ mAdapter.ItemEvent -= OnItemEvent;
+ }
+
+ if (mPanGestureDetector != null)
+ {
+ mPanGestureDetector.Detected -= OnPanGestureDetected;
+ mPanGestureDetector.Dispose();
+ mPanGestureDetector = null;
+ }
+
+ if (mScrollBarShowTimer != null)
+ {
+ mScrollBarShowTimer.Tick -= OnShowTimerTick;
+ mScrollBarShowTimer.Stop();
+ mScrollBarShowTimer.Dispose();
+ mScrollBarShowTimer = null;
+ }
+
+ if (mRecyclerPool != null)
+ {
+ mRecyclerPool.Clear();
+ mRecyclerPool = null;
+ }
+
+ if (mChildHelper != null)
+ {
+ mChildHelper.Clear();
+ mChildHelper = null;
+ }
+ }
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// you can override it to create your own default attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// you can override it to relayout elements.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnRelayout(Vector2 size, RelayoutContainer container)
+ {
+ if (mAdapter == null)
+ {
+ return;
+ }
+
+ if (mLayout == null)
+ {
+ return;
+ }
+
+ DispatchLayoutStep1();
+
+ mLayout.OnLayoutChildren(mRecycler);
+
+ RemoveAndRecycleScrapInt();
+ }
+
+ private void DispatchLayoutStep1()
+ {
+ ProcessAdapterUpdates();
+ SaveOldPositions();
+ ClearOldPositions();
+ }
+
+ private void ProcessAdapterUpdates()
+ {
+ mAdapteHelper.PreProcess();
+ }
+
+ private void OffsetPositionRecordsForInsert(int positionStart, int itemCount)
+ {
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ ViewHolder holder = mChildHelper.GetChildAt(i);
+ if (holder != null && holder.AdapterPosition >= positionStart)
+ {
+ holder.OffsetPosition(itemCount, false);
+ }
+ }
+
+ if (positionStart <= mFocusedItemIndex)
+ {
+ mFocusedItemIndex += itemCount;
+ }
+ }
+
+ private void OffsetPositionRecordsForRemove(int positionStart, int itemCount, bool applyToPreLayout)
+ {
+ int positionEnd = positionStart + itemCount;
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ ViewHolder holder = mChildHelper.GetChildAt(i);
+ if (holder != null)
+ {
+ if (holder.AdapterPosition >= positionEnd)
+ {
+ holder.OffsetPosition(-itemCount, applyToPreLayout);
+ }
+ else if (holder.AdapterPosition >= positionStart)
+ {
+ holder.FlagRemovedAndOffsetPosition(positionStart - 1, -itemCount, applyToPreLayout);
+ }
+ }
+ }
+
+ if (positionEnd <= mFocusedItemIndex)
+ {
+ mFocusedItemIndex -= itemCount;
+ }
+ else if (positionStart <= mFocusedItemIndex)
+ {
+ mFocusedItemIndex = positionStart;
+ if (mFocusedItemIndex >= mAdapter.GetItemCount())
+ {
+ mFocusedItemIndex = mAdapter.GetItemCount() - 1;
+ }
+ }
+ }
+
+ private void SaveOldPositions()
+ {
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ ViewHolder holder = mChildHelper.GetChildAt(i);
+ holder.SaveOldPosition();
+ }
+ }
+
+ private void ClearOldPositions()
+ {
+ int childCount = mChildHelper.GetChildCount();
+ for (int i = 0; i < childCount; i++)
+ {
+ ViewHolder holder = mChildHelper.GetChildAt(i);
+ holder.ClearOldPosition();
+ }
+ }
+
+ private void RemoveAndRecycleScrapInt()
+ {
+ int scrapCount = mRecycler.GetScrapCount();
+ for (int i = 0; i < scrapCount; i++)
+ {
+ ViewHolder scrap = mRecycler.GetScrapViewAt(i);
+ mChildHelper.RemoveView(scrap);
+ mRecycler.RecycleView(scrap);
+ }
+ mRecycler.Clear();
+ }
+
+ private void ShowScrollBar(uint millisecond = 700, bool flagAni = false)
+ {
+ if (mScrollBar == null || mLayout == null)
+ {
+ return;
+ }
+
+ float extent = mLayout.ComputeScrollExtent();
+ float range = mLayout.ComputeScrollRange();
+ if(range == 0)
+ {
+ return;
+ }
+ float offset = mLayout.ComputeScrollOffset();
+
+ float size = mScrollBar.Direction == ScrollBar.DirectionType.Vertical ? mScrollBar.SizeHeight : mScrollBar.SizeWidth;
+ float thickness = mScrollBar.Direction == ScrollBar.DirectionType.Vertical ? mScrollBar.SizeWidth : mScrollBar.SizeHeight;
+ float length = (float)Math.Round(size * extent / range);
+
+ // avoid the tiny thumb
+ float minLength = thickness * 2;
+ if (length < minLength)
+ {
+ length = minLength;
+ }
+ // avoid the too-big thumb
+ if (offset > range - extent)
+ {
+ offset = range - extent;
+ }
+ if (mScrollBar.Direction == ScrollBar.DirectionType.Vertical)
+ {
+ mScrollBar.ThumbSize = new Size2D((int)thickness, (int)length);
+ }
+ else
+ {
+ mScrollBar.ThumbSize = new Size2D((int)length, (int)thickness);
+ }
+ mScrollBar.MinValue = 0;
+ mScrollBar.MaxValue = (int)(range - extent);
+ mScrollBar.SetCurrentValue((int)offset, flagAni);
+ mScrollBar.Show();
+ if (mScrollBarShowTimer == null)
+ {
+ mScrollBarShowTimer = new Timer(millisecond);
+ mScrollBarShowTimer.Tick += OnShowTimerTick;
+ }
+ else
+ {
+ mScrollBarShowTimer.Interval = millisecond;
+ }
+ mScrollBarShowTimer.Start();
+ }
+
+ private bool OnShowTimerTick(object source, EventArgs e)
+ {
+ if (mScrollBar != null)
+ {
+ mScrollBar.Hide();
+ }
+
+ return false;
+ }
+
+ private void DispatchFocusChanged(int nextFocusPosition)
+ {
+ mAdapter.OnFocusChange(this, mFocusedItemIndex, nextFocusPosition);
+
+ mFocusedItemIndex = nextFocusPosition;
+
+ ShowScrollBar();
+ }
+
+ private void DispatchChildAttached(ViewHolder holder)
+ {
+ if (mAdapter != null && holder != null)
+ {
+ mAdapter.OnViewAttachedToWindow(holder);
+ }
+ }
+
+ private void DispatchChildDetached(ViewHolder holder)
+ {
+ if (mAdapter != null && holder != null)
+ {
+ mAdapter.OnViewDetachedFromWindow(holder);
+ }
+ }
+
+ private void DispatchChildDestroyed(ViewHolder holder)
+ {
+ if (mAdapter != null && holder != null)
+ {
+ mAdapter.OnDestroyViewHolder(holder);
+ }
+ }
+
+ private void DispatchItemClicked(ViewHolder clickedHolder)
+ {
+ ItemClickEventArgs args = new ItemClickEventArgs();
+ args.ClickedView = clickedHolder;
+ OnClickEvent(this, args);
+ }
+
+ private void DispatchItemTouched(ViewHolder touchedHolder, Touch touchEvent)
+ {
+ ItemTouchEventArgs args = new ItemTouchEventArgs();
+ args.TouchedView = touchedHolder;
+ args.Touch = touchEvent;
+ OnTouchEvent(this, args);
+ }
+
+ private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
+ {
+ if (e.PanGesture.State == Gesture.StateType.Started)
+ {
+ mLayout.StopScroll();
+ }
+ else if (e.PanGesture.State == Gesture.StateType.Continuing)
+ {
+ if (mLayout.CanScrollVertically())
+ {
+ mLayout.ScrollVerticallyBy(e.PanGesture.Displacement.Y, mRecycler, true);
+ }
+ else if (mLayout.CanScrollHorizontally())
+ {
+ mLayout.ScrollHorizontallyBy(e.PanGesture.Displacement.X, mRecycler, true);
+ }
+
+ ShowScrollBar();
+ }
+ else if (e.PanGesture.State == Gesture.StateType.Finished)
+ {
+ if (mLayout.CanScrollVertically())
+ {
+ mLayout.ScrollVerticallyBy(e.PanGesture.Velocity.Y * 600, mRecycler, false);
+ }
+ else if (mLayout.CanScrollHorizontally())
+ {
+ mLayout.ScrollHorizontallyBy(e.PanGesture.Velocity.X * 600, mRecycler, false);
+ }
+ ShowScrollBar(1200, true);
+ }
+ }
+
+
+ private void OnItemEvent(object sender, Adapter.ItemEventArgs e)
+ {
+ switch (e.EventType)
+ {
+ case Adapter.ItemEventType.Insert:
+ mAdapteHelper.OnItemRangeInserted(e.param[0], e.param[1]);
+ ShowScrollBar();
+ break;
+ case Adapter.ItemEventType.Remove:
+ mAdapteHelper.OnItemRangeRemoved(e.param[0], e.param[1]);
+ ShowScrollBar();
+ break;
+ case Adapter.ItemEventType.Move:
+ break;
+ case Adapter.ItemEventType.Change:
+ break;
+ default:
+ return;
+ }
+ RelayoutRequest();
+ }
+
+
+ private void OnClickEvent(object sender, ItemClickEventArgs e)
+ {
+ clickEventHandlers?.Invoke(sender, e);
+ }
+
+ private void OnTouchEvent(object sender, ItemTouchEventArgs e)
+ {
+ touchEventHandlers?.Invoke(sender, e);
+ }
+
+ /// <summary>
+ /// ItemClick Event Arguments.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ItemClickEventArgs : EventArgs
+ {
+ /// <summary>
+ /// The clicked ViewHolder.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder ClickedView;
+ }
+
+ /// <summary>
+ /// ItemTouch Event Arguments.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ItemTouchEventArgs : TouchEventArgs
+ {
+ /// <summary>
+ /// The touched ViewHolder.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder TouchedView;
+ }
+
+ /// <summary>
+ /// Adapters provide a binding from an app-specific data set to views that are displayed within a FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract class Adapter
+ {
+ private EventHandler<ItemEventArgs> itemEventHandlers;
+
+ internal event EventHandler<ItemEventArgs> ItemEvent
+ {
+ add
+ {
+ itemEventHandlers += value;
+ }
+
+ remove
+ {
+ itemEventHandlers -= value;
+ }
+ }
+
+ internal enum ItemEventType
+ {
+ Insert = 0,
+ Remove,
+ Move,
+ Change
+ }
+
+ /// <summary>
+ /// Called when FlexibleView needs a new FlexibleView.ViewHolder of the given type to represent an item.
+ /// </summary>
+ /// <param name="viewType">The view type of the new View</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract ViewHolder OnCreateViewHolder(int viewType);
+
+ /// <summary>
+ /// Called by FlexibleView to display the data at the specified position.
+ /// </summary>
+ /// <param name="holder">The ViewHolder which should be updated to represent the contents of the item at the given position in the data set.</param>
+ /// <param name="position">The position of the item within the adapter's data set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract void OnBindViewHolder(ViewHolder holder, int position);
+
+ /// <summary>
+ /// Called when a ViewHolder is never used.
+ /// </summary>
+ /// <param name="holder">The ViewHolder which need to be disposed</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract void OnDestroyViewHolder(ViewHolder holder);
+
+ /// <summary>
+ /// Returns the total number of items in the data set held by the adapter.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract int GetItemCount();
+
+ /// <summary>
+ /// Return the view type of the item at position for the purposes of view recycling.
+ /// </summary>
+ /// <param name="position">The position of the item within the adapter's data set.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual int GetItemViewType(int position)
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Called by FlexibleView when it starts observing this Adapter.
+ /// Keep in mind that same adapter may be observed by multiple FlexibleView.
+ /// </summary>
+ /// <param name="flexibleView">The FlexibleView instance which started observing this adapter.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnAttachedToRecyclerView(FlexibleView flexibleView)
+ {
+ }
+
+ /// <summary>
+ /// Called by FlexibleView when it stops observing this Adapter.
+ /// </summary>
+ /// <param name="flexibleView">The FlexibleView instance which stopped observing this adapter.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnDetachedFromRecyclerView(FlexibleView flexibleView)
+ {
+ }
+
+ /// <summary>
+ /// Called when FlexibleView focus changed.
+ /// </summary>
+ /// <param name="flexibleView">The FlexibleView into which the focus ViewHolder changed.</param>
+ /// <param name="previousFocus">The position of previous focus</param>
+ /// <param name="currentFocus">The position of current focus</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnFocusChange(FlexibleView flexibleView, int previousFocus, int currentFocus)
+ {
+ }
+
+ /// <summary>
+ /// Called when a view created by this adapter has been recycled.
+ /// If an item view has large or expensive data bound to it such as large bitmaps, this may be a good place to release those resources
+ /// </summary>
+ /// <param name="holder">The ViewHolder will be recycled.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnViewRecycled(ViewHolder holder)
+ {
+ }
+
+ /// <summary>
+ /// Called when a view created by this adapter has been attached to a window.
+ /// This can be used as a reasonable signal that the view is about to be seen by the user.
+ /// </summary>
+ /// <param name="holder">Holder of the view being attached.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnViewAttachedToWindow(ViewHolder holder)
+ {
+ }
+
+ /// <summary>
+ /// Called when a view created by this adapter has been detached from its window.
+ /// </summary>
+ /// <param name="holder">Holder of the view being detached.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnViewDetachedFromWindow(ViewHolder holder)
+ {
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the data set has changed.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyDataSetChanged()
+ {
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the data set has changed.
+ /// It indicates that any reflection of the data at position is out of date and should be updated.
+ /// </summary>
+ /// <param name="position">Position of the item that has changed</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemChanged(int position)
+ {
+ ItemEventArgs args = new ItemEventArgs
+ {
+ EventType = ItemEventType.Change,
+ };
+ args.param[0] = position;
+ args.param[1] = 1;
+ OnItemEvent(this, args);
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the itemCount items starting at position positionStart have changed.
+ /// An optional payload can be passed to each changed item.
+ /// </summary>
+ /// <param name="positionStart">Position of the first item that has changed</param>
+ /// <param name="itemCount">Number of items that have changed</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemRangeChanged(int positionStart, int itemCount)
+ {
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the data set has been newly inserted.
+ /// It indicates that any reflection of the data at position is out of date and should be updated.
+ /// </summary>
+ /// <param name="position">Position of the item that has been newly inserted</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemInserted(int position)
+ {
+ NotifyItemRangeInserted(position, 1);
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the itemCount items starting at position positionStart have been newly inserted.
+ /// </summary>
+ /// <param name="positionStart">Position of the first item that was inserted</param>
+ /// <param name="itemCount">Number of items inserted</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemRangeInserted(int positionStart, int itemCount)
+ {
+ ItemEventArgs args = new ItemEventArgs
+ {
+ EventType = ItemEventType.Insert,
+ };
+ args.param[0] = positionStart;
+ args.param[1] = itemCount;
+ OnItemEvent(this, args);
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the item previously located at position has been removed from the data set.
+ /// </summary>
+ /// <param name="position">Previous position of the first item that was removed</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemRemoved(int position)
+ {
+ NotifyItemRangeRemoved(position, 1);
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the itemCount items previously located at positionStart have been removed from the data set.
+ /// </summary>
+ /// <param name="positionStart">Previous position of the first item that was removed</param>
+ /// <param name="itemCount">Number of items removed from the data set </param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemRangeRemoved(int positionStart, int itemCount)
+ {
+ ItemEventArgs args = new ItemEventArgs
+ {
+ EventType = ItemEventType.Remove,
+ };
+ args.param[0] = positionStart;
+ args.param[1] = itemCount;
+ OnItemEvent(this, args);
+ }
+
+ /// <summary>
+ /// Notify any registered observers that the item reflected at fromPosition has been moved to toPosition.
+ /// </summary>
+ /// <param name="fromPosition">Previous position of the item</param>
+ /// <param name="toPosition">New position of the item. </param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 NotifyItemMoved(int fromPosition, int toPosition)
+ {
+
+ }
+
+ private void OnItemEvent(object sender, ItemEventArgs e)
+ {
+ itemEventHandlers?.Invoke(sender, e);
+ }
+
+ internal class ItemEventArgs : EventArgs
+ {
+
+ /// <summary>
+ /// Data change event parameters.
+ /// </summary>
+ public int[] param = new int[4];
+
+ /// <summary>
+ /// Data changed event type.
+ /// </summary>
+ public ItemEventType EventType
+ {
+ get;
+ set;
+ }
+ }
+ }
+
+ /// <summary>
+ /// A LayoutManager is responsible for measuring and positioning item views within a FlexibleView
+ /// as well as determining the policy for when to recycle item views that are no longer visible to the user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract class LayoutManager
+ {
+ /// <summary>
+ /// Direction
+ /// </summary>
+ public enum Direction
+ {
+ /// <summary>
+ /// Left
+ /// </summary>
+ Left,
+
+ /// <summary>
+ /// Right
+ /// </summary>
+ Right,
+
+ /// <summary>
+ /// Up
+ /// </summary>
+ Up,
+
+ /// <summary>
+ /// Down
+ /// </summary>
+ Down
+ }
+
+ private FlexibleView mFlexibleView;
+ private ChildHelper mChildHelper;
+
+ private List<ViewHolder> mPendingRecycleViews = new List<ViewHolder>();
+
+ private Animation mScrollAni;
+
+ /// <summary>
+ /// Layout all relevant child views from the given adapter.
+ /// </summary>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract void OnLayoutChildren(Recycler recycler);
+
+ /// <summary>
+ /// Called after a full layout calculation is finished.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnLayoutCompleted()
+ {
+ }
+
+
+ /// <summary>
+ /// Gets the current focus position in adapter.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FocusPosition
+ {
+ get
+ {
+ return mFlexibleView.mFocusedItemIndex;
+ }
+ }
+
+ /// <summary>
+ /// Gets the datas count in data sets.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ItemCount
+ {
+ get
+ {
+ Adapter b = mFlexibleView != null ? mFlexibleView.mAdapter : null;
+
+ return b != null ? b.GetItemCount() : 0;
+ }
+ }
+
+ /// <summary>
+ /// Query if horizontal scrolling is currently supported. The default implementation returns false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual bool CanScrollHorizontally()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Query if vertical scrolling is currently supported. The default implementation returns false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual bool CanScrollVertically()
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Scroll horizontally by dy pixels in screen coordinates.
+ /// </summary>
+ /// <param name="dy">distance to scroll in pixels. Y increases as scroll position approaches the top.</param>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <param name="immediate">Specify if the scroll need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual float ScrollHorizontallyBy(float dy, Recycler recycler, bool immediate)
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Scroll vertically by dy pixels in screen coordinates.
+ /// </summary>
+ /// <param name="dy">distance to scroll in pixels. Y increases as scroll position approaches the top.</param>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <param name="immediate">Specify if the scroll need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual float ScrollVerticallyBy(float dy, Recycler recycler, bool immediate)
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Compute the extent of the scrollbar's thumb within the range.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual float ComputeScrollExtent()
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Compute the offset of the scrollbar's thumb within the range.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual float ComputeScrollOffset()
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Compute the range that the scrollbar represents.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual float ComputeScrollRange()
+ {
+ return 0;
+ }
+
+ /// <summary>
+ /// Scroll the FlexibleView to make the position visible.
+ /// </summary>
+ /// <param name="position">Scroll to this adapter position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void ScrollToPosition(int position)
+ {
+
+ }
+
+ /// <summary>
+ /// Scroll to the specified adapter position with the given offset from resolved layout start.
+ /// </summary>
+ /// <param name="position">Scroll to this adapter position</param>
+ /// <param name="offset">The distance (in pixels) between the start edge of the item view and start edge of the FlexibleView.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void ScrollToPositionWithOffset(int position, int offset)
+ {
+
+ }
+
+ internal void MoveFocus(FlexibleView.LayoutManager.Direction direction, Recycler recycler)
+ {
+ int prevFocusPosition = FocusPosition;
+ int nextFocusPosition = GetNextPosition(FocusPosition, direction);
+ if (nextFocusPosition == NO_POSITION)
+ {
+ return;
+ }
+
+ FlexibleView.ViewHolder nextFocusChild = FindItemViewByPosition(nextFocusPosition);
+ if (nextFocusChild == null)
+ {
+ nextFocusChild = OnFocusSearchFailed(null, direction, recycler);
+ }
+
+ if (nextFocusChild != null)
+ {
+ RequestChildRectangleOnScreen(mFlexibleView, nextFocusChild, recycler, false);
+
+ ChangeFocus(nextFocusPosition);
+ }
+ }
+
+ /**
+ * Requests that the given child of the RecyclerView be positioned onto the screen. This
+ * method can be called for both unfocusable and focusable child views. For unfocusable
+ * child views, focusedChildVisible is typically true in which case, layout manager
+ * makes the child view visible only if the currently focused child stays in-bounds of RV.
+ * @param parent The parent RecyclerView.
+ * @param child The direct child making the request.
+ * @param rect The rectangle in the child's coordinates the child
+ * wishes to be on the screen.
+ * @param immediate True to forbid animated or delayed scrolling,
+ * false otherwise
+ * @param focusedChildVisible Whether the currently focused view must stay visible.
+ * @return Whether the group scrolled to handle the operation
+ */
+ internal bool RequestChildRectangleOnScreen(FlexibleView parent, FlexibleView.ViewHolder child, Recycler recycler, bool immediate)
+ {
+ Vector2 scrollAmount = GetChildRectangleOnScreenScrollAmount(parent, child);
+ float dx = scrollAmount[0];
+ float dy = scrollAmount[1];
+ if (dx != 0 || dy != 0)
+ {
+ if (dx != 0 && CanScrollHorizontally())
+ {
+ ScrollHorizontallyBy(dx, recycler, immediate);
+ }
+ else if (dy != 0 && CanScrollVertically())
+ {
+ ScrollVerticallyBy(dy, recycler, immediate);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Calls {@code FlexibleView#RelayoutRequest} on the underlying FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RelayoutRequest()
+ {
+ if (mFlexibleView != null)
+ {
+ mFlexibleView.RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Lay out the given child view within the FlexibleView using coordinates that include view margins.
+ /// </summary>
+ /// <param name="child">Child to lay out</param>
+ /// <param name="left">Left edge, with item view left margin included</param>
+ /// <param name="top">Top edge, with item view top margin included</param>
+ /// <param name="width">Width, with item view left and right margin included</param>
+ /// <param name="height">Height, with item view top and bottom margin included</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 LayoutChild(ViewHolder child, float left, float top, float width, float height)
+ {
+ View itemView = child.ItemView;
+ itemView.SizeWidth = width - itemView.Margin.Start - itemView.Margin.End;
+ itemView.SizeHeight = height - itemView.Margin.Top - itemView.Margin.Bottom;
+ itemView.PositionX = left + itemView.Margin.Start;
+ itemView.PositionY = top + itemView.Margin.Top;
+ }
+
+ /// <summary>
+ /// Change the ViewHolder with focusPosition to focus.
+ /// </summary>
+ /// <param name="focusPosition">the newly focus position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ChangeFocus(int focusPosition)
+ {
+ if (mFlexibleView != null)
+ {
+ mFlexibleView.DispatchFocusChanged(focusPosition);
+ }
+ }
+
+ /// <summary>
+ /// Return the current number of child views attached to the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetChildCount()
+ {
+ return mChildHelper != null ? mChildHelper.GetChildCount() : 0;
+ }
+
+ /// <summary>
+ /// Return the child view at the given index.
+ /// </summary>
+ /// <param name="index">child index</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder GetChildAt(int index)
+ {
+ return mChildHelper != null ? mChildHelper.GetChildAt(index) : null;
+ }
+
+ /// <summary>
+ /// Finds the view which represents the given adapter position.
+ /// </summary>
+ /// <param name="position">adapter position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder FindItemViewByPosition(int position)
+ {
+ return mFlexibleView.FindViewHolderForLayoutPosition(position);
+ }
+
+ /// <summary>
+ /// Offset all child views attached to the parent FlexibleView by dx pixels along the horizontal axis.
+ /// </summary>
+ /// <param name="dx">Pixels to offset by </param>
+ /// <param name="immediate">specify if the offset need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 OffsetChildrenHorizontal(float dx, bool immediate)
+ {
+ if (mChildHelper == null)
+ {
+ return;
+ }
+
+ if (mScrollAni == null)
+ {
+ mScrollAni = new Animation();
+ mScrollAni.Finished += OnScrollAnimationFinished;
+ }
+ else if (mScrollAni.State == Animation.States.Playing)
+ {
+ //StopScroll();
+ mScrollAni.Stop();
+ }
+ mScrollAni.Duration = 2000;
+ mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
+
+ mScrollAni.Clear();
+
+ int childCount = mChildHelper.GetChildCount();
+ if (immediate == true)
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ v.ItemView.PositionX += dx;
+ }
+ }
+ else
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ mScrollAni.AnimateTo(v.ItemView, "PositionX", v.ItemView.PositionX + dx);
+ }
+ mScrollAni.Play();
+ }
+ }
+
+ /// <summary>
+ /// Offset all child views attached to the parent FlexibleView by dy pixels along the vertical axis.
+ /// </summary>
+ /// <param name="dy">Pixels to offset by </param>
+ /// <param name="immediate">specify if the offset need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 OffsetChildrenVertical(float dy, bool immediate)
+ {
+ if (mChildHelper == null)
+ {
+ return;
+ }
+
+ if (mScrollAni == null)
+ {
+ mScrollAni = new Animation();
+ mScrollAni.Finished += OnScrollAnimationFinished;
+ }
+ else if (mScrollAni.State == Animation.States.Playing)
+ {
+ //StopScroll();
+ mScrollAni.Stop();
+ }
+ mScrollAni.Duration = 2000;
+ mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
+
+ mScrollAni.Clear();
+
+ int childCount = mChildHelper.GetChildCount();
+ if (immediate == true)
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ v.ItemView.PositionY += dy;
+ }
+ }
+ else
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ mScrollAni.AnimateTo(v.ItemView, "PositionY", v.ItemView.PositionY + dy);
+ }
+ mScrollAni.Play();
+ }
+ }
+
+ /// <summary>
+ /// Return the width of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float GetWidth()
+ {
+ return mFlexibleView != null ? mFlexibleView.SizeWidth : 0;
+ }
+
+ /// <summary>
+ /// Return the height of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float GetHeight()
+ {
+ return mFlexibleView != null ? mFlexibleView.SizeHeight : 0;
+ }
+
+ /// <summary>
+ /// Return the left padding of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetPaddingLeft()
+ {
+ return mFlexibleView != null ? mFlexibleView.Padding.Start : 0;
+ }
+
+ /// <summary>
+ /// Return the top padding of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetPaddingTop()
+ {
+ return mFlexibleView != null ? mFlexibleView.Padding.Top : 0;
+ }
+
+ /// <summary>
+ /// Return the right padding of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetPaddingRight()
+ {
+ return mFlexibleView != null ? mFlexibleView.Padding.End : 0;
+ }
+
+ /// <summary>
+ /// Return the bottom padding of the parent FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetPaddingBottom()
+ {
+ return mFlexibleView != null ? mFlexibleView.Padding.Bottom : 0;
+ }
+
+ /// <summary>
+ /// Add a view to the currently attached FlexibleView if needed.<br />
+ /// LayoutManagers should use this method to add views obtained from a FlexibleView.Recycler using getViewForPosition(int).<br />
+ /// </summary>
+ /// <param name="holder">view to add</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AddView(ViewHolder holder)
+ {
+ AddView(holder, -1);
+ }
+
+ /// <summary>
+ /// Add a view to the currently attached FlexibleView if needed.<br />
+ /// LayoutManagers should use this method to add views obtained from a FlexibleView.Recycler using getViewForPosition(int).<br />
+ /// </summary>
+ /// <param name="holder">view to add</param>
+ /// <param name="index">index to add child at</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AddView(ViewHolder holder, int index)
+ {
+ AddViewInternal(holder, index, false);
+ }
+
+ /// <summary>
+ /// Temporarily detach and scrap all currently attached child views.
+ /// Views will be scrapped into the given Recycler.
+ /// The Recycler may prefer to reuse scrap views before other views that were previously recycled.
+ /// </summary>
+ /// <param name="recycler">Recycler to scrap views into</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrapAttachedViews(Recycler recycler)
+ {
+ if (mChildHelper == null)
+ {
+ return;
+ }
+
+ recycler.Clear();
+
+ mChildHelper.ScrapViews(recycler);
+ }
+
+ /**
+ * Remove a child view and recycle it using the given Recycler.
+ *
+ * @param index Index of child to remove and recycle
+ * @param recycler Recycler to use to recycle child
+ */
+ /// 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 RemoveAndRecycleViewAt(int index, Recycler recycler)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(index);
+ mChildHelper.RemoveViewAt(index);
+ recycler.RecycleView(v);
+ }
+
+ /// <summary>
+ /// ecycles children between given indices..
+ /// </summary>
+ /// <param name="recycler">Recycler to recycle views into</param>
+ /// <param name="startIndex">inclusive</param>
+ /// <param name="endIndex">exclusive</param>
+ /// <param name="immediate">recycle immediately or add to pending list and recycle later.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RecycleChildren(FlexibleView.Recycler recycler, int startIndex, int endIndex, bool immediate)
+ {
+ if (startIndex == endIndex)
+ {
+ return;
+ }
+ if (endIndex > startIndex)
+ {
+ for (int i = startIndex; i < endIndex; i++)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ if (v.PendingRecycle == false)
+ {
+ v.PendingRecycle = true;
+ mPendingRecycleViews.Add(v);
+ }
+ }
+ }
+ else
+ {
+ for (int i = startIndex; i > endIndex; i--)
+ {
+ ViewHolder v = mChildHelper.GetChildAt(i);
+ if (v.PendingRecycle == false)
+ {
+ v.PendingRecycle = true;
+ mPendingRecycleViews.Add(v);
+ }
+ }
+ }
+ if (immediate == true)
+ {
+ RecycleChildrenInt(recycler);
+ }
+ }
+
+ /// <summary>
+ /// Retrieves a position that neighbor to current position by direction.
+ /// </summary>
+ /// <param name="position">The anchor adapter position</param>
+ /// <param name="direction">The direction.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction);
+
+ internal virtual ViewHolder OnFocusSearchFailed(FlexibleView.ViewHolder focused, LayoutManager.Direction direction, Recycler recycler)
+ {
+ return null;
+ }
+
+ internal void SetRecyclerView(FlexibleView recyclerView)
+ {
+ mFlexibleView = recyclerView;
+ mChildHelper = recyclerView.mChildHelper;
+ }
+
+ internal void StopScroll()
+ {
+ if (mScrollAni != null && mScrollAni.State == Animation.States.Playing)
+ {
+ mScrollAni.Stop();
+ mScrollAni.Clear();
+ OnScrollAnimationFinished(mScrollAni, null);
+ }
+ }
+
+ /**
+ * Returns the scroll amount that brings the given rect in child's coordinate system within
+ * the padded area of RecyclerView.
+ * @param parent The parent RecyclerView.
+ * @param child The direct child making the request.
+ * @param rect The rectangle in the child's coordinates the child
+ * wishes to be on the screen.
+ * @param immediate True to forbid animated or delayed scrolling,
+ * false otherwise
+ * @return The array containing the scroll amount in x and y directions that brings the
+ * given rect into RV's padded area.
+ */
+ private Vector2 GetChildRectangleOnScreenScrollAmount(FlexibleView parent, FlexibleView.ViewHolder child)
+ {
+ Vector2 ret = new Vector2(0, 0);
+ int parentLeft = GetPaddingLeft();
+ int parentTop = GetPaddingTop();
+ int parentRight = (int)GetWidth() - GetPaddingRight();
+ int parentBottom = (int)GetHeight() - GetPaddingBottom();
+ int childLeft = (int)child.Left;
+ int childTop = (int)child.Top;
+ int childRight = (int)child.Right;
+ int childBottom = (int)child.Bottom;
+
+ int offScreenLeft = Math.Min(0, childLeft - parentLeft);
+ int offScreenTop = Math.Min(0, childTop - parentTop);
+ int offScreenRight = Math.Max(0, childRight - parentRight);
+ int offScreenBottom = Math.Max(0, childBottom - parentBottom);
+
+ // Favor the "start" layout direction over the end when bringing one side or the other
+ // of a large rect into view. If we decide to bring in end because start is already
+ // visible, limit the scroll such that start won't go out of bounds.
+ int dx= offScreenLeft != 0 ? offScreenLeft
+ : Math.Min(childLeft - parentLeft, offScreenRight);
+
+ // Favor bringing the top into view over the bottom. If top is already visible and
+ // we should scroll to make bottom visible, make sure top does not go out of bounds.
+ int dy = offScreenTop != 0 ? offScreenTop
+ : Math.Min(childTop - parentTop, offScreenBottom);
+
+ ret.X = -dx;
+ ret.Y = -dy;
+
+ return ret;
+ }
+
+ private void OnScrollAnimationFinished(object sender, EventArgs e)
+ {
+ RecycleChildrenInt(mFlexibleView.mRecycler);
+ }
+
+ private void AddViewInternal(ViewHolder holder, int index, bool disappearing)
+ {
+ if (holder.IsScrap())
+ {
+ holder.Unscrap();
+ mChildHelper.AttachView(holder, index);
+ }
+ else
+ {
+ mChildHelper.AddView(holder, index);
+ }
+ }
+
+ private void RecycleChildrenInt(FlexibleView.Recycler recycler)
+ {
+ foreach(ViewHolder holder in mPendingRecycleViews)
+ {
+ holder.PendingRecycle = false;
+ recycler.RecycleView(holder);
+ mChildHelper.RemoveView(holder);
+ }
+ mPendingRecycleViews.Clear();
+ }
+
+ private void ScrapOrRecycleView(Recycler recycler, ViewHolder itemView)
+ {
+ recycler.ScrapView(itemView);
+ }
+
+ }
+
+ /// <summary>
+ /// A ViewHolder describes an item view and metadata about its place within the FlexibleView.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ViewHolder
+ {
+ /**
+ * This ViewHolder has been bound to a position; AdapterPosition, mItemId and mItemViewType
+ * are all valid.
+ */
+ //static readonly int FLAG_BOUND = 1 << 0;
+
+ /**
+ * The data this ViewHolder's view reflects is stale and needs to be rebound
+ * by the adapter. AdapterPosition and mItemId are consistent.
+ */
+ //static readonly int FLAG_UPDATE = 1 << 1;
+
+ /**
+ * This ViewHolder's data is invalid. The identity implied by AdapterPosition and mItemId
+ * are not to be trusted and may no longer match the item view type.
+ * This ViewHolder must be fully rebound to different data.
+ */
+ //static readonly int FLAG_INVALID = 1 << 2;
+
+ /**
+ * This ViewHolder points at data that represents an item previously removed from the
+ * data set. Its view may still be used for things like outgoing animations.
+ */
+ //static readonly int FLAG_REMOVED = 1 << 3;
+
+ /**
+ * This ViewHolder should not be recycled. This flag is set via setIsRecyclable()
+ * and is intended to keep views around during animations.
+ */
+ //static readonly int FLAG_NOT_RECYCLABLE = 1 << 4;
+
+ /**
+ * This ViewHolder is returned from scrap which means we are expecting an addView call
+ * for this itemView. When returned from scrap, ViewHolder stays in the scrap list until
+ * the end of the layout pass and then recycled by RecyclerView if it is not added back to
+ * the RecyclerView.
+ */
+ //static readonly int FLAG_RETURNED_FROM_SCRAP = 1 << 5;
+
+ /**
+ * This ViewHolder is fully managed by the LayoutManager. We do not scrap, recycle or remove
+ * it unless LayoutManager is replaced.
+ * It is still fully visible to the LayoutManager.
+ */
+ //static readonly int FLAG_IGNORE = 1 << 7;
+
+ private int mFlags;
+ private int mPreLayoutPosition = NO_POSITION;
+
+ /// <summary>
+ /// ViewHolder constructor.
+ /// </summary>
+ /// <param name="itemView">View</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder(View itemView)
+ {
+ if (itemView == null)
+ {
+ throw new ArgumentNullException("itemView may not be null");
+ }
+ this.ItemView = itemView;
+ }
+
+ /// <summary>
+ /// Returns the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 View ItemView { get; }
+
+ /// <summary>
+ /// Returns the left edge includes the view left margin.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float Left
+ {
+ get
+ {
+ return ItemView.PositionX - ItemView.Margin.Start;
+ }
+ }
+
+ /// <summary>
+ /// Returns the right edge includes the view right margin.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float Right
+ {
+ get
+ {
+ return ItemView.PositionX + ItemView.SizeWidth + ItemView.Margin.End;
+ }
+ }
+
+ /// <summary>
+ /// Returns the top edge includes the view top margin.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float Top
+ {
+ get
+ {
+ return ItemView.PositionY - ItemView.Margin.Top;
+ }
+ }
+
+ /// <summary>
+ /// Returns the bottom edge includes the view bottom margin.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float Bottom
+ {
+ get
+ {
+ return ItemView.PositionY + ItemView.SizeHeight + ItemView.Margin.Bottom;
+ }
+ }
+
+ /// <summary>
+ /// Returns the position of the ViewHolder in terms of the latest layout pass.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int LayoutPosition
+ {
+ get
+ {
+ return mPreLayoutPosition == NO_POSITION ? AdapterPosition : mPreLayoutPosition;
+ }
+ }
+
+ /// <summary>
+ /// Returns the Adapter position of the item represented by this ViewHolder.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int AdapterPosition { get; internal set; } = NO_POSITION;
+
+ /// <summary>
+ /// Get old position of item view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int OldPosition { get; private set; } = NO_POSITION;
+
+ /// <summary>
+ /// Gets or sets item view type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ItemViewType { get; set; } = INVALID_TYPE;
+
+ internal bool IsBound
+ {
+ get;
+ set;
+ }
+
+ internal Recycler ScrapContainer { get; set; }
+
+ internal bool PendingRecycle
+ {
+ get;
+ set;
+ } = false;
+
+
+ internal bool IsScrap()
+ {
+ return ScrapContainer != null;
+ }
+
+ internal void Unscrap()
+ {
+ ScrapContainer.UnscrapView(this);
+ }
+
+
+ internal void FlagRemovedAndOffsetPosition(int mNewPosition, int offset, bool applyToPreLayout)
+ {
+ //AddFlags(ViewHolder.FLAG_REMOVED);
+ OffsetPosition(offset, applyToPreLayout);
+ AdapterPosition = mNewPosition;
+ }
+
+ internal void OffsetPosition(int offset, bool applyToPreLayout)
+ {
+ if (OldPosition == NO_POSITION)
+ {
+ OldPosition = AdapterPosition;
+ }
+ if (mPreLayoutPosition == NO_POSITION)
+ {
+ mPreLayoutPosition = AdapterPosition;
+ }
+ if (applyToPreLayout)
+ {
+ mPreLayoutPosition += offset;
+ }
+ AdapterPosition += offset;
+ }
+
+ internal void ClearOldPosition()
+ {
+ OldPosition = NO_POSITION;
+ mPreLayoutPosition = NO_POSITION;
+ }
+
+ internal void SaveOldPosition()
+ {
+ if (OldPosition == NO_POSITION)
+ {
+ OldPosition = AdapterPosition;
+ }
+ }
+
+ private void SetFlags(int flags, int mask)
+ {
+ mFlags = (mFlags & ~mask) | (flags & mask);
+ }
+
+ private void AddFlags(int flags)
+ {
+ mFlags |= flags;
+ }
+
+ }
+
+ /// <summary>
+ /// A Recycler is responsible for managing scrapped or detached item views for reuse.
+ /// A "scrapped" view is a view that is still attached to its parent FlexibleView but that has been marked for removal or reuse.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Recycler
+ {
+ private FlexibleView mFlexibleView;
+ private RecycledViewPool mRecyclerPool;
+
+ private List<ViewHolder> mAttachedScrap = new List<ViewHolder>();
+ private List<ViewHolder> mChangedScrap = null;
+ //private List<ItemView> mCachedViews = new List<ItemView>();
+
+ //private List<ViewHolder> mUnmodifiableAttachedScrap;
+
+ private int mCacheSizeMax = 2;
+
+ /// <summary>
+ /// Recycler constructor.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Recycler(FlexibleView recyclerView)
+ {
+ mFlexibleView = recyclerView;
+ }
+
+ /// 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 SetViewCacheSize(int viewCount)
+ {
+ mCacheSizeMax = viewCount;
+ }
+
+ /// <summary>
+ /// Obtain a view initialized for the given position.
+ /// </summary>
+ /// <param name="position">Position to obtain a view for</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder GetViewForPosition(int position)
+ {
+ Adapter b = mFlexibleView != null ? mFlexibleView.mAdapter : null;
+ if (b == null)
+ {
+ return null;
+ }
+ if (position < 0 || position >= b.GetItemCount())
+ {
+ return null;
+ }
+
+ int type = b.GetItemViewType(position);
+ ViewHolder itemView = null;
+ for (int i = 0; i < mAttachedScrap.Count; i++)
+ {
+ if (mAttachedScrap[i].LayoutPosition == position && mAttachedScrap[i].ItemViewType == type)
+ {
+ itemView = mAttachedScrap[i];
+ break;
+ }
+ }
+ if (itemView == null)
+ {
+ itemView = mRecyclerPool.GetRecycledView(type);
+ if (itemView == null)
+ {
+ itemView = b.OnCreateViewHolder(type);
+ }
+
+ if (!itemView.IsBound)
+ {
+ b.OnBindViewHolder(itemView, position);
+ itemView.IsBound = true;
+ }
+
+ itemView.AdapterPosition = position;
+ itemView.ItemViewType = type;
+ }
+
+ return itemView;
+ }
+
+ /// <summary>
+ /// Recycle a detached view.
+ /// </summary>
+ /// <param name="itemView">Removed holder for recycling</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RecycleView(ViewHolder itemView)
+ {
+ itemView.ScrapContainer = null;
+ mRecyclerPool.PutRecycledView(itemView);
+ }
+
+ /// <summary>
+ /// Returns the count in scrap list.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetScrapCount()
+ {
+ return mAttachedScrap.Count;
+ }
+
+ /// <summary>
+ /// Gets the scrap view at index.
+ /// </summary>
+ /// <param name="index">index</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ViewHolder GetScrapViewAt(int index)
+ {
+ return mAttachedScrap[index];
+ }
+
+ /// <summary>
+ /// Clear scrap views out of this recycler. Detached views contained within a recycled view pool will remain.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Clear()
+ {
+ mAttachedScrap.Clear();
+ if (mChangedScrap != null)
+ {
+ mChangedScrap.Clear();
+ }
+ }
+
+ internal void ScrapView(ViewHolder itemView)
+ {
+ mAttachedScrap.Add(itemView);
+ itemView.ScrapContainer = this;
+ }
+
+ internal void UnscrapView(ViewHolder itemView)
+ {
+ mAttachedScrap.Remove(itemView);
+ itemView.ScrapContainer = null;
+ }
+
+ internal void SetRecycledViewPool(RecycledViewPool pool)
+ {
+ mRecyclerPool = pool;
+ }
+ }
+
+ internal class RecycledViewPool
+ {
+ private FlexibleView mFlexibleView;
+
+ private int mMaxTypeCount = 10;
+ private List<ViewHolder>[] mScrap;
+
+ public RecycledViewPool(FlexibleView flexibleView)
+ {
+ mFlexibleView = flexibleView;
+ mScrap = new List<ViewHolder>[mMaxTypeCount];
+ }
+
+ //public void SetViewTypeCount(int typeCount)
+ //{
+ //}
+
+ public ViewHolder GetRecycledView(int viewType)
+ {
+ if (viewType >= mMaxTypeCount || mScrap[viewType] == null)
+ {
+ return null;
+ }
+
+ int index = mScrap[viewType].Count - 1;
+ if (index < 0)
+ {
+ return null;
+ }
+ ViewHolder recycledView = mScrap[viewType][index];
+ mScrap[viewType].RemoveAt(index);
+
+ return recycledView;
+ }
+
+ public void PutRecycledView(ViewHolder view)
+ {
+ int viewType = view.ItemViewType;
+ if (mScrap[viewType] == null)
+ {
+ mScrap[viewType] = new List<ViewHolder>();
+ }
+ view.IsBound = false;
+ mScrap[viewType].Add(view);
+ }
+
+ public void Clear()
+ {
+ for (int i = 0; i < mMaxTypeCount; i++)
+ {
+ if (mScrap[i] == null)
+ {
+ continue;
+ }
+ for (int j = 0; j < mScrap[i].Count; j++)
+ {
+ mFlexibleView.DispatchChildDestroyed(mScrap[i][j]);
+ }
+ mScrap[i].Clear();
+ }
+ }
+ }
+
+ private class ChildHelper
+ {
+ private FlexibleView mFlexibleView;
+
+ private List<ViewHolder> mViewList = new List<ViewHolder>();
+
+ //private List<ViewHolder> mRemovePendingViews;
+
+ private Dictionary<uint, ViewHolder> itemViewTable = new Dictionary<uint, ViewHolder>();
+ private TapGestureDetector mTapGestureDetector;
+
+ public ChildHelper(FlexibleView owner)
+ {
+ mFlexibleView = owner;
+
+ mTapGestureDetector = new TapGestureDetector();
+ mTapGestureDetector.Detected += OnTapGestureDetected;
+ }
+
+ public void Clear()
+ {
+ foreach(ViewHolder holder in mViewList)
+ {
+ mFlexibleView.Remove(holder.ItemView);
+
+ mFlexibleView.DispatchChildDestroyed(holder);
+ }
+ mViewList.Clear();
+ }
+
+ public void ScrapViews(Recycler recycler)
+ {
+ recycler.Clear();
+ foreach (ViewHolder itemView in mViewList)
+ {
+ recycler.ScrapView(itemView);
+ }
+
+ mViewList.Clear();
+ }
+
+ public void AttachView(ViewHolder holder, int index)
+ {
+ if (index == -1)
+ {
+ index = mViewList.Count;
+ }
+ mViewList.Insert(index, holder);
+
+ if (!itemViewTable.ContainsKey(holder.ItemView.ID))
+ {
+ mTapGestureDetector.Attach(holder.ItemView);
+ holder.ItemView.TouchEvent += OnTouchEvent;
+ }
+
+ itemViewTable[holder.ItemView.ID] = holder;
+ }
+
+ public void AddView(ViewHolder holder, int index)
+ {
+ mFlexibleView.Add(holder.ItemView);
+
+ mFlexibleView.DispatchChildAttached(holder);
+
+ AttachView(holder, index);
+ }
+
+ public bool RemoveView(ViewHolder holder)
+ {
+ mFlexibleView.Remove(holder.ItemView);
+
+ mFlexibleView.DispatchChildDetached(holder);
+
+ return mViewList.Remove(holder);
+ }
+
+ public bool RemoveViewAt(int index)
+ {
+ ViewHolder itemView = mViewList[index];
+ return RemoveView(itemView);
+ }
+
+ public bool RemoveViewsRange(int index, int count)
+ {
+ for (int i = index; i < index + count; i++)
+ {
+ ViewHolder holder = mViewList[i];
+ mFlexibleView.Remove(holder.ItemView);
+ }
+ mViewList.RemoveRange(index, count);
+ return false;
+ }
+
+ public int GetChildCount()
+ {
+ return mViewList.Count;
+ }
+
+ public ViewHolder GetChildAt(int index)
+ {
+ if (index < 0 || index >= mViewList.Count)
+ {
+ return null;
+ }
+ return mViewList[index];
+ }
+
+ private void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
+ {
+ View itemView = e.View as View;
+ if (itemView == null)
+ {
+ return;
+ }
+ if (itemViewTable.ContainsKey(itemView.ID))
+ {
+ ViewHolder holder = itemViewTable[itemView.ID];
+ mFlexibleView.FocusedItemIndex = holder.AdapterPosition;
+
+ mFlexibleView.DispatchItemClicked(holder);
+ }
+ }
+
+ private bool OnTouchEvent(object source, TouchEventArgs e)
+ {
+ View itemView = source as View;
+ if (itemView != null && itemViewTable.ContainsKey(itemView.ID))
+ {
+ ViewHolder holder = itemViewTable[itemView.ID];
+
+ mFlexibleView.DispatchItemTouched(holder, e.Touch);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ private class AdapterHelper
+ {
+ private FlexibleView mFlexibleView;
+
+ private List<UpdateOp> mPendingUpdates = new List<UpdateOp>();
+
+ private int mExistingUpdateTypes = 0;
+
+ public AdapterHelper(FlexibleView flexibleView)
+ {
+ mFlexibleView = flexibleView;
+ }
+
+ /**
+ * @return True if updates should be processed.
+ */
+ public bool OnItemRangeInserted(int positionStart, int itemCount)
+ {
+ if (itemCount < 1)
+ {
+ return false;
+ }
+ mPendingUpdates.Add(new UpdateOp(UpdateOp.ADD, positionStart, itemCount));
+ mExistingUpdateTypes |= UpdateOp.ADD;
+ return mPendingUpdates.Count == 1;
+ }
+
+ /**
+ * @return True if updates should be processed.
+ */
+ public bool OnItemRangeRemoved(int positionStart, int itemCount)
+ {
+ if (itemCount < 1)
+ {
+ return false;
+ }
+ mPendingUpdates.Add(new UpdateOp(UpdateOp.REMOVE, positionStart, itemCount));
+ mExistingUpdateTypes |= UpdateOp.REMOVE;
+ return mPendingUpdates.Count == 1;
+ }
+
+ public void PreProcess()
+ {
+ int count = mPendingUpdates.Count;
+ for (int i = 0; i < count; i++)
+ {
+ UpdateOp op = mPendingUpdates[i];
+ switch (op.cmd)
+ {
+ case UpdateOp.ADD:
+ mFlexibleView.OffsetPositionRecordsForInsert(op.positionStart, op.itemCount);
+ break;
+ case UpdateOp.REMOVE:
+ mFlexibleView.OffsetPositionRecordsForRemove(op.positionStart, op.itemCount, false);
+ break;
+ case UpdateOp.UPDATE:
+ break;
+ case UpdateOp.MOVE:
+ break;
+ }
+ }
+ mPendingUpdates.Clear();
+ }
+
+ }
+
+ /**
+ * Queued operation to happen when child views are updated.
+ */
+ private class UpdateOp
+ {
+
+ public const int ADD = 1;
+
+ public const int REMOVE = 1 << 1;
+
+ public const int UPDATE = 1 << 2;
+
+ public const int MOVE = 1 << 3;
+
+ public const int POOL_SIZE = 30;
+
+ public int cmd;
+
+ public int positionStart;
+
+ // holds the target position if this is a MOVE
+ public int itemCount;
+
+ public UpdateOp(int cmd, int positionStart, int itemCount)
+ {
+ this.cmd = cmd;
+ this.positionStart = positionStart;
+ this.itemCount = itemCount;
+ }
+
+ public bool Equals(UpdateOp op)
+ {
+ if (cmd != op.cmd)
+ {
+ return false;
+ }
+ if (cmd == MOVE && Math.Abs(itemCount - positionStart) == 1)
+ {
+ // reverse of this is also true
+ if (itemCount == op.positionStart && positionStart == op.itemCount)
+ {
+ return true;
+ }
+ }
+ if (itemCount != op.itemCount)
+ {
+ return false;
+ }
+ if (positionStart != op.positionStart)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ }
+
+ private class ItemViewInfo
+ {
+ public float Left
+ {
+ get;
+ set;
+ }
+ public float Top
+ {
+ get;
+ set;
+ }
+ public float Right
+ {
+ get;
+ set;
+ }
+ public float Bottom
+ {
+ get;
+ set;
+ }
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Layout collection of views in a grid.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class GridLayoutManager : LinearLayoutManager
+ {
+ private static readonly int DEFAULT_SPAN_COUNT = -1;
+
+ private int mSpanCount = DEFAULT_SPAN_COUNT;
+
+ /// <summary>
+ /// Creates a GridLayoutManager with orientation.
+ /// </summary>
+ /// <param name="spanCount">The number of columns or rows in the grid</param>
+ /// <param name="orientation">Layout orientation.Should be HORIZONTAL or VERTICAL</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 GridLayoutManager(int spanCount, int orientation) : base(orientation)
+ {
+ mSpanCount = spanCount;
+ }
+
+ internal override void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, int itemDirection)
+ {
+ bool layingOutInPrimaryDirection = (itemDirection == LayoutState.ITEM_DIRECTION_TAIL);
+ int span = anchorInfo.Position;
+ if (layingOutInPrimaryDirection)
+ {
+ // choose span 0
+ while (span > 0 && anchorInfo.Position > 0)
+ {
+ anchorInfo.Position--;
+ span = anchorInfo.Position;
+ }
+ }
+ else
+ {
+ // choose the max span we can get. hopefully last one
+ int indexLimit = GetChildCount() - 1;
+ int pos = anchorInfo.Position;
+ int bestSpan = span;
+ while (pos < indexLimit)
+ {
+ int next = (pos + 1);
+ if (next > bestSpan)
+ {
+ pos += 1;
+ bestSpan = next;
+ }
+ else
+ {
+ break;
+ }
+ }
+ anchorInfo.Position = pos;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves a position that neighbor to current position by direction.
+ /// </summary>
+ /// <param name="position">The anchor adapter position</param>
+ /// <param name="direction">The direction.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction)
+ {
+ if (mOrientation == HORIZONTAL)
+ {
+ switch (direction)
+ {
+ case FlexibleView.LayoutManager.Direction.Left:
+ if (position >= mSpanCount)
+ {
+ return position - mSpanCount;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Right:
+ if (position < ItemCount - mSpanCount)
+ {
+ return position + mSpanCount;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Up:
+ if (position % mSpanCount > 0)
+ {
+ return position - 1;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Down:
+ if (position < ItemCount - 1 && (position % mSpanCount < mSpanCount - 1))
+ {
+ return position + 1;
+ }
+ break;
+ }
+ }
+ else
+ {
+ switch (direction)
+ {
+ case FlexibleView.LayoutManager.Direction.Left:
+ if (position % mSpanCount > 0)
+ {
+ return position - 1;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Right:
+ if (position < ItemCount - 1 && (position % mSpanCount < mSpanCount - 1))
+ {
+ return position + 1;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Up:
+ if (position >= mSpanCount)
+ {
+ return position - mSpanCount;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Down:
+ if (position < ItemCount - mSpanCount)
+ {
+ return position + mSpanCount;
+ }
+ break;
+ }
+ }
+
+ return NO_POSITION;
+ }
+
+ internal override void LayoutChunk(FlexibleView.Recycler recycler,
+ LayoutState layoutState, LayoutChunkResult result)
+ {
+ bool layingOutInPrimaryDirection =
+ layoutState.ItemDirection == LayoutState.ITEM_DIRECTION_TAIL;
+
+ int count = mSpanCount;
+ for (int i = 0; i < count; i++)
+ {
+ FlexibleView.ViewHolder holder = layoutState.Next(recycler);
+ if (holder == null)
+ {
+ result.Finished = true;
+ return;
+ }
+
+ if (layingOutInPrimaryDirection)
+ AddView(holder);
+ else
+ AddView(holder, 0);
+
+ result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
+
+ float left, top, width, height;
+ if (mOrientation == VERTICAL)
+ {
+ width = (GetWidth() - GetPaddingLeft() - GetPaddingRight()) / count;
+ height = result.Consumed;
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
+ {
+ left = GetPaddingLeft() + width * i;
+ top = layoutState.Offset;
+ }
+ else
+ {
+ left = GetPaddingLeft() + width * (count - 1 - i);
+ top = layoutState.Offset - height;
+ }
+ LayoutChild(holder, left, top, width, height);
+ }
+ else
+ {
+ width = result.Consumed;
+ height = (GetHeight() - GetPaddingTop() - GetPaddingBottom()) / count;
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
+ {
+ top = GetPaddingTop() + height * i;
+ left = layoutState.Offset;
+ }
+ else
+ {
+ top = GetPaddingTop() + height * (count - 1 - i);
+ left = layoutState.Offset - width;
+ }
+ LayoutChild(holder, left, top, width, height);
+ }
+ }
+ }
+
+
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Layout collection of views horizontally/vertically.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class LinearLayoutManager : FlexibleView.LayoutManager
+ {
+ /// <summary>
+ /// Constant value: 0.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int HORIZONTAL = OrientationHelper.HORIZONTAL;
+ /// <summary>
+ /// Constant value: 1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int VERTICAL = OrientationHelper.VERTICAL;
+ /// <summary>
+ /// Constant value: -1.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int NO_POSITION = FlexibleView.NO_POSITION;
+ /// <summary>
+ /// Constant value: -2^31.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static readonly int INVALID_OFFSET = -2147483648;
+
+ private static readonly float MAX_SCROLL_FACTOR = 1 / 3f;
+
+ /// <summary>
+ /// Current orientation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int mOrientation;
+
+ internal OrientationHelper mOrientationHelper;
+
+ private LayoutState mLayoutState;
+ private AnchorInfo mAnchorInfo = new AnchorInfo();
+
+ /**
+ * Stashed to avoid allocation, currently only used in #fill()
+ */
+ private LayoutChunkResult mLayoutChunkResult = new LayoutChunkResult();
+
+ private bool mShouldReverseLayout = false;
+
+ /**
+ * When LayoutManager needs to scroll to a position, it sets this variable and requests a
+ * layout which will check this variable and re-layout accordingly.
+ */
+ private int mPendingScrollPosition = NO_POSITION;
+
+ /**
+ * Used to keep the offset value when {@link #scrollToPositionWithOffset(int, int)} is
+ * called.
+ */
+ private int mPendingScrollPositionOffset = INVALID_OFFSET;
+
+ /// <summary>
+ /// Creates a LinearLayoutManager with orientation.
+ /// </summary>
+ /// <param name="orientation">Layout orientation.Should be HORIZONTAL or VERTICAL</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 LinearLayoutManager(int orientation)
+ {
+ mOrientation = orientation;
+ mOrientationHelper = OrientationHelper.CreateOrientationHelper(this, mOrientation);
+
+ mLayoutState = new LayoutState();
+ mLayoutState.Offset = mOrientationHelper.GetStartAfterPadding();
+ }
+
+ /// <summary>
+ /// Retrieves the first visible item position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FirstVisibleItemPosition
+ {
+ get
+ {
+ FlexibleView.ViewHolder child = FindFirstVisibleItemView();
+ return child == null ? NO_POSITION : child.LayoutPosition;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the first complete visible item position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FirstCompleteVisibleItemPosition
+ {
+ get
+ {
+ FlexibleView.ViewHolder child = FindFirstCompleteVisibleItemView();
+ return child == null ? NO_POSITION : child.LayoutPosition;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the last visible item position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int LastVisibleItemPosition
+ {
+ get
+ {
+ FlexibleView.ViewHolder child = FindLastVisibleItemView();
+ return child == null ? NO_POSITION : child.LayoutPosition;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the last complete visible item position.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int LastCompleteVisibleItemPosition
+ {
+ get
+ {
+ FlexibleView.ViewHolder child = FindLastCompleteVisibleItemView();
+ return child == null ? NO_POSITION : child.LayoutPosition;
+ }
+ }
+
+ /// <summary>
+ /// Query if horizontal scrolling is currently supported. The default implementation returns false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool CanScrollHorizontally()
+ {
+ return mOrientation == HORIZONTAL;
+ }
+
+ /// <summary>
+ /// Query if vertical scrolling is currently supported. The default implementation returns false.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool CanScrollVertically()
+ {
+ return mOrientation == VERTICAL;
+ }
+
+ /// <summary>
+ /// Lay out all relevant child views from the given adapter.
+ /// </summary>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnLayoutChildren(FlexibleView.Recycler recycler)
+ {
+ mLayoutState.Recycle = false;
+ if (!mAnchorInfo.Valid || mPendingScrollPosition != NO_POSITION)
+ {
+ mAnchorInfo.Reset();
+ mAnchorInfo.LayoutFromEnd = mShouldReverseLayout;
+ // calculate anchor position and coordinate
+ UpdateAnchorInfoForLayout(recycler, mAnchorInfo);
+ mAnchorInfo.Valid = true;
+ }
+
+ int firstLayoutDirection;
+ if (mAnchorInfo.LayoutFromEnd)
+ {
+ firstLayoutDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
+ : LayoutState.ITEM_DIRECTION_HEAD;
+ }
+ else
+ {
+ firstLayoutDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
+ : LayoutState.ITEM_DIRECTION_TAIL;
+ }
+ EnsureAnchorReady(recycler, mAnchorInfo, firstLayoutDirection);
+ ScrapAttachedViews(recycler);
+
+ if (mAnchorInfo.LayoutFromEnd == true)
+ {
+ UpdateLayoutStateToFillStart(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ Fill(recycler, mLayoutState, false, true);
+ Cache(recycler, mLayoutState, true);
+
+ UpdateLayoutStateToFillEnd(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ mLayoutState.CurrentPosition += mLayoutState.ItemDirection;
+ Fill(recycler, mLayoutState, false, true);
+ Cache(recycler, mLayoutState, true);
+ }
+ else
+ {
+ UpdateLayoutStateToFillEnd(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ Fill(recycler, mLayoutState, false, true);
+ Cache(recycler, mLayoutState, true);
+
+ UpdateLayoutStateToFillStart(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ mLayoutState.CurrentPosition += mLayoutState.ItemDirection;
+ Fill(recycler, mLayoutState, false, true);
+ Cache(recycler, mLayoutState, true);
+ }
+
+ OnLayoutCompleted();
+ }
+
+ /// <summary>
+ /// Scroll horizontally by dy pixels in screen coordinates.
+ /// </summary>
+ /// <param name="dy">distance to scroll in pixels. Y increases as scroll position approaches the top.</param>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <param name="immediate">Specify if the scroll need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override float ScrollHorizontallyBy(float dx, FlexibleView.Recycler recycler, bool immediate)
+ {
+ if (mOrientation == VERTICAL)
+ {
+ return 0;
+ }
+ return ScrollBy(dx, recycler, immediate);
+ }
+
+ /// <summary>
+ /// Scroll vertically by dy pixels in screen coordinates.
+ /// </summary>
+ /// <param name="dy">distance to scroll in pixels. Y increases as scroll position approaches the top.</param>
+ /// <param name="recycler">Recycler to use for fetching potentially cached views for a position</param>
+ /// <param name="immediate">Specify if the scroll need animation</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override float ScrollVerticallyBy(float dy, FlexibleView.Recycler recycler, bool immediate)
+ {
+ if (mOrientation == HORIZONTAL)
+ {
+ return 0;
+ }
+ return ScrollBy(dy, recycler, immediate); ;
+ }
+
+ /// <summary>
+ /// Compute the offset of the scrollbar's thumb within the range.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override float ComputeScrollOffset()
+ {
+ FlexibleView.ViewHolder startChild = FindFirstVisibleItemView();
+ FlexibleView.ViewHolder endChild = FindLastVisibleItemView();
+ if (GetChildCount() == 0 || startChild == null || endChild == null)
+ {
+ return 0;
+ }
+ int minPosition = Math.Min(startChild.LayoutPosition, endChild.LayoutPosition);
+ int maxPosition = Math.Max(startChild.LayoutPosition, endChild.LayoutPosition);
+ int itemsBefore = mShouldReverseLayout
+ ? Math.Max(0, ItemCount - maxPosition - 1)
+ : Math.Max(0, minPosition);
+
+ float laidOutArea = Math.Abs(mOrientationHelper.GetViewHolderEnd(endChild)
+ - mOrientationHelper.GetViewHolderStart(startChild));
+ int itemRange = Math.Abs(startChild.LayoutPosition - endChild.LayoutPosition) + 1;
+ float avgSizePerRow = laidOutArea / itemRange;
+
+ return (float)Math.Round(itemsBefore * avgSizePerRow + (mOrientationHelper.GetStartAfterPadding()
+ - mOrientationHelper.GetViewHolderStart(startChild)));
+ }
+
+ /// <summary>
+ /// Compute the extent of the scrollbar's thumb within the range.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override float ComputeScrollExtent()
+ {
+ FlexibleView.ViewHolder startChild = FindFirstVisibleItemView();
+ FlexibleView.ViewHolder endChild = FindLastVisibleItemView();
+ if (GetChildCount() == 0 || startChild == null || endChild == null)
+ {
+ return 0;
+ }
+ float extend = mOrientationHelper.GetViewHolderEnd(endChild)
+ - mOrientationHelper.GetViewHolderStart(startChild);
+ return Math.Min(mOrientationHelper.GetTotalSpace(), extend);
+ }
+
+ /// <summary>
+ /// Compute the range that the scrollbar represents.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override float ComputeScrollRange()
+ {
+ FlexibleView.ViewHolder startChild = FindFirstVisibleItemView();
+ FlexibleView.ViewHolder endChild = FindLastVisibleItemView();
+ if (GetChildCount() == 0 || startChild == null || endChild == null)
+ {
+ return 0;
+ }
+ float laidOutArea = mOrientationHelper.GetViewHolderEnd(endChild)
+ - mOrientationHelper.GetViewHolderStart(startChild);
+ int laidOutRange = Math.Abs(startChild.LayoutPosition - endChild.LayoutPosition) + 1;
+ // estimate a size for full list.
+ return laidOutArea / laidOutRange * ItemCount;
+ }
+
+ /// <summary>
+ /// Scroll the FlexibleView to make the position visible.
+ /// </summary>
+ /// <param name="position">Scroll to this adapter position</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void ScrollToPosition(int position)
+ {
+ mPendingScrollPosition = position;
+ mPendingScrollPositionOffset = INVALID_OFFSET;
+
+ RelayoutRequest();
+ }
+
+ /// <summary>
+ /// Scroll to the specified adapter position with the given offset from resolved layout start.
+ /// </summary>
+ /// <param name="position">Scroll to this adapter position</param>
+ /// <param name="offset">The distance (in pixels) between the start edge of the item view and start edge of the FlexibleView.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void ScrollToPositionWithOffset(int position, int offset)
+ {
+ mPendingScrollPosition = position;
+ mPendingScrollPositionOffset = offset;
+
+ RelayoutRequest();
+ }
+
+ /// <summary>
+ /// Called after a full layout calculation is finished.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnLayoutCompleted()
+ {
+ if (mPendingScrollPosition != NO_POSITION)
+ {
+ ChangeFocus(mPendingScrollPosition);
+ }
+ mPendingScrollPosition = NO_POSITION;
+ mPendingScrollPositionOffset = INVALID_OFFSET;
+
+ mAnchorInfo.Reset();
+ }
+
+ internal virtual void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, int itemDirection)
+ {
+
+ }
+
+
+ /// <summary>
+ /// Retrieves a position that neighbor to current position by direction.
+ /// </summary>
+ /// <param name="position">The anchor adapter position</param>
+ /// <param name="direction">The direction.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction)
+ {
+ if (mOrientation == HORIZONTAL)
+ {
+ switch (direction)
+ {
+ case FlexibleView.LayoutManager.Direction.Left:
+ if (position > 0)
+ {
+ return position - 1;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Right:
+ if (position < ItemCount - 1)
+ {
+ return position + 1;
+ }
+ break;
+ }
+ }
+ else
+ {
+ switch (direction)
+ {
+ case FlexibleView.LayoutManager.Direction.Up:
+ if (position > 0)
+ {
+ return position - 1;
+ }
+ break;
+ case FlexibleView.LayoutManager.Direction.Down:
+ if (position < ItemCount - 1)
+ {
+ return position + 1;
+ }
+ break;
+ }
+ }
+
+ return NO_POSITION;
+ }
+
+ internal virtual void LayoutChunk(FlexibleView.Recycler recycler,
+ LayoutState layoutState, LayoutChunkResult result)
+ {
+ FlexibleView.ViewHolder holder = layoutState.Next(recycler);
+ if (holder == null)
+ {
+ // if we are laying out views in scrap, this may return null which means there is
+ // no more items to layout.
+ result.Finished = true;
+ return;
+ }
+
+ if (mShouldReverseLayout == (layoutState.LayoutDirection == LayoutState.LAYOUT_START))
+ AddView(holder);
+ else
+ AddView(holder, 0);
+
+ result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
+
+ float left, top, width, height;
+ if (mOrientation == VERTICAL)
+ {
+ width = GetWidth() - GetPaddingLeft() - GetPaddingRight();
+ height = result.Consumed;
+ left = GetPaddingLeft();
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
+ {
+ top = layoutState.Offset;
+ }
+ else
+ {
+ top = layoutState.Offset - height;
+ }
+ LayoutChild(holder, left, top, width, height);
+ }
+ else
+ {
+ width = result.Consumed;
+ height = GetHeight() - GetPaddingTop() - GetPaddingBottom();
+ top = GetPaddingTop();
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
+ {
+ left = layoutState.Offset;
+ }
+ else
+ {
+ left = layoutState.Offset - width;
+ }
+ LayoutChild(holder, left, top, width, height);
+ }
+
+ result.Focusable = true;
+ }
+
+ internal override FlexibleView.ViewHolder OnFocusSearchFailed(FlexibleView.ViewHolder focused, FlexibleView.LayoutManager.Direction direction, FlexibleView.Recycler recycler)
+ {
+ if (GetChildCount() == 0)
+ {
+ return null;
+ }
+ int layoutDir = ConvertFocusDirectionToLayoutDirection(direction);
+ if (layoutDir == LayoutState.INVALID_LAYOUT)
+ {
+ return null;
+ }
+ int maxScroll = (int)(MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace());
+ UpdateLayoutState(layoutDir, maxScroll, false);
+ mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ mLayoutState.Recycle = false;
+ Fill(recycler, mLayoutState, true, true);
+
+ FlexibleView.ViewHolder nextFocus;
+ if (layoutDir == LayoutState.LAYOUT_START)
+ {
+ nextFocus = GetChildAt(0);
+ }
+ else
+ {
+ nextFocus = GetChildAt(GetChildCount() - 1);
+ }
+ return nextFocus;
+ }
+
+
+ private void UpdateAnchorInfoForLayout(FlexibleView.Recycler recycler, AnchorInfo anchorInfo)
+ {
+ if (UpdateAnchorFromPendingData(anchorInfo))
+ {
+ return;
+ }
+
+ if (UpdateAnchorFromChildren(recycler, anchorInfo))
+ {
+ return;
+ }
+
+ anchorInfo.Position = FocusPosition != NO_POSITION ? FocusPosition : 0;
+ anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? mOrientationHelper.GetEndAfterPadding() : mOrientationHelper.GetStartAfterPadding();
+ }
+
+ /**
+ * If there is a pending scroll position or saved states, updates the anchor info from that
+ * data and returns true
+ */
+ private bool UpdateAnchorFromPendingData(AnchorInfo anchorInfo)
+ {
+ if (mPendingScrollPosition == NO_POSITION)
+ {
+ return false;
+ }
+ // validate scroll position
+ if (mPendingScrollPosition < 0 || mPendingScrollPosition >= ItemCount)
+ {
+ mPendingScrollPosition = NO_POSITION;
+ mPendingScrollPositionOffset = INVALID_OFFSET;
+ return false;
+ }
+
+ anchorInfo.Position = mPendingScrollPosition;
+
+ if (mPendingScrollPositionOffset == INVALID_OFFSET)
+ {
+ anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? mOrientationHelper.GetEndAfterPadding() : mOrientationHelper.GetStartAfterPadding();
+ }
+ else
+ {
+ if (mShouldReverseLayout)
+ {
+ anchorInfo.Coordinate = mOrientationHelper.GetEndAfterPadding()
+ - mPendingScrollPositionOffset;
+ }
+ else
+ {
+ anchorInfo.Coordinate = mOrientationHelper.GetStartAfterPadding()
+ + mPendingScrollPositionOffset;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Finds an anchor child from existing Views. Most of the time, this is the view closest to
+ * start or end that has a valid position (e.g. not removed).
+ * If a child has focus, it is given priority.
+ */
+ private bool UpdateAnchorFromChildren(FlexibleView.Recycler recycler, AnchorInfo anchorInfo)
+ {
+ if (GetChildCount() == 0)
+ {
+ return false;
+ }
+
+ FlexibleView.ViewHolder anchorChild = FindFirstCompleteVisibleItemView();
+ anchorInfo.Position = anchorChild.LayoutPosition;
+ anchorInfo.Coordinate = mOrientationHelper.GetViewHolderStart(anchorChild);
+
+ return true;
+ }
+
+ /**
+ * Converts a focusDirection to orientation.
+ *
+ * @param focusDirection One of {@link View#FOCUS_UP}, {@link View#FOCUS_DOWN},
+ * {@link View#FOCUS_LEFT}, {@link View#FOCUS_RIGHT},
+ * {@link View#FOCUS_BACKWARD}, {@link View#FOCUS_FORWARD}
+ * or 0 for not applicable
+ * @return {@link LayoutState#LAYOUT_START} or {@link LayoutState#LAYOUT_END} if focus direction
+ * is applicable to current state, {@link LayoutState#INVALID_LAYOUT} otherwise.
+ */
+ private int ConvertFocusDirectionToLayoutDirection(FlexibleView.LayoutManager.Direction focusDirection)
+ {
+ switch (focusDirection)
+ {
+ case FlexibleView.LayoutManager.Direction.Up:
+ return mOrientation == VERTICAL ? LayoutState.LAYOUT_START
+ : LayoutState.INVALID_LAYOUT;
+ case FlexibleView.LayoutManager.Direction.Down:
+ return mOrientation == VERTICAL ? LayoutState.LAYOUT_END
+ : LayoutState.INVALID_LAYOUT;
+ case FlexibleView.LayoutManager.Direction.Left:
+ return mOrientation == HORIZONTAL ? LayoutState.LAYOUT_START
+ : LayoutState.INVALID_LAYOUT;
+ case FlexibleView.LayoutManager.Direction.Right:
+ return mOrientation == HORIZONTAL ? LayoutState.LAYOUT_END
+ : LayoutState.INVALID_LAYOUT;
+ default:
+ return LayoutState.INVALID_LAYOUT;
+ }
+
+ }
+
+
+ private float Fill(FlexibleView.Recycler recycler, LayoutState layoutState, bool stopOnFocusable, bool immediate)
+ {
+ float start = layoutState.Available;
+ if (layoutState.ScrollingOffset != LayoutState.SCROLLING_OFFSET_NaN)
+ {
+ // TODO ugly bug fix. should not happen
+ if (layoutState.Available < 0)
+ {
+ layoutState.ScrollingOffset += layoutState.Available;
+ }
+ if (immediate == true)
+ {
+ RecycleByLayoutState(recycler, layoutState, true);
+ }
+ }
+ float remainingSpace = layoutState.Available + layoutState.Extra;
+ LayoutChunkResult layoutChunkResult = mLayoutChunkResult;
+ while ((remainingSpace > 0) && layoutState.HasMore(ItemCount))
+ {
+ layoutChunkResult.ResetInternal();
+ LayoutChunk(recycler, layoutState, layoutChunkResult);
+ if (layoutChunkResult.Finished)
+ {
+ break;
+ }
+ layoutState.Offset += layoutChunkResult.Consumed * layoutState.LayoutDirection;
+ /**
+ * Consume the available space if:
+ * layoutChunk did not request to be ignored
+ * OR we are laying out scrap children
+ * OR we are not doing pre-layout
+ */
+ if (!layoutChunkResult.IgnoreConsumed)
+ {
+ layoutState.Available -= layoutChunkResult.Consumed;
+ // we keep a separate remaining space because mAvailable is important for recycling
+ remainingSpace -= layoutChunkResult.Consumed;
+ }
+
+ if (layoutState.ScrollingOffset != LayoutState.SCROLLING_OFFSET_NaN)
+ {
+ layoutState.ScrollingOffset += layoutChunkResult.Consumed;
+ if (layoutState.Available < 0)
+ {
+ layoutState.ScrollingOffset += layoutState.Available;
+ }
+ if (immediate == true)
+ {
+ RecycleByLayoutState(recycler, layoutState, true);
+ }
+ }
+ if (stopOnFocusable && layoutChunkResult.Focusable)
+ {
+ break;
+ }
+ }
+ if (immediate == false)
+ {
+ RecycleByLayoutState(recycler, layoutState, false);
+ }
+
+ return start - layoutState.Available;
+ }
+
+ private void Cache(FlexibleView.Recycler recycler, LayoutState layoutState, bool immediate, float scrolled = 0)
+ {
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
+ {
+ // get the first child in the direction we are going
+ FlexibleView.ViewHolder child = GetChildClosestToEnd();
+ //Log.Fatal("TV.FLUX.Component", $"==========> child:{child.LayoutGroupIndex}-{child.LayoutItemIndex} childEnd:{orientationHelper.GetItemEnd(child)} # {orientationHelper.GetEnd()}");
+
+ if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderEnd(child) + scrolled < mOrientationHelper.GetEnd())
+ {
+ layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Extra = 0;
+ layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ layoutState.Recycle = false;
+ Fill(recycler, layoutState, true, immediate);
+ }
+ }
+ else
+ {
+ FlexibleView.ViewHolder child = GetChildClosestToStart();
+
+ if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderStart(child) + scrolled > 0)
+ {
+ layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Extra = 0;
+ layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ layoutState.Recycle = false;
+ Fill(recycler, layoutState, true, immediate);
+ }
+ }
+ }
+
+ private void RecycleByLayoutState(FlexibleView.Recycler recycler, LayoutState layoutState, bool immediate)
+ {
+ if (!layoutState.Recycle)
+ {
+ return;
+ }
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_START)
+ {
+ RecycleViewsFromEnd(recycler, layoutState.ScrollingOffset, immediate);
+ }
+ else
+ {
+ RecycleViewsFromStart(recycler, layoutState.ScrollingOffset, immediate);
+ }
+ }
+
+ private void RecycleViewsFromStart(FlexibleView.Recycler recycler, float dt, bool immediate)
+ {
+ if (dt < 0)
+ {
+ return;
+ }
+ // ignore padding, ViewGroup may not clip children.
+ float limit = dt;
+ int childCount = GetChildCount();
+ if (mShouldReverseLayout)
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if (mOrientationHelper.GetViewHolderEnd(child) > limit)
+ {
+ // stop here
+ RecycleChildren(recycler, childCount - 1, i, immediate);
+ return;
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if (mOrientationHelper.GetViewHolderEnd(child) > limit)
+ {
+ // stop here
+ RecycleChildren(recycler, 0, i, immediate);
+ return;
+ }
+ }
+ }
+ }
+
+ private void RecycleViewsFromEnd(FlexibleView.Recycler recycler, float dt, bool immediate)
+ {
+ int childCount = GetChildCount();
+ if (dt < 0)
+ {
+ return;
+ }
+ float limit = mOrientationHelper.GetEnd() - dt;
+ if (mShouldReverseLayout)
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if (mOrientationHelper.GetViewHolderStart(child) < limit)
+ {
+ // stop here
+ RecycleChildren(recycler, 0, i, immediate);
+ return;
+ }
+ }
+ }
+ else
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if (mOrientationHelper.GetViewHolderStart(child) < limit)
+ {
+ // stop here
+ RecycleChildren(recycler, childCount - 1, i, immediate);
+ return;
+ }
+ }
+ }
+ }
+
+ private float ScrollBy(float dy, FlexibleView.Recycler recycler, bool immediate)
+ {
+ if (GetChildCount() == 0 || dy == 0)
+ {
+ return 0;
+ }
+ mLayoutState.Recycle = true;
+ int layoutDirection = dy < 0 ? LayoutState.LAYOUT_END : LayoutState.LAYOUT_START;
+ float absDy = Math.Abs(dy);
+ UpdateLayoutState(layoutDirection, absDy, true);
+ float consumed = mLayoutState.ScrollingOffset
+ + Fill(recycler, mLayoutState, false, immediate);
+
+ if (consumed < 0)
+ {
+ return 0;
+ }
+
+ float scrolled = absDy > consumed ? -layoutDirection * consumed : dy;
+
+ Cache(recycler, mLayoutState, immediate, scrolled);
+
+ mOrientationHelper.OffsetChildren(scrolled, immediate);
+
+
+ return scrolled;
+ }
+
+ private void UpdateLayoutState(int layoutDirection, float requiredSpace, bool canUseExistingSpace)
+ {
+ mLayoutState.Extra = 0;
+ mLayoutState.LayoutDirection = layoutDirection;
+ float scrollingOffset;
+ if (layoutDirection == LayoutState.LAYOUT_END)
+ {
+ mLayoutState.Extra += mOrientationHelper.GetEndPadding();
+ // get the first child in the direction we are going
+ FlexibleView.ViewHolder child = GetChildClosestToEnd();
+ // the direction in which we are traversing children
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
+ : LayoutState.ITEM_DIRECTION_TAIL;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderEnd(child);
+ // calculate how much we can scroll without adding new children (independent of layout)
+ scrollingOffset = mOrientationHelper.GetViewHolderEnd(child)
+ - mOrientationHelper.GetEndAfterPadding();
+
+ }
+ else
+ {
+ mLayoutState.Extra += mOrientationHelper.GetStartAfterPadding();
+ FlexibleView.ViewHolder child = GetChildClosestToStart();
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
+ : LayoutState.ITEM_DIRECTION_HEAD;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderStart(child);
+ scrollingOffset = -mOrientationHelper.GetViewHolderStart(child)
+ + mOrientationHelper.GetStartAfterPadding();
+ }
+ mLayoutState.Available = requiredSpace;
+ if (canUseExistingSpace)
+ {
+ mLayoutState.Available -= scrollingOffset;
+ }
+ mLayoutState.ScrollingOffset = scrollingOffset;
+
+ }
+ /**
+ * Convenience method to find the child closes to start. Caller should check it has enough
+ * children.
+ *
+ * @return The child closes to start of the layout from user's perspective.
+ */
+ private FlexibleView.ViewHolder GetChildClosestToStart()
+ {
+ return GetChildAt(mShouldReverseLayout ? GetChildCount() - 1 : 0);
+ }
+
+ /**
+ * Convenience method to find the child closes to end. Caller should check it has enough
+ * children.
+ *
+ * @return The child closes to end of the layout from user's perspective.
+ */
+ private FlexibleView.ViewHolder GetChildClosestToEnd()
+ {
+ return GetChildAt(mShouldReverseLayout ? 0 : GetChildCount() - 1);
+ }
+
+ private void UpdateLayoutStateToFillEnd(int itemPosition, float offset)
+ {
+ mLayoutState.Available = mOrientationHelper.GetEndAfterPadding() - offset;
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD :
+ LayoutState.ITEM_DIRECTION_TAIL;
+ mLayoutState.CurrentPosition = itemPosition;
+ mLayoutState.LayoutDirection = LayoutState.LAYOUT_END;
+ mLayoutState.Offset = offset;
+ mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ mLayoutState.Extra = mOrientationHelper.GetEndPadding();
+ }
+
+ private void UpdateLayoutStateToFillStart(int itemPosition, float offset)
+ {
+ mLayoutState.Available = offset - mOrientationHelper.GetStartAfterPadding();
+ mLayoutState.CurrentPosition = itemPosition;
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL :
+ LayoutState.ITEM_DIRECTION_HEAD;
+ mLayoutState.LayoutDirection = LayoutState.LAYOUT_START;
+ mLayoutState.Offset = offset;
+ mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ mLayoutState.Extra = mOrientationHelper.GetStartAfterPadding();
+ }
+
+ private FlexibleView.ViewHolder FindFirstVisibleItemView()
+ {
+ int childCount = GetChildCount();
+ if (mShouldReverseLayout == false)
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderEnd(child) > 0)
+ {
+ return child;
+ }
+ }
+ }
+ else
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderEnd(child) > 0)
+ {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ private FlexibleView.ViewHolder FindFirstCompleteVisibleItemView()
+ {
+ int childCount = GetChildCount();
+ if (mShouldReverseLayout == false)
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderStart(child) > 0)
+ {
+ return child;
+ }
+ }
+ }
+ else
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderStart(child) > 0)
+ {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ private FlexibleView.ViewHolder FindLastVisibleItemView()
+ {
+ int childCount = GetChildCount();
+ if (mShouldReverseLayout == false)
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderStart(child) < (int)mOrientationHelper.GetEnd())
+ {
+ return child;
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderStart(child) < (int)mOrientationHelper.GetEnd())
+ {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ private FlexibleView.ViewHolder FindLastCompleteVisibleItemView()
+ {
+ int childCount = GetChildCount();
+ if (mShouldReverseLayout == false)
+ {
+ for (int i = childCount - 1; i >= 0; i--)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderEnd(child) < (int)mOrientationHelper.GetEnd())
+ {
+ return child;
+ }
+ }
+ }
+ else
+ {
+ for (int i = 0; i < childCount; i++)
+ {
+ FlexibleView.ViewHolder child = GetChildAt(i);
+ if ((int)mOrientationHelper.GetViewHolderEnd(child) < (int)mOrientationHelper.GetEnd())
+ {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Helper class that keeps temporary state while {LayoutManager} is filling out the empty space.
+ **/
+ internal class LayoutState
+ {
+ public static readonly int LAYOUT_START = -1;
+
+ public static readonly int LAYOUT_END = 1;
+
+ public static readonly int INVALID_LAYOUT = -1000;
+
+ public static readonly int ITEM_DIRECTION_HEAD = -1;
+
+ public static readonly int ITEM_DIRECTION_TAIL = 1;
+
+ public static readonly int SCROLLING_OFFSET_NaN = -10000;
+
+ /**
+ * We may not want to recycle children in some cases (e.g. layout)
+ */
+ public bool Recycle = true;
+
+ /**
+ * Pixel offset where layout should start
+ */
+ public float Offset;
+
+ /**
+ * Number of pixels that we should fill, in the layout direction.
+ */
+ public float Available;
+
+ /**
+ * Current position on the adapter to get the next item.
+ */
+ public int CurrentPosition;
+
+ /**
+ * Defines the direction in which the data adapter is traversed.
+ * Should be {@link #ITEM_DIRECTION_HEAD} or {@link #ITEM_DIRECTION_TAIL}
+ */
+ public int ItemDirection;
+
+ /**
+ * Defines the direction in which the layout is filled.
+ * Should be {@link #LAYOUT_START} or {@link #LAYOUT_END}
+ */
+ public int LayoutDirection;
+
+ /**
+ * Used when LayoutState is constructed in a scrolling state.
+ * It should be set the amount of scrolling we can make without creating a new view.
+ * Settings this is required for efficient view recycling.
+ */
+ public float ScrollingOffset;
+
+ /**
+ * Used if you want to pre-layout items that are not yet visible.
+ * The difference with {@link #mAvailable} is that, when recycling, distance laid out for
+ * {@link #mExtra} is not considered to avoid recycling visible children.
+ */
+ public float Extra = 0;
+
+
+ /**
+ * @return true if there are more items in the data adapter
+ */
+ public bool HasMore(int itemCount)
+ {
+ return CurrentPosition >= 0 && CurrentPosition < itemCount;
+ }
+
+ /**
+ * Gets the view for the next element that we should layout.
+ * Also updates current item index to the next item, based on {@link #mItemDirection}
+ *
+ * @return The next element that we should layout.
+ */
+ public FlexibleView.ViewHolder Next(FlexibleView.Recycler recycler)
+ {
+ FlexibleView.ViewHolder itemView = recycler.GetViewForPosition(CurrentPosition);
+ CurrentPosition += ItemDirection;
+ return itemView;
+ }
+ }
+
+ internal class LayoutChunkResult
+ {
+ public float Consumed;
+ public bool Finished;
+ public bool IgnoreConsumed;
+ public bool Focusable;
+
+ public void ResetInternal()
+ {
+ Consumed = 0;
+ Finished = false;
+ IgnoreConsumed = false;
+ Focusable = false;
+ }
+ }
+
+ internal class AnchorInfo
+ {
+ public int Position;
+ public float Coordinate;
+ public bool LayoutFromEnd;
+ public bool Valid;
+
+ public void Reset()
+ {
+ Position = NO_POSITION;
+ Coordinate = INVALID_OFFSET;
+ LayoutFromEnd = false;
+ Valid = false;
+ }
+
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /**
+ * Helper class for LayoutManagers to abstract measurements depending on the View's orientation.
+ * It is developed to easily support vertical and horizontal orientations in a LayoutManager but
+ * can also be used to abstract calls around view bounds and child measurements with margins and
+ * decorations.
+ *
+ * @see #createHorizontalHelper(RecyclerView.LayoutManager)
+ * @see #createVerticalHelper(RecyclerView.LayoutManager)
+ */
+ internal abstract class OrientationHelper
+ {
+ public static readonly int HORIZONTAL = 0;
+ public static readonly int VERTICAL = 1;
+
+ private static readonly int INVALID_SIZE = -1;
+
+ protected FlexibleView.LayoutManager mLayoutManager;
+
+ private float mLastTotalSpace = INVALID_SIZE;
+
+ public OrientationHelper(FlexibleView.LayoutManager layoutManager)
+ {
+ mLayoutManager = layoutManager;
+ }
+
+ /**
+ * Call this method after onLayout method is complete if state is NOT pre-layout.
+ * This method records information like layout bounds that might be useful in the next layout
+ * calculations.
+ */
+ public void OnLayoutComplete()
+ {
+ mLastTotalSpace = GetTotalSpace();
+ }
+
+ /**
+ * Returns the layout space change between the previous layout pass and current layout pass.
+ * Make sure you call {@link #onLayoutComplete()} at the end of your LayoutManager's
+ * {@link RecyclerView.LayoutManager#onLayoutChildren(RecyclerView.Recycler,
+ * RecyclerView.State)} method.
+ *
+ * @return The difference between the current total space and previous layout's total space.
+ * @see #onLayoutComplete()
+ */
+ public float GetTotalSpaceChange()
+ {
+ return INVALID_SIZE == mLastTotalSpace ? 0 : GetTotalSpace() - mLastTotalSpace;
+ }
+
+ /**
+ * Returns the start of the view including its decoration and margin.
+ * For example, for the horizontal helper, if a View's left is at pixel 20, has 2px left
+ * decoration and 3px left margin, returned value will be 15px.
+ *
+ * @param view The view element to check
+ * @return The first pixel of the element
+ * @see #getDecoratedEnd(android.view.View)
+ */
+ public abstract float GetViewHolderStart(FlexibleView.ViewHolder holder);
+
+ /**
+ * Returns the end of the view including its decoration and margin.
+ * For example, for the horizontal helper, if a View's right is at pixel 200, has 2px right
+ * decoration and 3px right margin, returned value will be 205.
+ *
+ * @param view The view element to check
+ * @return The last pixel of the element
+ * @see #getDecoratedStart(android.view.View)
+ */
+ public abstract float GetViewHolderEnd(FlexibleView.ViewHolder holder);
+
+ /**
+ * Returns the space occupied by this View in the current orientation including decorations and
+ * margins.
+ *
+ * @param view The view element to check
+ * @return Total space occupied by this view
+ * @see #getDecoratedMeasurementInOther(View)
+ */
+ public abstract float GetViewHolderMeasurement(FlexibleView.ViewHolder holder);
+
+ /**
+ * Returns the space occupied by this View in the perpendicular orientation including
+ * decorations and margins.
+ *
+ * @param view The view element to check
+ * @return Total space occupied by this view in the perpendicular orientation to current one
+ * @see #getDecoratedMeasurement(View)
+ */
+ public abstract float GetViewHolderMeasurementInOther(FlexibleView.ViewHolder holder);
+
+ /**
+ * Returns the start position of the layout after the start padding is added.
+ *
+ * @return The very first pixel we can draw.
+ */
+ public abstract float GetStartAfterPadding();
+
+ /**
+ * Returns the end position of the layout after the end padding is removed.
+ *
+ * @return The end boundary for this layout.
+ */
+ public abstract float GetEndAfterPadding();
+
+ /**
+ * Returns the end position of the layout without taking padding into account.
+ *
+ * @return The end boundary for this layout without considering padding.
+ */
+ public abstract float GetEnd();
+
+ /**
+ * Offsets all children's positions by the given amount.
+ *
+ * @param amount Value to add to each child's layout parameters
+ */
+ public abstract void OffsetChildren(float amount, bool immediate);
+
+ /**
+ * Returns the total space to layout. This number is the difference between
+ * {@link #getEndAfterPadding()} and {@link #getStartAfterPadding()}.
+ *
+ * @return Total space to layout children
+ */
+ public abstract float GetTotalSpace();
+
+ /**
+ * Offsets the child in this orientation.
+ *
+ * @param view View to offset
+ * @param offset offset amount
+ */
+ internal abstract void OffsetChild(FlexibleView.ViewHolder holder, int offset);
+
+ /**
+ * Returns the padding at the end of the layout. For horizontal helper, this is the right
+ * padding and for vertical helper, this is the bottom padding. This method does not check
+ * whether the layout is RTL or not.
+ *
+ * @return The padding at the end of the layout.
+ */
+ public abstract float GetEndPadding();
+
+ /**
+ * Creates an OrientationHelper for the given LayoutManager and orientation.
+ *
+ * @param layoutManager LayoutManager to attach to
+ * @param orientation Desired orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}
+ * @return A new OrientationHelper
+ */
+ public static OrientationHelper CreateOrientationHelper(
+ FlexibleView.LayoutManager layoutManager, int orientation)
+ {
+ if (orientation == HORIZONTAL)
+ {
+ return CreateHorizontalHelper(layoutManager);
+ }
+ else if (orientation == VERTICAL)
+ {
+ return CreateVerticalHelper(layoutManager);
+ }
+
+ throw new ArgumentException("invalid orientation");
+ }
+
+
+ /**
+ * Creates a horizontal OrientationHelper for the given LayoutManager.
+ *
+ * @param layoutManager The LayoutManager to attach to.
+ * @return A new OrientationHelper
+ */
+ public static OrientationHelper CreateHorizontalHelper(FlexibleView.LayoutManager layoutManager)
+ {
+ return new HorizontalHelper(layoutManager);
+
+ }
+ /**
+ * Creates a vertical OrientationHelper for the given LayoutManager.
+ *
+ * @param layoutManager The LayoutManager to attach to.
+ * @return A new OrientationHelper
+ */
+ public static OrientationHelper CreateVerticalHelper(FlexibleView.LayoutManager layoutManager)
+ {
+ return new VerticalHelper(layoutManager);
+ }
+ }
+
+ internal class HorizontalHelper : OrientationHelper
+ {
+ public HorizontalHelper(FlexibleView.LayoutManager layoutManager): base(layoutManager)
+ {
+
+ }
+
+ public override float GetEndAfterPadding()
+ {
+ return mLayoutManager.GetWidth() - mLayoutManager.GetPaddingRight();
+ }
+
+ public override float GetEnd()
+ {
+ return mLayoutManager.GetWidth();
+ }
+
+ public override void OffsetChildren(float amount, bool immediate)
+ {
+ mLayoutManager.OffsetChildrenHorizontal(amount, immediate);
+ }
+
+
+ public override float GetStartAfterPadding()
+ {
+ return mLayoutManager.GetPaddingLeft();
+ }
+
+ public override float GetViewHolderMeasurement(FlexibleView.ViewHolder holder)
+ {
+ return holder.Right - holder.Left;
+ }
+
+ public override float GetViewHolderMeasurementInOther(FlexibleView.ViewHolder holder)
+ {
+ return holder.Bottom - holder.Top;
+ }
+
+ public override float GetViewHolderEnd(FlexibleView.ViewHolder holder)
+ {
+ return holder.Right;
+ }
+
+ public override float GetViewHolderStart(FlexibleView.ViewHolder holder)
+ {
+ return holder.Left;
+ }
+
+ public override float GetTotalSpace()
+ {
+ return mLayoutManager.GetWidth() - mLayoutManager.GetPaddingLeft()
+ - mLayoutManager.GetPaddingRight();
+ }
+
+ internal override void OffsetChild(FlexibleView.ViewHolder holder, int offset)
+ {
+ //holder.offsetLeftAndRight(offset);
+ }
+
+ public override float GetEndPadding()
+ {
+ return mLayoutManager.GetPaddingRight();
+ }
+
+ }
+
+ internal class VerticalHelper : OrientationHelper
+ {
+ public VerticalHelper(FlexibleView.LayoutManager layoutManager) : base(layoutManager)
+ {
+
+ }
+
+ public override float GetEndAfterPadding()
+ {
+ return mLayoutManager.GetHeight() - mLayoutManager.GetPaddingBottom();
+ }
+
+ public override float GetEnd()
+ {
+ return mLayoutManager.GetHeight();
+ }
+
+ public override void OffsetChildren(float amount, bool immediate)
+ {
+ mLayoutManager.OffsetChildrenVertical(amount, immediate);
+ }
+
+ public override float GetStartAfterPadding()
+ {
+ return mLayoutManager.GetPaddingTop();
+ }
+
+ public override float GetViewHolderMeasurement(FlexibleView.ViewHolder holder)
+ {
+ return holder.Bottom - holder.Top;
+ }
+
+ public override float GetViewHolderMeasurementInOther(FlexibleView.ViewHolder holder)
+ {
+ return holder.Right - holder.Left;
+ }
+
+ public override float GetViewHolderEnd(FlexibleView.ViewHolder holder)
+ {
+ return holder.Bottom;
+ }
+
+ public override float GetViewHolderStart(FlexibleView.ViewHolder holder)
+ {
+ return holder.Top;
+ }
+
+ public override float GetTotalSpace()
+ {
+ return mLayoutManager.GetHeight() - mLayoutManager.GetPaddingTop()
+ - mLayoutManager.GetPaddingBottom();
+ }
+
+ internal override void OffsetChild(FlexibleView.ViewHolder holder, int offset)
+ {
+ //holder.offsetTopAndBottom(offset);
+ }
+
+ public override float GetEndPadding()
+ {
+ return mLayoutManager.GetPaddingBottom();
+ }
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// InputField is a editable input compoment
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class InputField : Control
+ {
+ // the background image
+ private ImageView bgImage = null;
+ // the textField
+ private TextField textField = null;
+ // the attributes of the inputField
+ private InputFieldAttributes inputFieldAttrs = null;
+ // the flag indicate should relayout the textField in base class
+ private bool relayoutTextField = true;
+
+ /// <summary>
+ /// Initializes a new instance of the InputField class.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InputField() : base()
+ {
+ Initialize();
+ }
+
+ /// 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 InputField(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the InputField class.
+ /// </summary>
+ /// <param name="attributes">Create Header by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InputField(InputFieldAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Gets or sets the property for the enabled state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool StateEnabled
+ {
+ get
+ {
+ return Sensitive;
+ }
+ set
+ {
+ Sensitive = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the property for the text content.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Text
+ {
+ get
+ {
+ return textField.Text;
+ }
+ set
+ {
+ textField.Text = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the property for the hint text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string HintText
+ {
+ get
+ {
+ return textField.PlaceholderText;
+ }
+ set
+ {
+ textField.PlaceholderText = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the property for the color of the input text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TextColor
+ {
+ get
+ {
+ return textField.TextColor;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ if (null == inputFieldAttrs.InputBoxAttributes.TextColor)
+ {
+ inputFieldAttrs.InputBoxAttributes.TextColor = new ColorSelector();
+ }
+ inputFieldAttrs.InputBoxAttributes.TextColor.All = value;
+ textField.TextColor = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color HintTextColor
+ {
+ get
+ {
+ return textField.PlaceholderTextColor;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ if (null == inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor)
+ {
+ inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = new ColorSelector();
+ }
+ inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor.All = value;
+ textField.PlaceholderTextColor = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets primary cursor color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color PrimaryCursorColor
+ {
+ get
+ {
+ return textField.PrimaryCursorColor;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ if (null == inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor)
+ {
+ inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = new ColorSelector();
+ }
+ inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor.All = value;
+ textField.PrimaryCursorColor = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets secondary cursor color.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color SecondaryCursorColor
+ {
+ get
+ {
+ return textField.SecondaryCursorColor;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ if (null == inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor)
+ {
+ inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor = new ColorSelector();
+ }
+ inputFieldAttrs.InputBoxAttributes.SecondaryCursorColor.All = value;
+ textField.SecondaryCursorColor = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets font family of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get
+ {
+ return textField.FontFamily;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ inputFieldAttrs.InputBoxAttributes.FontFamily = value;
+ textField.FontFamily = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets point size of text.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float PointSize
+ {
+ get
+ {
+ return textField.PointSize;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ if (null == inputFieldAttrs.InputBoxAttributes.PointSize)
+ {
+ inputFieldAttrs.InputBoxAttributes.PointSize = new FloatSelector();
+ }
+ inputFieldAttrs.InputBoxAttributes.PointSize.All = value;
+ textField.PointSize = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets enable cursor blink.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool EnableCursorBlink
+ {
+ get
+ {
+ return textField.EnableCursorBlink;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ inputFieldAttrs.InputBoxAttributes.EnableCursorBlink = value;
+ textField.EnableCursorBlink = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets enable selection.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool EnableSelection
+ {
+ get
+ {
+ return textField.EnableSelection;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ inputFieldAttrs.InputBoxAttributes.EnableSelection = value;
+ textField.EnableSelection = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets cursor width.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CursorWidth
+ {
+ get
+ {
+ return textField.CursorWidth;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ inputFieldAttrs.InputBoxAttributes.CursorWidth = value;
+ textField.CursorWidth = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets if enable ellipsis.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool EnableEllipsis
+ {
+ get
+ {
+ return textField.Ellipsis;
+ }
+ set
+ {
+ CreateTextFieldAttributes();
+ inputFieldAttrs.InputBoxAttributes.EnableEllipsis = value;
+ textField.Ellipsis = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets background image's resource url of input field.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string BackgroundImageURL
+ {
+ get
+ {
+ return inputFieldAttrs.BackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (inputFieldAttrs.BackgroundImageAttributes.ResourceUrl == null)
+ {
+ inputFieldAttrs.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ inputFieldAttrs.BackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's border in Button.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle BackgroundImageBorder
+ {
+ get
+ {
+ return inputFieldAttrs.BackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (inputFieldAttrs.BackgroundImageAttributes.Border == null)
+ {
+ inputFieldAttrs.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ inputFieldAttrs.BackgroundImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and Sets Space.
+ /// </summary>
+ public int Space
+ {
+ get
+ {
+ return inputFieldAttrs.Space ?? 0;
+ }
+ set
+ {
+ inputFieldAttrs.Space = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Get Input Field attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new InputFieldAttributes();
+ }
+
+ /// <summary>
+ /// Dispose Input Field and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+ if (type == DisposeTypes.Explicit)
+ {
+ if (bgImage != null)
+ {
+ this.Remove(bgImage);
+ bgImage.Dispose();
+ bgImage = null;
+ }
+ if (null != textField)
+ {
+ textField.FocusGained -= OnTextFieldFocusGained;
+ textField.FocusLost -= OnTextFieldFocusLost;
+ textField.TextChanged -= OnTextFieldTextChanged;
+ textField.KeyEvent -= OnTextFieldKeyEvent;
+ this.Remove(textField);
+ textField.Dispose();
+ textField = null;
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update Input Field by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ ApplyAttributes(this, inputFieldAttrs);
+ ApplyAttributes(bgImage, inputFieldAttrs.BackgroundImageAttributes);
+ ApplyAttributes(textField, inputFieldAttrs.InputBoxAttributes);
+ RelayoutComponent();
+ OnLayoutDirectionChanged();
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ InputFieldAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as InputFieldAttributes;
+ if (tempAttributes != null)
+ {
+ attributes = inputFieldAttrs = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Theme change callback when text field focus is gained, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnTextFieldFocusGained(object source, EventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Theme change callback when text field is lost, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnTextFieldFocusLost(object source, EventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Theme change callback when text field's text is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnTextFieldTextChanged(object sender, TextField.TextChangedEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Theme change callback when text field have a key event, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual bool OnTextFieldKeyEvent(object source, KeyEventArgs e)
+ {
+ return false;
+ }
+
+ /// <summary>
+ /// Set the text field 2D size
+ /// </summary>
+ /// <param name="w">Input Field' width.</param>
+ /// <param name="h">Input Field' height.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void SetTextFieldSize2D(int w, int h)
+ {
+ if (textField != null)
+ {
+ textField.Size2D = new Size2D(w, h);
+ }
+ }
+
+ /// <summary>
+ /// Set the text field X pose
+ /// </summary>
+ /// <param name="x">Input Field' X.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void SetTextFieldPosX(int x)
+ {
+ if (textField != null)
+ {
+ textField.PositionX = x;
+ }
+ }
+
+ /// <summary>
+ /// Set the text field text color
+ /// </summary>
+ /// <param name="color">Input Field' color.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void SetTextFieldTextColor(Color color)
+ {
+ if (textField != null)
+ {
+ textField.TextColor = color;
+ }
+ }
+
+ /// <summary>
+ /// Set the text field relayout flag
+ /// </summary>
+ /// <param name="value">relayout text field' value.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void RelayoutTextField(bool value)
+ {
+ relayoutTextField = value;
+ }
+
+ private void Initialize()
+ {
+ inputFieldAttrs = attributes as InputFieldAttributes;
+ if (null == inputFieldAttrs)
+ {
+ throw new Exception("Fail to get the InputField attributes.");
+ }
+
+ bgImage = new ImageView();
+ if (null == bgImage)
+ {
+ throw new Exception("Fail to create background image.");
+ }
+
+ textField = new TextField();
+ if (null == textField)
+ {
+ throw new Exception("Fail to create text field.");
+ }
+
+ if (null != inputFieldAttrs.BackgroundImageAttributes)
+ {
+ bgImage.WidthResizePolicy = ResizePolicyType.FillToParent;
+ bgImage.HeightResizePolicy = ResizePolicyType.FillToParent;
+ bgImage.ParentOrigin = Tizen.NUI.ParentOrigin.Center;
+ bgImage.PivotPoint = Tizen.NUI.PivotPoint.Center;
+ bgImage.PositionUsesPivotPoint = true;
+ this.Add(bgImage);
+ }
+
+ if (null != inputFieldAttrs.InputBoxAttributes)
+ {
+ textField.WidthResizePolicy = ResizePolicyType.Fixed;
+ textField.HeightResizePolicy = ResizePolicyType.Fixed;
+ textField.ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft;
+ textField.PivotPoint = Tizen.NUI.PivotPoint.CenterLeft;
+ textField.PositionUsesPivotPoint = true;
+ this.Add(textField);
+
+ textField.FocusGained += OnTextFieldFocusGained;
+ textField.FocusLost += OnTextFieldFocusLost;
+ textField.TextChanged += OnTextFieldTextChanged;
+ textField.KeyEvent += OnTextFieldKeyEvent;
+ }
+ }
+
+ private void OnLayoutDirectionChanged()
+ {
+ if (inputFieldAttrs == null) return;
+ if (textField != null)
+ {
+ if (LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ if(inputFieldAttrs.InputBoxAttributes != null)
+ {
+ inputFieldAttrs.InputBoxAttributes.HorizontalAlignment = HorizontalAlignment.Begin;
+ inputFieldAttrs.InputBoxAttributes.ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft;
+ inputFieldAttrs.InputBoxAttributes.PivotPoint = Tizen.NUI.PivotPoint.CenterLeft;
+ inputFieldAttrs.InputBoxAttributes.PositionUsesPivotPoint = true;
+ }
+ textField.HorizontalAlignment = HorizontalAlignment.Begin;
+ textField.ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft;
+ textField.PivotPoint = Tizen.NUI.PivotPoint.CenterLeft;
+ textField.PositionUsesPivotPoint = true;
+ }
+ else //ViewLayoutDirectionType.RTL
+ {
+ if (inputFieldAttrs.InputBoxAttributes != null)
+ {
+ inputFieldAttrs.InputBoxAttributes.HorizontalAlignment = HorizontalAlignment.End;
+ inputFieldAttrs.InputBoxAttributes.ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight;
+ inputFieldAttrs.InputBoxAttributes.PivotPoint = Tizen.NUI.PivotPoint.CenterRight;
+ }
+ textField.HorizontalAlignment = HorizontalAlignment.End;
+ textField.ParentOrigin = Tizen.NUI.ParentOrigin.CenterRight;
+ textField.PivotPoint = Tizen.NUI.PivotPoint.CenterRight;
+ textField.PositionUsesPivotPoint = true;
+ }
+ }
+ }
+
+ private void RelayoutComponent()
+ {
+ if (!relayoutTextField)
+ {
+ return;
+ }
+ int space = inputFieldAttrs.Space ?? 0;
+
+ if (textField != null)
+ {
+ textField.Size2D = new Size2D(this.Size2D.Width - space * 2, this.Size2D.Height);
+ textField.PositionX = space;
+ }
+ }
+
+ private void CreateBackgroundAttributes()
+ {
+ if (null == inputFieldAttrs.BackgroundImageAttributes)
+ {
+ inputFieldAttrs.BackgroundImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateTextFieldAttributes()
+ {
+ if (null == inputFieldAttrs.InputBoxAttributes)
+ {
+ inputFieldAttrs.InputBoxAttributes = new TextFieldAttributes();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The Loading class of nui component. It's used to indicate informs users of the ongoing operation.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Loading : Control
+ {
+ private LoadingAttributes loadingAttrs = null; // Loading Attributes
+ private AnimatedImageVisual imageVisual = null;
+
+ /// <summary>
+ /// The constructor of Loading
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Loading() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Constructor of the Loading class with special style.
+ /// </summary>
+ /// <param name="style">The string to initialize the Loading.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Loading(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Loading class with specific Attributes.
+ /// </summary>
+ /// <param name="attributes">The Attributes object to initialize the Loading.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Loading(LoadingAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Gets or sets loading image resource array.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string[] ImageArray
+ {
+ get
+ {
+ return loadingAttrs.ImageArray;
+ }
+ set
+ {
+ if (null != value)
+ {
+ loadingAttrs.ImageArray = value;
+ imageVisual.URLS = new List<string>(value);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets loading size.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D LoadingSize
+ {
+ get
+ {
+ return loadingAttrs.LoadingSize ?? new Size2D(100, 100);
+ }
+ set
+ {
+ loadingAttrs.LoadingSize = value;
+ imageVisual.Size = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets FPS of loading.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int FPS
+ {
+ get
+ {
+ return loadingAttrs?.FPS?.All ?? (int)(1000.0f / 16.6f);
+ }
+ set
+ {
+ if (value != 0) //It will crash if 0
+ {
+ if (null == loadingAttrs.FPS)
+ {
+ loadingAttrs.FPS = new IntSelector();
+ }
+ loadingAttrs.FPS.All = value;
+ imageVisual.FrameDelay = 1000.0f / value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get Loading attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new LoadingAttributes();
+ }
+
+ /// <summary>
+ /// Dispose Loading.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ RemoveVisual("loadingImageVisual");
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+ //Unreference this from if a static instance refer to this.
+
+ //You must call base.Dispose(type) just before exit.
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update Loading by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ }
+
+ private void Initialize()
+ {
+ loadingAttrs = attributes as LoadingAttributes;
+ if (null == loadingAttrs)
+ {
+ throw new Exception("Loading attribute parse error.");
+ }
+ ApplyAttributes(this, loadingAttrs);
+
+ imageVisual = new AnimatedImageVisual()
+ {
+ URLS = new List<string>(),
+ FrameDelay = 16.6f,
+ LoopCount = -1,
+ Size = new Size2D(100, 100),
+ Position = new Vector2(0, 0),
+ Origin = Visual.AlignType.Center,
+ AnchorPoint = Visual.AlignType.Center
+ };
+
+ UpdateVisual();
+
+ this.AddVisual("loadingImageVisual", imageVisual);
+ }
+
+ private void UpdateVisual()
+ {
+ if (null != loadingAttrs.ImageArray)
+ {
+ imageVisual.URLS = new List<string>(loadingAttrs.ImageArray);
+ }
+ if (null != loadingAttrs.FPS)
+ {
+ imageVisual.FrameDelay = 1000.0f / (float)loadingAttrs.FPS.All;
+ }
+ if (null != loadingAttrs.LoadingSize)
+ {
+ imageVisual.Size = loadingAttrs.LoadingSize;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Pagination shows the number of pages available and the currently active page.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Pagination: Control
+ {
+ private PaginationAttributes paginationAttributes;
+
+ private VisualView container;
+
+ private List<ImageVisual> indicatorList = new List<ImageVisual>();
+ private ImageVisual selectIndicator;
+
+ private int indicatorCount = 0;
+ private int selectedIndex = -1;
+
+ /// <summary>
+ /// Creates a new instance of a Pagination.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Pagination() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Pagination using style.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Pagination(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Pagination using attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Pagination(PaginationAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D IndicatorSize
+ {
+ get
+ {
+ return paginationAttributes?.IndicatorSize;
+ }
+ set
+ {
+ if (value == null || paginationAttributes == null)
+ {
+ return;
+ }
+ paginationAttributes.IndicatorSize = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the background resource of indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IndicatorBackgroundURL
+ {
+ get
+ {
+ return paginationAttributes?.IndicatorBackgroundURL;
+ }
+ set
+ {
+ if (value == null || paginationAttributes == null)
+ {
+ return;
+ }
+ paginationAttributes.IndicatorBackgroundURL = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource of the select indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string IndicatorSelectURL
+ {
+ get
+ {
+ return paginationAttributes?.IndicatorSelectURL;
+ }
+ set
+ {
+ if (value == null || paginationAttributes == null)
+ {
+ return;
+ }
+ paginationAttributes.IndicatorSelectURL = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the space of the indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IndicatorSpacing
+ {
+ get
+ {
+ return (int)paginationAttributes?.IndicatorSpacing;
+ }
+ set
+ {
+ if (paginationAttributes == null)
+ {
+ return;
+ }
+ paginationAttributes.IndicatorSpacing = value;
+ RelayoutRequest();
+ }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the count of the pages/indicators.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int IndicatorCount
+ {
+ get
+ {
+ return indicatorCount;
+ }
+ set
+ {
+ if (indicatorCount == value || indicatorCount < 0)
+ {
+ return;
+ }
+ if (indicatorCount < value)
+ {
+ for (int i = indicatorCount; i < value; i++)
+ {
+ CreateIndicator();
+ }
+ }
+ else
+ {
+ for (int i = value; i < indicatorCount; i++)
+ {
+ ImageVisual indicator = indicatorList[i];
+ container.RemoveVisual("Indicator" + i);
+ }
+ indicatorList.RemoveRange(value, indicatorCount - value);
+ if(value <= 0)
+ {
+ container.RemoveVisual("SelectIndicator");
+ }
+ else if(selectedIndex >= value)
+ {
+ selectedIndex = 0;
+ SelectIn(indicatorList[selectedIndex]);
+ }
+ }
+ indicatorCount = value;
+
+ UpdateContainer();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the index of the select indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SelectedIndex
+ {
+ get
+ {
+ return selectedIndex;
+ }
+ set
+ {
+ if (selectedIndex == value)
+ {
+ return;
+ }
+ if (selectedIndex >= 0 && selectedIndex < indicatorCount)
+ {
+ SelectOut(indicatorList[selectedIndex]);
+ }
+ selectedIndex = value;
+ if (selectedIndex >= 0 && selectedIndex < indicatorCount)
+ {
+ SelectIn(indicatorList[selectedIndex]);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the position of a indicator by index.
+ /// </summary>
+ /// <param name="index">Indicator index</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Position2D GetIndicatorPosition(int index)
+ {
+ if (index < 0 || index >= indicatorList.Count)
+ {
+ return null;
+ }
+ return new Vector2(indicatorList[index].Position.X + container.PositionX, indicatorList[index].Position.Y + container.PositionY);
+ }
+
+ /// <summary>
+ /// You can override it to do your select out operation.
+ /// </summary>
+ /// <param name="selectOutIndicator">The indicator will be selected out</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void SelectOut(VisualMap selectOutIndicator)
+ {
+
+ }
+
+ /// <summary>
+ /// You can override it to do your select in operation.
+ /// </summary>
+ /// <param name="selectInIndicator">The indicator will be selected in</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void SelectIn(VisualMap selectInIndicator)
+ {
+ selectIndicator.Position = selectInIndicator.Position;
+ }
+
+ /// <summary>
+ /// you can override it to create your own default attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new PaginationAttributes();
+ }
+
+ /// <summary>
+ /// you can override it to clean-up your own resources.
+ /// </summary>
+ /// <param name="type">DisposeTypes</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ container.RemoveAll();
+ indicatorList.Clear();
+
+ this.Remove(container);
+ container.Dispose();
+ container = null;
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// you can override it to update your own resources.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+
+ for (int i = 0; i < indicatorList.Count; i++)
+ {
+ ImageVisual indicator = indicatorList[i];
+ indicator.URL = paginationAttributes.IndicatorBackgroundURL;
+ indicator.Size = paginationAttributes.IndicatorSize;
+ indicator.Position = new Position2D((int)(paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * i, 0);
+ }
+
+ selectIndicator.URL = paginationAttributes.IndicatorSelectURL;
+ selectIndicator.Size = paginationAttributes.IndicatorSize;
+
+ //UpdateContainer();
+ }
+
+ private void Initialize()
+ {
+ paginationAttributes = attributes as PaginationAttributes;
+ if (paginationAttributes == null)
+ {
+ throw new Exception("Pagination attributes is null.");
+ }
+
+ container = new VisualView()
+ {
+ Name = "Container",
+ ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
+ PositionUsesPivotPoint = true,
+ //BackgroundColor = Color.Yellow
+ };
+ this.Add(container);
+
+ selectIndicator = new ImageVisual()
+ {
+ URL = " "
+ };
+ container.AddVisual("SelectIndicator", selectIndicator);
+ }
+
+ private void CreateIndicator()
+ {
+ if (paginationAttributes == null)
+ {
+ return;
+ }
+ ImageVisual indicator = new ImageVisual
+ {
+ URL = paginationAttributes.IndicatorBackgroundURL,
+ Size = paginationAttributes.IndicatorSize
+ };
+ indicator.Position = new Position2D((int)(paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * indicatorList.Count, 0);
+ container.AddVisual("Indicator" + indicatorList.Count, indicator);
+ indicatorList.Add(indicator);
+ }
+
+ private void UpdateContainer()
+ {
+ if (paginationAttributes == null)
+ {
+ return;
+ }
+ if (indicatorList.Count > 0)
+ {
+ container.SizeWidth = (paginationAttributes.IndicatorSize.Width + paginationAttributes.IndicatorSpacing) * indicatorList.Count - paginationAttributes.IndicatorSpacing;
+ }
+ else
+ {
+ container.SizeWidth = 0;
+ }
+ container.SizeHeight = paginationAttributes.IndicatorSize.Height;
+ container.PositionX = (int)((this.SizeWidth - container.SizeWidth) / 2);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Popup is one kind of common component, it can be used as popup window.
+ /// User can handle Popup button count, head title and content area.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Popup : Control
+ {
+ private ImageView backgroundImage;
+ private ImageView shadowImage;
+ private TextLabel titleText;
+ private List<Button> buttonList;
+ private List<string> buttonTextList = new List<string>();
+
+ private PopupAttributes popupAttributes;
+ private int buttonCount = 0;
+
+ /// <summary>
+ /// Creates a new instance of a Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Popup() : base()
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Popup with style.
+ /// </summary>
+ /// <param name="style">Create Popup by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Popup(string style) : base(style)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Popup with attributes.
+ /// </summary>
+ /// <param name="attributes">Create Popup by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Popup(PopupAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ButtonClickEventArgs> PopupButtonClickedEvent;
+
+ /// <summary>
+ /// Title text string in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string TitleText
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.Text?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTitleTextAttributes();
+ if (popupAttributes.TitleTextAttributes.Text == null)
+ {
+ popupAttributes.TitleTextAttributes.Text = new StringSelector();
+ }
+ popupAttributes.TitleTextAttributes.Text.All = value;
+
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button count in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ButtonCount
+ {
+ get
+ {
+ return buttonCount;
+ }
+ set
+ {
+ if (buttonCount != value)
+ {
+ buttonCount = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Content view in Popup, only can be gotten.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 View ContentView
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Shadow image's resource url in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ShadowImageURL
+ {
+ get
+ {
+ return popupAttributes?.ShadowImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ if (popupAttributes.ShadowImageAttributes.ResourceUrl == null)
+ {
+ popupAttributes.ShadowImageAttributes.ResourceUrl = new StringSelector();
+ }
+ popupAttributes.ShadowImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shadow image's border in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle ShadowImageBorder
+ {
+ get
+ {
+ return popupAttributes?.ShadowImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateShadowAttributes();
+ if (popupAttributes.ShadowImageAttributes.Border == null)
+ {
+ popupAttributes.ShadowImageAttributes.Border = new RectangleSelector();
+ }
+ popupAttributes.ShadowImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's resource url in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string BackgroundImageURL
+ {
+ get
+ {
+ return popupAttributes?.BackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (popupAttributes.BackgroundImageAttributes.ResourceUrl == null)
+ {
+ popupAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ popupAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's border in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle BackgroundImageBorder
+ {
+ get
+ {
+ return popupAttributes?.BackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateBackgroundAttributes();
+ if (popupAttributes.BackgroundImageAttributes.Border == null)
+ {
+ popupAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ popupAttributes.BackgroundImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Title text point size in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float TitlePointSize
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ if (popupAttributes.TitleTextAttributes.PointSize == null)
+ {
+ popupAttributes.TitleTextAttributes.PointSize = new FloatSelector();
+ }
+ popupAttributes.TitleTextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Title text font family in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string TitleFontFamily
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ popupAttributes.TitleTextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Title text color in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TitleTextColor
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ if (popupAttributes.TitleTextAttributes.TextColor == null)
+ {
+ popupAttributes.TitleTextAttributes.TextColor = new ColorSelector();
+ }
+ popupAttributes.TitleTextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Title text horizontal alignment in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignment TitleTextHorizontalAlignment
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ popupAttributes.TitleTextAttributes.HorizontalAlignment = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Title text's position in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Position2D TitleTextPosition2D
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.Position2D ?? new Position2D(0, 0);
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ popupAttributes.TitleTextAttributes.Position2D = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Title text's height in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TitleHeight
+ {
+ get
+ {
+ return popupAttributes?.TitleTextAttributes?.Size2D?.Height ?? 0;
+ }
+ set
+ {
+ CreateTitleTextAttributes();
+ popupAttributes.TitleTextAttributes.Size2D.Height = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Shadow offset in Popup, including left, right, up and bottom offset.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector4 ShadowOffset
+ {
+ get
+ {
+ return popupAttributes?.ShadowOffset;
+ }
+ set
+ {
+ if (value != null)
+ {
+ if (popupAttributes.ShadowOffset == null)
+ {
+ popupAttributes.ShadowOffset = new Vector4(0, 0, 0, 0);
+ }
+ popupAttributes.ShadowOffset = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button height in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ButtonHeight
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.Size2D?.Height ?? 0;
+ }
+ set
+ {
+ CreateButtonAttributes();
+ popupAttributes.ButtonAttributes.Size2D.Height = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text point size in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float ButtonPointSize
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.TextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateButtonAttributes();
+ if (popupAttributes.ButtonAttributes.TextAttributes.PointSize == null)
+ {
+ popupAttributes.ButtonAttributes.TextAttributes.PointSize = new FloatSelector();
+ }
+ popupAttributes.ButtonAttributes.TextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text font family in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ButtonFontFamily
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateButtonAttributes();
+ popupAttributes.ButtonAttributes.TextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button text color in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color ButtonTextColor
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.TextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateButtonAttributes();
+ if (popupAttributes.ButtonAttributes.TextAttributes.TextColor == null)
+ {
+ popupAttributes.ButtonAttributes.TextAttributes.TextColor = new ColorSelector();
+ }
+ popupAttributes.ButtonAttributes.TextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button overlay background color selector in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector ButtonOverLayBackgroundColorSelector
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.OverlayImageAttributes?.BackgroundColor;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonAttributes();
+ popupAttributes.ButtonAttributes.OverlayImageAttributes.BackgroundColor = value.Clone() as ColorSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button text horizontal alignment in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignment ButtonTextAlignment
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ }
+ set
+ {
+ CreateButtonAttributes();
+ popupAttributes.ButtonAttributes.TextAttributes.HorizontalAlignment = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Button background image's resource url in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ButtonBackgroundImageURL
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.BackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonAttributes();
+ if (popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl == null)
+ {
+ popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ popupAttributes.ButtonAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Button background image's border in Popup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle ButtonBackgroundImageBorder
+ {
+ get
+ {
+ return popupAttributes?.ButtonAttributes?.BackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateButtonAttributes();
+ if (popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border == null)
+ {
+ popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ popupAttributes.ButtonAttributes.BackgroundImageAttributes.Border.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Set button text by index.
+ /// </summary>
+ /// <param name="index">Button index.</param>
+ /// <param name="text">Button text string.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SetButtonText(int index, string text)
+ {
+ if(index < 0 && index >= buttonCount)
+ {
+ return;
+ }
+ if(buttonTextList.Count < index + 1)
+ {
+ for (int i = buttonTextList.Count; i < index + 1; i++)
+ {
+ buttonTextList.Add("");
+ }
+ }
+ buttonTextList[index] = text;
+ RelayoutRequest();
+ }
+
+ /// <summary>
+ /// Dispose Popup and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (titleText != null)
+ {
+ Remove(titleText);
+ titleText.Dispose();
+ titleText = null;
+ }
+ if (backgroundImage != null)
+ {
+ Remove(backgroundImage);
+ backgroundImage.Dispose();
+ backgroundImage = null;
+ }
+ if (shadowImage != null)
+ {
+ Remove(shadowImage);
+ shadowImage.Dispose();
+ shadowImage = null;
+ }
+ if (ContentView != null)
+ {
+ Remove(ContentView);
+ ContentView.Dispose();
+ ContentView = null;
+ }
+ if (buttonList != null)
+ {
+ foreach(Button btn in buttonList)
+ {
+ Remove(btn);
+ btn.Dispose();
+ }
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Focus gained callback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusGained()
+ {
+ base.OnFocusGained();
+ }
+ /// <summary>
+ /// Focus lost callback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusLost()
+ {
+ base.OnFocusLost();
+ }
+
+ /// <summary>
+ /// Get Popup attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new PopupAttributes();
+ }
+
+ /// <summary>
+ /// Update Popup by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ int w = 0;
+ int h = 0;
+ int titleX = 0;
+ int titleY = 0;
+ int titleH = 0;
+ int buttonH = 0;
+
+ if (popupAttributes.ShadowImageAttributes != null)
+ {
+ if (shadowImage == null)
+ {
+ shadowImage = new ImageView();
+ Add(shadowImage);
+ }
+ ApplyAttributes(shadowImage, popupAttributes.ShadowImageAttributes);
+ w = Size2D.Width;
+ h = Size2D.Height;
+ if (popupAttributes.ShadowOffset != null)
+ {
+ w = (int)(Size2D.Width + popupAttributes.ShadowOffset.W + popupAttributes.ShadowOffset.X);
+ h = (int)(Size2D.Height + popupAttributes.ShadowOffset.Y + popupAttributes.ShadowOffset.Z);
+ }
+
+ shadowImage.Size2D = new Size2D(w, h);
+ }
+
+ if (popupAttributes.BackgroundImageAttributes != null)
+ {
+ if (backgroundImage == null)
+ {
+ backgroundImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ Add(backgroundImage);
+ }
+ ApplyAttributes(backgroundImage, popupAttributes.BackgroundImageAttributes);
+ }
+
+ if (popupAttributes.TitleTextAttributes != null)
+ {
+ if (titleText == null)
+ {
+ titleText = new TextLabel();
+ Add(titleText);
+ }
+
+ ApplyAttributes(titleText, popupAttributes.TitleTextAttributes);
+
+ if (titleText.Text != null && titleText.Text != "")
+ {
+ popupAttributes.TitleTextAttributes.Text = new StringSelector { All = titleText.Text };
+ w = (int)(Size2D.Width - titleText.PositionX * 2);
+
+ if (popupAttributes.TitleTextAttributes.Size2D != null)
+ {
+ titleH = titleText.Size2D.Height;
+ }
+ titleText.Size2D = new Size2D(w, titleH);
+
+ if (popupAttributes.TitleTextAttributes.Position2D != null)
+ {
+ titleX = popupAttributes.TitleTextAttributes.Position2D.X;
+ titleY = popupAttributes.TitleTextAttributes.Position2D.Y;
+ }
+ }
+ else
+ {
+ titleText.Size2D = new Size2D(0, 0);
+ }
+
+
+ }
+ ContentView.RaiseToTop();
+
+ UpdateButton(buttonCount);
+
+ if (buttonList != null && popupAttributes.ButtonAttributes != null && popupAttributes.ButtonAttributes.Size2D != null)
+ {
+ buttonH = popupAttributes.ButtonAttributes.Size2D.Height;
+ }
+ ContentView.Size2D = new Size2D(Size2D.Width - titleX * 2, Size2D.Height - titleY - titleH - buttonH);
+ ContentView.Position2D = new Position2D(titleX, titleY + titleH);
+
+ LayoutChild();
+ }
+
+ /// <summary>
+ /// Layout child in Popup and it can be override by user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void LayoutChild()
+ {
+ if (popupAttributes == null)
+ {
+ return;
+ }
+
+ if(titleText != null)
+ {
+ if(LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ if (popupAttributes.TitleTextAttributes != null)
+ {
+ popupAttributes.TitleTextAttributes.HorizontalAlignment = HorizontalAlignment.End;
+ }
+ titleText.HorizontalAlignment = HorizontalAlignment.End;
+ }
+ else if(LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ if (popupAttributes.TitleTextAttributes != null)
+ {
+ popupAttributes.TitleTextAttributes.HorizontalAlignment = HorizontalAlignment.Begin;
+ }
+ titleText.HorizontalAlignment = HorizontalAlignment.Begin;
+ }
+ }
+
+ if(buttonList != null && buttonList.Count > 0)
+ {
+ int pos = 0;
+ if (LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ for (int i = buttonList.Count - 1; i >= 0; i--)
+ {
+ buttonList[i].PositionX = pos;
+ pos += buttonList[i].Size2D.Width;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < buttonList.Count; i++)
+ {
+ buttonList[i].PositionX = pos;
+ pos += buttonList[i].Size2D.Width;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ PopupAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as PopupAttributes;
+ if (tempAttributes != null)
+ {
+ attributes = popupAttributes = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ private void Initialize()
+ {
+ popupAttributes = attributes as PopupAttributes;
+ if (popupAttributes == null)
+ {
+ throw new Exception("Popup attribute parse error.");
+ }
+
+ ApplyAttributes(this, popupAttributes);
+ LeaveRequired = true;
+
+ ContentView = new View()
+ {
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ PositionUsesPivotPoint = true
+ };
+ Add(ContentView);
+ ContentView.RaiseToTop();
+ }
+
+ private void CreateShadowAttributes()
+ {
+ if (popupAttributes.ShadowImageAttributes == null)
+ {
+ popupAttributes.ShadowImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ };
+ }
+ }
+
+ private void CreateBackgroundAttributes()
+ {
+ if (popupAttributes.BackgroundImageAttributes == null)
+ {
+ popupAttributes.BackgroundImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ }
+ }
+
+ private void CreateTitleTextAttributes()
+ {
+ if (popupAttributes.TitleTextAttributes == null)
+ {
+ popupAttributes.TitleTextAttributes = new TextAttributes()
+ {
+ Size2D = new Size2D(0, 0),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Bottom
+ };
+ }
+ }
+
+ private void CreateButtonAttributes()
+ {
+ if (popupAttributes.ButtonAttributes == null)
+ {
+ popupAttributes.ButtonAttributes = new ButtonAttributes()
+ {
+ Size2D = new Size2D(0, 0),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ TextAttributes = new TextAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center
+ },
+ BackgroundImageAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ Border = new RectangleSelector { All = new Rectangle(0, 0, 0, 0) },
+ },
+ OverlayImageAttributes = new ImageAttributes
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ Border = new RectangleSelector { All = new Rectangle(0, 0, 0, 0) },
+ },
+ };
+ }
+ }
+
+ private void UpdateButton(int count)
+ {
+ if(buttonList != null && buttonCount == buttonList.Count)
+ {
+ for (int i = 0; i < count; i++)
+ {
+ buttonList[i].TextColor = popupAttributes.ButtonAttributes.TextAttributes.TextColor.All;
+ }
+ return;
+ }
+
+ if (buttonList != null)
+ {
+ foreach (Button btn in buttonList)
+ {
+ btn.ClickEvent -= ButtonClickEvent;
+ this.Remove(btn);
+ btn.Dispose();
+ }
+ buttonList.Clear();
+ buttonList = null;
+ }
+ if(count <= 0)
+ {
+ return;
+ }
+ int buttonWidth = Size2D.Width / count;
+ int buttonHeight = popupAttributes.ButtonAttributes.Size2D.Height;
+ int pos = 0;
+ buttonList = new List<Button>();
+ for (int i = 0; i < count; i++)
+ {
+ Button btn = null;
+ popupAttributes.ButtonAttributes.Size2D.Width = buttonWidth;
+ btn = new Button(popupAttributes.ButtonAttributes);
+ btn.Position2D = new Position2D(pos, 0);
+
+ if (i >= buttonTextList.Count)
+ {
+ buttonTextList.Add("");
+ }
+ btn.Text = buttonTextList[i];
+ btn.ClickEvent += ButtonClickEvent;
+ pos += buttonWidth;
+ this.Add(btn);
+ buttonList.Add(btn);
+ }
+ }
+
+ private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
+ {
+ if (PopupButtonClickedEvent != null && buttonList != null)
+ {
+ Button button = sender as Button;
+ for (int i = 0; i < buttonList.Count; i++)
+ {
+ if(button == buttonList[i])
+ {
+ ButtonClickEventArgs args = new ButtonClickEventArgs();
+ args.ButtonIndex = i;
+ PopupButtonClickedEvent(this, args);
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// ButtonClickEventArgs is a class to record button click event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ButtonClickEventArgs : EventArgs
+ {
+ /// <summary> Button index which is clicked in Popup </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ButtonIndex;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The Progress class of nui component. It's used to show the ongoing status with a long narrow bar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Progress : Control
+ {
+ /// 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 ProgressAttributes progressAttrs = null;
+ /// 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;
+
+ private const float round = 0.5f;
+ private ImageView trackObj = null;
+ private ImageView progressObj = null;
+ private ImageView bufferObj = null;
+ private ImageView loadingObj = null;
+ private float maxValue = 100;
+ private float minValue = 0;
+ private float currentValue = 0;
+ private float bufferValue = 0;
+
+ /// <summary>
+ /// The constructor of Progress
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Progress() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Progress class with specific style.
+ /// </summary>
+ /// <param name="style">style name</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Progress(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Progress class with specific Attributes.
+ /// </summary>
+ /// <param name="attributes">The Attributes object to initialize the Progress.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Progress(ProgressAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The status type of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum ProgressStatusType
+ {
+ /// <summary>
+ /// Show TrackImage
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Buffering,
+
+ /// <summary>
+ /// Show ProgressImage
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Determinate,
+
+ /// <summary>
+ /// Show LoadingImage
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Indeterminate
+ }
+
+ /// <summary>
+ /// The property to get/set Track image object URL of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string TrackImageURL
+ {
+ get
+ {
+ return progressAttrs.TrackImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateTrackImageAttributes();
+ if (progressAttrs.TrackImageAttributes.ResourceUrl == null)
+ {
+ progressAttrs.TrackImageAttributes.ResourceUrl = new StringSelector();
+ }
+ progressAttrs.TrackImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set Progress object image URL of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ProgressImageURL
+ {
+ get
+ {
+ return progressAttrs.ProgressImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateProgressImageAttributes();
+ if (progressAttrs.ProgressImageAttributes.ResourceUrl == null)
+ {
+ progressAttrs.ProgressImageAttributes.ResourceUrl = new StringSelector();
+ }
+ progressAttrs.ProgressImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set Buffer object image resource URL of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string BufferImageURL
+ {
+ get
+ {
+ return progressAttrs.BufferImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateBufferImageAttributes();
+ if (progressAttrs.BufferImageAttributes.ResourceUrl == null)
+ {
+ progressAttrs.BufferImageAttributes.ResourceUrl = new StringSelector();
+ }
+ progressAttrs.BufferImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set Track object color of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TrackColor
+ {
+ get
+ {
+ return progressAttrs.TrackImageAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ CreateTrackImageAttributes();
+ if (progressAttrs.TrackImageAttributes.BackgroundColor == null)
+ {
+ progressAttrs.TrackImageAttributes.BackgroundColor = new ColorSelector();
+ }
+ progressAttrs.TrackImageAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set Progress object color of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color ProgressColor
+ {
+ get
+ {
+ return progressAttrs.ProgressImageAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ CreateProgressImageAttributes();
+ if (null == progressAttrs.ProgressImageAttributes.BackgroundColor)
+ {
+ progressAttrs.ProgressImageAttributes.BackgroundColor = new ColorSelector();
+ }
+ progressAttrs.ProgressImageAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set Buffer object color of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color BufferColor
+ {
+ get
+ {
+ return progressAttrs.BufferImageAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ CreateBufferImageAttributes();
+ if (null == progressAttrs.BufferImageAttributes.BackgroundColor)
+ {
+ progressAttrs.BufferImageAttributes.BackgroundColor = new ColorSelector();
+ }
+ progressAttrs.BufferImageAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the maximum value of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float MaxValue
+ {
+ get
+ {
+ return maxValue;
+ }
+ set
+ {
+ maxValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the minim value of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float MinValue
+ {
+ get
+ {
+ return minValue;
+ }
+ set
+ {
+ minValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the current value of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CurrentValue
+ {
+ get
+ {
+ return currentValue;
+ }
+ set
+ {
+ if (value > maxValue || value < minValue)
+ {
+ return;
+ }
+ currentValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the buffer value of the Progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float BufferValue
+ {
+ get
+ {
+ return bufferValue;
+ }
+ set
+ {
+ if (value > maxValue || value < minValue)
+ {
+ return;
+ }
+ bufferValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets state of progress.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ProgressStatusType ProgressState
+ {
+ get
+ {
+ return state;
+ }
+ set
+ {
+ state = value;
+ UpdateStates();
+ }
+ }
+
+ /// <summary>
+ /// Dispose Progress and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ Utility.Dispose(trackObj);
+ Utility.Dispose(progressObj);
+ Utility.Dispose(bufferObj);
+ Utility.Dispose(loadingObj);
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+ //Unreference this from if a static instance refer to this.
+
+ //You must call base.Dispose(type) just before exit.
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// The method to update Attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ ApplyAttributes(this, progressAttrs);
+ ApplyAttributes(trackObj, progressAttrs.TrackImageAttributes);
+ ApplyAttributes(progressObj, progressAttrs.ProgressImageAttributes);
+ ApplyAttributes(loadingObj, progressAttrs.LoadingImageAttributes);
+ ApplyAttributes(bufferObj, progressAttrs.BufferImageAttributes);
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <param name="sender">serder object</param>
+ /// <param name="e">ThemeChangeEventArgs</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ ProgressAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as ProgressAttributes;
+ if (null != tempAttributes)
+ {
+ attributes = progressAttrs = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Change Image status. It can be override.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void UpdateStates()
+ {
+ ChangeImageState(state);
+ }
+
+ /// <summary>
+ /// Update progress value
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void UpdateValue()
+ {
+ if (null == trackObj || null == progressObj)
+ {
+ return;
+ }
+
+ if (minValue >= maxValue || currentValue < minValue || currentValue > maxValue)
+ {
+ return;
+ }
+
+ float width = this.SizeWidth;
+ float height = this.SizeHeight;
+ float progressRatio = (float)(currentValue - minValue) / (float)(maxValue - minValue);
+ float progressWidth = width * progressRatio;
+ progressObj.Size2D = new Size2D((int)(progressWidth + round), (int)height); //Add const round to reach Math.Round function.
+ if (null != bufferObj)
+ {
+ if (bufferValue < minValue || bufferValue > maxValue)
+ {
+ return;
+ }
+
+ float bufferRatio = (float)(bufferValue - minValue) / (float)(maxValue - minValue);
+ float bufferWidth = width * bufferRatio;
+ bufferObj.Size2D = new Size2D((int)(bufferWidth + round), (int)height); //Add const round to reach Math.Round function.
+ }
+ }
+
+ /// <summary>
+ /// Get Progress attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new ProgressAttributes();
+ }
+
+ /// <summary>
+ /// Change Image status
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// <param name="statusType">New status type</param>
+ protected void ChangeImageState(ProgressStatusType statusType)
+ {
+ if (state == ProgressStatusType.Buffering)
+ {
+ bufferObj.Show();
+ loadingObj.Hide();
+ progressObj.Hide();
+ }
+ else if (state == ProgressStatusType.Determinate)
+ {
+ bufferObj.Hide();
+ loadingObj.Hide();
+ progressObj.Show();
+ UpdateValue();
+ }
+ else
+ {
+ bufferObj.Hide();
+ loadingObj.Show();
+ progressObj.Hide();
+ }
+ }
+
+ private void Initialize()
+ {
+ progressAttrs = attributes as ProgressAttributes;
+ if (null == progressAttrs)
+ {
+ throw new Exception("Progress attribute parse error.");
+ }
+
+ // create necessary components
+ InitializeTrack();
+ InitializeBuffer();
+ InitializeProgress();
+ InitializeLoading();
+ }
+
+ private void InitializeTrack()
+ {
+ if (null == trackObj)
+ {
+ trackObj = new ImageView
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ };
+ Add(trackObj);
+ }
+ }
+
+ private void InitializeProgress()
+ {
+ if (null == progressObj)
+ {
+ progressObj = new ImageView
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ };
+ Add(progressObj);
+ }
+ }
+
+ private void InitializeBuffer()
+ {
+ if (null == bufferObj)
+ {
+ bufferObj = new ImageView
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ };
+ Add(bufferObj);
+ }
+ }
+
+ private void InitializeLoading()
+ {
+ if (null == loadingObj)
+ {
+ loadingObj = new ImageView
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ };
+ Add(loadingObj);
+ }
+ }
+
+ private void CreateTrackImageAttributes()
+ {
+ if (null == progressAttrs.TrackImageAttributes)
+ {
+ progressAttrs.TrackImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateProgressImageAttributes()
+ {
+ if (null == progressAttrs.ProgressImageAttributes)
+ {
+ progressAttrs.ProgressImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateBufferImageAttributes()
+ {
+ if (null == progressAttrs.BufferImageAttributes)
+ {
+ progressAttrs.BufferImageAttributes = new ImageAttributes();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// RadioButton is the Class that describe the control which can be checked, but not cleared by a user.
+ /// </summary>
+ /// <code>
+ /// RadioButton radio = new RadioButton("C_RadioButton_WhiteText");
+ /// radio.Size = new Size(200, 64, 0);
+ /// radio.Position = new Position(500, posY, 0);
+ /// radio.Text = "RadioButton";
+ /// radio.Focusable = true;
+ /// </code>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class RadioButton : SelectButton
+ {
+ /// <summary>
+ /// Creates a new instance of a RadioButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButton() : base() { }
+ /// <summary>
+ /// Creates a new instance of a RadioButton with style.
+ /// </summary>
+ /// <param name="style"></param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButton(string style) : base(style) { }
+ /// <summary>
+ /// Creates a new instance of a RadioButton with attributes.
+ /// </summary>
+ /// <param name="attrs"></param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButton(SelectButtonAttributes attrs) : base(attrs) { }
+ /// <summary>
+ /// Get RadioButtonGroup to which this selections belong.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButtonGroup ItemGroup
+ {
+ get
+ {
+ return itemGroup as RadioButtonGroup;
+ }
+ internal set
+ {
+ itemGroup = value;
+ }
+ }
+
+ /// <summary>
+ /// Set CheckState to true after selecting RadioButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnSelected()
+ {
+ if (!IsSelected)
+ {
+ IsSelected = true;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The RadioButtonGroup class is used to group together a set of RadioButton control
+ /// It enables the user to select exclusively single radio button of group.
+ /// </summary>
+ /// <code>
+ /// RadioButtonGroup radioGroup = new RadioButtonGroup();
+ /// RadioButton radio1 = new RadioButton();
+ /// RadioButton radio2 = new RadioButton();
+ /// radioGroup.Add(radio1);
+ /// radioGroup.Add(radio2);
+ /// </code>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class RadioButtonGroup : SelectGroup
+ {
+ /// <summary>
+ /// Construct RadioButtonGroup
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButtonGroup() : base()
+ {
+
+ }
+
+ /// <summary>
+ /// Get the RadioButton object at the specified index.
+ /// </summary>
+ /// <param name="index">item index</param>
+ /// <returns>RadioButton</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RadioButton GetItemByIndex(int index)
+ {
+ return itemGroup[index] as RadioButton;
+ }
+
+ /// <summary>
+ /// Add RadioButton to the end of RadioButtonGroup.
+ /// </summary>
+ /// <param name="radio">The RadioButton to be added to the RadioButtonGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Add(RadioButton radio)
+ {
+ base.AddSelection(radio);
+ radio.ItemGroup = this;
+ }
+
+
+ /// <summary>
+ /// Remove RadioButton from the RadioButtonGroup.
+ /// </summary>
+ /// <param name="radio">The RadioButton to remove from the RadioButtonGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Remove(RadioButton radio)
+ {
+ base.RemoveSelection(radio);
+ radio.ItemGroup = null;
+ }
+
+ /// <summary>
+ /// Handle user's select action. Turn on check state of selected RadioButton,
+ /// and turn out check state of other RadioButtons in RadioButtonGroup
+ /// </summary>
+ /// <param name="selection">The selection selected by user</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void SelectionHandler(SelectButton selection)
+ {
+ RadioButton radio = selection as RadioButton;
+ if (!itemGroup.Contains(radio))
+ {
+ return;
+ }
+
+ foreach (RadioButton btn in itemGroup)
+ {
+ if (btn != null && btn != radio && btn.IsEnabled == true)
+ {
+ btn.IsSelected = false;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// The ScrollBar class of nui component. It allows users to recognize the direction and the range of lists/content. .
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ScrollBar : Control
+ {
+ private ScrollBarAttributes scrollBarAttrs;
+ private ImageView trackImage;
+ private ImageView thumbImage;
+ private Animation scrollAniPlayer = null;
+ private float thumbImagePosX;
+ private float thumbImagePosY;
+ private bool enableAni = false;
+ private int minValue;
+ private int maxValue;
+ private int curValue;
+
+ /// <summary>
+ /// The constructor of ScrollBar
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBar() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of ScrollBar with specific style.
+ /// </summary>
+ /// <param name="style">style name</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBar(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of ScrollBar with specific Attributes.
+ /// </summary>
+ /// <param name="attributes">The Attributes object to initialize the ScrollBar.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ScrollBar(ScrollBarAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The direction type of the Scroll.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum DirectionType
+ {
+ /// <summary>
+ /// The Horizontal type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Horizontal,
+
+ /// <summary>
+ /// The Vertical type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Vertical
+ }
+
+ #region public property
+
+ /// <summary>
+ /// The property to get/set the direction of the ScrollBar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DirectionType Direction
+ {
+ get
+ {
+ return scrollBarAttrs.Direction.Value;
+ }
+ set
+ {
+ scrollBarAttrs.Direction = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the size of the thumb object.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">Throw when ThumbSize is null.</exception>
+ /// <example>
+ /// <code>
+ /// ScrollBar scroll;
+ /// try
+ /// {
+ /// scroll.ThumbSize = new Size(500, 10, 0);
+ /// }
+ /// catch(InvalidOperationException e)
+ /// {
+ /// Tizen.Log.Error(LogTag, "Failed to set ThumbSize value : " + e.Message);
+ /// }
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D ThumbSize
+ {
+ get
+ {
+ if (scrollBarAttrs.ThumbImageAttributes.Size2D == null)
+ {
+ scrollBarAttrs.ThumbImageAttributes.Size2D = new Size2D();
+ }
+ return scrollBarAttrs.ThumbImageAttributes.Size2D;
+ }
+ set
+ {
+ if (scrollBarAttrs.ThumbImageAttributes.Size2D == null)
+ {
+ scrollBarAttrs.ThumbImageAttributes.Size2D = new Size2D();
+ }
+ if (thumbImage != null)
+ {
+ scrollBarAttrs.ThumbImageAttributes.Size2D.Width = value.Width;
+ scrollBarAttrs.ThumbImageAttributes.Size2D.Height = value.Height;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the image URL of the track object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string TrackImageURL
+ {
+ get
+ {
+ return scrollBarAttrs.TrackImageAttributes.ResourceUrl.All;
+ }
+ set
+ {
+ if (trackImage != null)
+ {
+ if (scrollBarAttrs.TrackImageAttributes.ResourceUrl == null)
+ {
+ scrollBarAttrs.TrackImageAttributes.ResourceUrl = new StringSelector();
+ }
+ scrollBarAttrs.TrackImageAttributes.ResourceUrl.All = value;
+ }
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the color of the track object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TrackColor
+ {
+ get
+ {
+ return scrollBarAttrs.TrackImageAttributes.BackgroundColor?.All;
+ }
+ set
+ {
+ if (scrollBarAttrs.TrackImageAttributes.BackgroundColor == null)
+ {
+ scrollBarAttrs.TrackImageAttributes.BackgroundColor = new ColorSelector { All = value };
+ }
+ else
+ {
+ scrollBarAttrs.TrackImageAttributes.BackgroundColor.All = value;
+ }
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the color of the thumb object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color ThumbColor
+ {
+ get
+ {
+ return scrollBarAttrs.ThumbImageAttributes.BackgroundColor?.All;
+ }
+ set
+ {
+ if(scrollBarAttrs.ThumbImageAttributes.BackgroundColor == null)
+ {
+ scrollBarAttrs.ThumbImageAttributes.BackgroundColor = new ColorSelector { All = value };
+ }
+ else
+ {
+ scrollBarAttrs.ThumbImageAttributes.BackgroundColor.All = value;
+ }
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the max value of the ScrollBar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int MaxValue
+ {
+ get
+ {
+ return maxValue;
+ }
+ set
+ {
+ if(value >= 0)
+ {
+ maxValue = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the min value of the ScrollBar.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int MinValue
+ {
+ get
+ {
+ return minValue;
+ }
+ set
+ {
+ if(value >= 0)
+ {
+ minValue = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The property to get/set the current value of the ScrollBar.
+ /// </summary>
+ /// <exception cref="ArgumentOutOfRangeException">Throw when Current value is less than Min value, or greater than Max value.</exception>
+ /// <example>
+ /// <code>
+ /// ScrollBar scroll;
+ /// scroll.MaxValue = 100;
+ /// scroll.MinValue = 0;
+ /// try
+ /// {
+ /// scroll.CurrentValue = 50;
+ /// }
+ /// catch(ArgumentOutOfRangeException e)
+ /// {
+ /// Tizen.Log.Error(LogTag, "Failed to set Current value : " + e.Message);
+ /// }
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CurrentValue
+ {
+ get
+ {
+ return curValue;
+ }
+ set
+ {
+ if(value >= 0)
+ {
+ curValue = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Property to set/get animation duration.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint Duration
+ {
+ get
+ {
+ return scrollBarAttrs.Duration;
+ }
+ set
+ {
+ scrollBarAttrs.Duration = value;
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Duration = (int)value;
+ }
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Method to set current value. The thumb object would move to the corresponding position with animation or not.
+ /// </summary>
+ /// <param name="currentValue">The special current value.</param>
+ /// <param name="isEnableAni">Enable move with animation or not, the default value is true.</param>
+ /// <exception cref="ArgumentOutOfRangeException">Throw when current size is less than the min value, or greater than the max value.</exception>
+ /// <example>
+ /// <code>
+ /// ScrollBar scroll;
+ /// scroll.MinValue = 0;
+ /// scroll.MaxValue = 100;
+ /// try
+ /// {
+ /// scroll.SetCurrentValue(50);
+ /// }
+ /// catch(ArgumentOutOfRangeException e)
+ /// {
+ /// Tizen.Log.Error(LogTag, "Failed to set current value : " + e.Message);
+ /// }
+ /// </code>
+ /// </example>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SetCurrentValue(int currentValue, bool isEnableAni = true)
+ {
+ if (currentValue < minValue || currentValue > maxValue)
+ {
+ //TNLog.E("Current value is less than the Min value, or greater than the Max value. currentValue = " + currentValue + ";");
+ throw new ArgumentOutOfRangeException("Wrong Current value. It shoud be greater than the Min value, and less than the Max value!");
+ }
+
+ enableAni = isEnableAni;
+ CurrentValue = currentValue;
+ }
+
+ /// <summary>
+ /// Dispose ScrollBar.
+ /// </summary>
+ /// <param name="type">The DisposeTypes value.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+
+ if (trackImage != null)
+ {
+ Utility.Dispose(trackImage);
+ }
+
+ if (thumbImage != null)
+ {
+ Utility.Dispose(thumbImage);
+ }
+
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Stop();
+ scrollAniPlayer.Clear();
+ scrollAniPlayer.Dispose();
+ scrollAniPlayer = null;
+ }
+ // UIDirectionChangedEvent -= OnUIDirectionChangedEvent;
+ }
+
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+ //Unreference this from if a static instance refer to this.
+
+ //You must call base.Dispose(type) just before exit.
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// The method to update Attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ ApplyAttributes(this, scrollBarAttrs);
+ ApplyAttributes(trackImage, scrollBarAttrs.TrackImageAttributes);
+ ApplyAttributes(thumbImage, scrollBarAttrs.ThumbImageAttributes);
+ if (enableAni)
+ {
+ UpdateValue(true);
+ enableAni = false;
+ }
+ else
+ {
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Get Scrollbar attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new ScrollBarAttributes()
+ {
+ ThumbImageAttributes = new ImageAttributes
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ },
+ TrackImageAttributes = new ImageAttributes
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ }
+
+ };
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ ScrollBarAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as ScrollBarAttributes;
+ if (tempAttributes != null)
+ {
+ attributes = scrollBarAttrs = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ private void Initialize()
+ {
+ scrollBarAttrs = this.attributes as ScrollBarAttributes;
+ if(scrollBarAttrs == null)
+ {
+ throw new Exception("ScrollBar attribute parse error.");
+ }
+
+ this.Focusable = false;
+
+ trackImage = new ImageView
+ {
+ Focusable = false,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+
+ };
+ thumbImage = new ImageView
+ {
+ Focusable = false,
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+ };
+
+ Add(trackImage);
+ Add(thumbImage);
+
+ scrollAniPlayer = new Animation(334);
+ scrollAniPlayer.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
+
+ thumbImagePosX = 0;
+ thumbImagePosY = 0;
+ LayoutDirectionChanged += OnLayoutDirectionChanged;
+ }
+
+ private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
+ {
+ RelayoutRequest();
+ }
+
+ private void UpdateValue(bool enableAni = false)
+ {
+ if (trackImage == null || thumbImage == null || scrollBarAttrs.Direction == null)
+ {
+ return;
+ }
+
+ if (minValue >= maxValue || curValue < minValue || curValue > maxValue)
+ {
+ return;
+ }
+ float width = (float)Size2D.Width;
+ float height = (float)Size2D.Height;
+ float thumbW = 0.0f;
+ float thumbH = 0.0f;
+ if (scrollBarAttrs.ThumbImageAttributes.Size2D == null)
+ {
+ return;
+ }
+ else
+ {
+ thumbW = scrollBarAttrs.ThumbImageAttributes.Size2D.Width;
+ thumbH = scrollBarAttrs.ThumbImageAttributes.Size2D.Height;
+ }
+ float ratio = (float)(curValue - minValue) / (float)(maxValue - minValue);
+
+ if (scrollBarAttrs.Direction == DirectionType.Horizontal)
+ {
+ if (LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ ratio = 1.0f - ratio;
+ }
+
+ float posX = ratio * (width - thumbW);
+ float posY = (height - thumbH) / 2.0f;
+
+ thumbImagePosX = posX;
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Stop();
+ }
+
+ if (!enableAni)
+ {
+ thumbImage.Position = new Position(posX, posY, 0);
+ }
+ else
+ {
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Clear();
+ scrollAniPlayer.AnimateTo(thumbImage, "PositionX", posX);
+ scrollAniPlayer.Play();
+ }
+ }
+ }
+ else
+ {
+ float posX = (width - thumbW) / 2.0f;
+ float posY = ratio * (height - thumbH);
+
+ thumbImagePosY = posY;
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Stop();
+ }
+
+ if (!enableAni)
+ {
+ thumbImage.Position = new Position(posX, posY, 0);
+ }
+ else
+ {
+ if (scrollAniPlayer != null)
+ {
+ scrollAniPlayer.Clear();
+ scrollAniPlayer.AnimateTo(thumbImage, "PositionY", posY);
+ scrollAniPlayer.Play();
+ }
+ }
+ }
+ }
+
+ private DirectionType CurrentDirection()
+ {
+ DirectionType dir = DirectionType.Horizontal;
+ if (scrollBarAttrs != null)
+ {
+ if (scrollBarAttrs.Direction != null)
+ {
+ dir = scrollBarAttrs.Direction.Value;
+ }
+ }
+ return dir;
+ }
+
+ private int CalculateCurrentValue(float offset, DirectionType dir)
+ {
+ if (dir == DirectionType.Horizontal)
+ {
+ thumbImagePosX += offset;
+ if (thumbImagePosX < 0)
+ {
+ thumbImage.PositionX = 0;
+ curValue = minValue;
+ }
+ else if (thumbImagePosX > Size2D.Width - thumbImage.Size2D.Width)
+ {
+ thumbImage.PositionX = Size2D.Width - thumbImage.Size2D.Width;
+ curValue = maxValue;
+ }
+ else
+ {
+ thumbImage.PositionX = thumbImagePosX;
+ curValue = (int)((thumbImagePosX / (float)(Size2D.Width - thumbImage.Size2D.Width)) * (float)(maxValue - minValue) + 0.5f);
+ }
+ }
+ else
+ {
+ thumbImagePosY += offset;
+ if (thumbImagePosY < 0)
+ {
+ thumbImage.PositionY = 0;
+ curValue = minValue;
+ }
+ else if (thumbImagePosY > Size2D.Height - thumbImage.Size2D.Height)
+ {
+ thumbImage.PositionY = Size2D.Height - thumbImage.Size2D.Height;
+ curValue = maxValue;
+ }
+ else
+ {
+ thumbImage.PositionY = thumbImagePosY;
+ curValue = (int)((thumbImagePosY / (float)(Size2D.Height - thumbImage.Size2D.Height)) * (float)(maxValue - minValue) + 0.5f);
+ }
+ }
+
+ return (int)curValue;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// SelectButton is base class of CheckBox and RadioButton.
+ /// It can be used as selector and add into group for single-choice or multiple-choice .
+ /// User can handle Navigation by adding/inserting/deleting NavigationItem.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SelectButton : Button
+ {
+ /// <summary>
+ /// Item group which is used to manager all SelectButton in it.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectGroup itemGroup = null;
+
+ private ImageView checkShadowImage;
+ private ImageView checkBackgroundImage;
+ private ImageView checkImage;
+
+ private SelectButtonAttributes selectButtonAttributes;
+
+ /// <summary>
+ /// Creates a new instance of a SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectButton() : base()
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a SelectButton with style.
+ /// </summary>
+ /// <param name="style">Create SelectButton by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectButton(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a SelectButton with attributes.
+ /// </summary>
+ /// <param name="attributes">Create SelectButton by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectButton(SelectButtonAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<SelectEventArgs> SelectedEvent;
+
+ /// <summary>
+ /// Index of selection in selection group. If selection is not in the group, return -1;
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int Index
+ {
+ get
+ {
+ if (itemGroup != null)
+ {
+ return itemGroup.GetIndex(this);
+ }
+
+ return -1;
+ }
+ }
+
+ /// <summary>
+ /// Check image's resource url in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string CheckImageURL
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckImageAttributes();
+ if (selectButtonAttributes.CheckImageAttributes.ResourceUrl == null)
+ {
+ selectButtonAttributes.CheckImageAttributes.ResourceUrl = new StringSelector();
+ }
+ selectButtonAttributes.CheckImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Check image's resource url selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector CheckImageURLSelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Check image's opacity in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CheckImageOpacity
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.Opacity?.All ?? 0;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ if (selectButtonAttributes.CheckImageAttributes.Opacity == null)
+ {
+ selectButtonAttributes.CheckImageAttributes.Opacity = new FloatSelector();
+ }
+ selectButtonAttributes.CheckImageAttributes.Opacity.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Check image's opacity selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector CheckImageOpacitySelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.Opacity;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.Opacity = value.Clone() as FloatSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Check image's size in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D CheckImageSize2D
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.Size2D ?? new Size2D(0, 0);
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.Size2D = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Background image's resource url in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string CheckBackgroundImageURL
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckBackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckBackgroundImageAttributes();
+ if (selectButtonAttributes.CheckBackgroundImageAttributes.ResourceUrl == null)
+ {
+ selectButtonAttributes.CheckBackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ selectButtonAttributes.CheckBackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's resource url selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector CheckBackgroundImageURLSelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckBackgroundImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckBackgroundImageAttributes();
+ selectButtonAttributes.CheckBackgroundImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's opacity in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CheckBackgroundImageOpacity
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckBackgroundImageAttributes?.Opacity?.All ?? 0;
+ }
+ set
+ {
+ CreateCheckBackgroundImageAttributes();
+ if (selectButtonAttributes.CheckBackgroundImageAttributes.Opacity == null)
+ {
+ selectButtonAttributes.CheckBackgroundImageAttributes.Opacity = new FloatSelector();
+ }
+ selectButtonAttributes.CheckBackgroundImageAttributes.Opacity.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Background image's opacity selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector CheckBackgroundImageOpacitySelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckBackgroundImageAttributes?.Opacity;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckBackgroundImageAttributes();
+ selectButtonAttributes.CheckBackgroundImageAttributes.Opacity = value.Clone() as FloatSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shadow image's resource url in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string CheckShadowImageURL
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckShadowImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckShadowImageAttributes();
+ if (selectButtonAttributes.CheckShadowImageAttributes.ResourceUrl == null)
+ {
+ selectButtonAttributes.CheckShadowImageAttributes.ResourceUrl = new StringSelector();
+ }
+ selectButtonAttributes.CheckShadowImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shadow image's resource url selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector CheckShadowImageURLSelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckShadowImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckShadowImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Shadow image's opacity in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CheckShadowImageOpacity
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckShadowImageAttributes?.Opacity?.All ?? 0;
+ }
+ set
+ {
+ CreateCheckShadowImageAttributes();
+ if (selectButtonAttributes.CheckShadowImageAttributes.Opacity == null)
+ {
+ selectButtonAttributes.CheckShadowImageAttributes.Opacity = new FloatSelector();
+ }
+ selectButtonAttributes.CheckShadowImageAttributes.Opacity.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Shadow image's opacity selector in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector CheckShadowImageOpacitySelector
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckShadowImageAttributes?.Opacity;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckShadowImageAttributes.Opacity = value.Clone() as FloatSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// CheckImage left padding in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImagePaddingLeft
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.PaddingLeft ?? 0;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ CreateCheckBackgroundImageAttributes();
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.PaddingLeft = value;
+ selectButtonAttributes.CheckBackgroundImageAttributes.PaddingLeft = value;
+ selectButtonAttributes.CheckShadowImageAttributes.PaddingLeft = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// CheckImage right padding in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImagePaddingRight
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.PaddingRight ?? 0;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ CreateCheckBackgroundImageAttributes();
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.PaddingRight = value;
+ selectButtonAttributes.CheckBackgroundImageAttributes.PaddingRight = value;
+ selectButtonAttributes.CheckShadowImageAttributes.PaddingRight = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// CheckImage top padding in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImagePaddingTop
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.PaddingTop ?? 0;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ CreateCheckBackgroundImageAttributes();
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.PaddingTop = value;
+ selectButtonAttributes.CheckBackgroundImageAttributes.PaddingTop = value;
+ selectButtonAttributes.CheckShadowImageAttributes.PaddingTop = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// CheckImage bottom padding in SelectButton.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CheckImagePaddingBottom
+ {
+ get
+ {
+ return selectButtonAttributes?.CheckImageAttributes?.PaddingBottom ?? 0;
+ }
+ set
+ {
+ CreateCheckImageAttributes();
+ CreateCheckBackgroundImageAttributes();
+ CreateCheckShadowImageAttributes();
+ selectButtonAttributes.CheckImageAttributes.PaddingBottom = value;
+ selectButtonAttributes.CheckBackgroundImageAttributes.PaddingBottom = value;
+ selectButtonAttributes.CheckShadowImageAttributes.PaddingBottom = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ SelectButtonAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as SelectButtonAttributes;
+ if (tempAttributes != null)
+ {
+ attributes = selectButtonAttributes = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Dispose SelectButton and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (checkShadowImage != null)
+ {
+ Remove(checkShadowImage);
+ checkShadowImage.Dispose();
+ checkShadowImage = null;
+ }
+ if (checkBackgroundImage != null)
+ {
+ Remove(checkBackgroundImage);
+ checkBackgroundImage.Dispose();
+ checkBackgroundImage = null;
+ }
+ if (checkImage != null)
+ {
+ Remove(checkImage);
+ checkImage.Dispose();
+ checkImage = null;
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update SelectButton by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (selectButtonAttributes.CheckImageAttributes != null)
+ {
+ if (checkImage == null)
+ {
+ checkImage = new ImageView();
+ checkImage.Name = "CheckImage";
+ Add(checkImage);
+ }
+ ApplyAttributes(checkImage, selectButtonAttributes.CheckImageAttributes);
+ }
+ else
+ {
+ if (checkImage != null)
+ {
+ Remove(checkImage);
+ checkImage.Dispose();
+ checkImage = null;
+ }
+ }
+
+ if (selectButtonAttributes.CheckShadowImageAttributes != null)
+ {
+ if (checkShadowImage == null)
+ {
+ checkShadowImage = new ImageView();
+ checkShadowImage.Name = "CheckShadowImage";
+ Add(checkShadowImage);
+ }
+ ApplyAttributes(checkShadowImage, selectButtonAttributes.CheckShadowImageAttributes);
+ }
+ else
+ {
+ if (checkShadowImage != null)
+ {
+ Remove(checkShadowImage);
+ checkShadowImage.Dispose();
+ checkShadowImage = null;
+ }
+ }
+
+ if (selectButtonAttributes.CheckBackgroundImageAttributes != null)
+ {
+ if (checkBackgroundImage == null)
+ {
+ checkBackgroundImage = new ImageView();
+ checkBackgroundImage.Name = "CheckBackgroundImage";
+ Add(checkBackgroundImage);
+ }
+ ApplyAttributes(checkBackgroundImage, selectButtonAttributes.CheckBackgroundImageAttributes);
+ }
+ else
+ {
+ if (checkBackgroundImage != null)
+ {
+ Remove(checkBackgroundImage);
+ checkBackgroundImage.Dispose();
+ checkBackgroundImage = null;
+ }
+ }
+
+ UpdateTextAttributes();
+ base.OnUpdate();
+
+ checkShadowImage?.RaiseToTop();
+ checkBackgroundImage?.RaiseToTop();
+ checkImage?.RaiseToTop();
+ }
+
+ /// <summary>
+ /// Called after a key event is received by the view that has had its focus set.
+ /// </summary>
+ /// <param name="key">The key event.</param>
+ /// <returns>True if the key event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnKey(Key key)
+ {
+ if (IsEnabled == false)
+ {
+ return false;
+ }
+ bool ret = base.OnKey(key);
+ if (key.State == Key.StateType.Up)
+ {
+ if (key.KeyPressedName == "Return")
+ {
+ OnSelect();
+ }
+ }
+
+ return ret;
+ }
+
+ /// <summary>
+ /// Called after a touch event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="touch">The touch event.</param>
+ /// <returns>True if the event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnTouch(Touch touch)
+ {
+ if (IsEnabled == false)
+ {
+ return false;
+ }
+ PointStateType state = touch.GetState(0);
+ bool ret = base.OnTouch(touch);
+ switch (state)
+ {
+ case PointStateType.Up:
+ OnSelect();
+ break;
+ default:
+ break;
+ }
+ return ret;
+ }
+
+ /// <summary>
+ /// Get SelectButton attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new SelectButtonAttributes();
+ }
+
+ /// <summary>
+ /// Overrides this method if want to handle behavior after pressing return key by user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void OnSelected()
+ {
+ }
+
+ private void Initialize()
+ {
+ selectButtonAttributes = attributes as SelectButtonAttributes;
+ if (selectButtonAttributes == null)
+ {
+ throw new Exception("SelectButton attribute parse error.");
+ }
+
+ selectButtonAttributes.IsSelectable = true;
+ LayoutDirectionChanged += SelectButtonLayoutDirectionChanged;
+ }
+
+ private void UpdateTextAttributes()
+ {
+ if (selectButtonAttributes.TextAttributes != null)
+ {
+ selectButtonAttributes.TextAttributes.PositionUsesPivotPoint = true;
+ selectButtonAttributes.TextAttributes.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
+ selectButtonAttributes.TextAttributes.PivotPoint = Tizen.NUI.PivotPoint.TopLeft;
+ selectButtonAttributes.TextAttributes.WidthResizePolicy = ResizePolicyType.Fixed;
+ selectButtonAttributes.TextAttributes.HeightResizePolicy = ResizePolicyType.Fixed;
+
+ int iconWidth = CheckImageSize2D.Width;
+
+ int textPaddingLeft = selectButtonAttributes.TextAttributes.PaddingLeft;
+ int textPaddingRight = selectButtonAttributes.TextAttributes.PaddingRight;
+
+ if(selectButtonAttributes.TextAttributes.Size2D == null)
+ {
+ selectButtonAttributes.TextAttributes.Size2D = new Size2D(Size2D.Width - iconWidth - CheckImagePaddingLeft - CheckImagePaddingRight - textPaddingLeft - textPaddingRight, Size2D.Height);
+ }
+
+ if(selectButtonAttributes.TextAttributes.Position2D == null)
+ {
+ selectButtonAttributes.TextAttributes.Position2D = new Position2D(CheckImagePaddingLeft + iconWidth + CheckImagePaddingRight + textPaddingLeft, 0);
+ }
+
+ selectButtonAttributes.TextAttributes.VerticalAlignment = VerticalAlignment.Center;
+ }
+ }
+
+ private void SelectButtonLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
+ {
+ if (selectButtonAttributes == null || selectButtonAttributes.TextAttributes == null)
+ {
+ return;
+ }
+
+ UpdateTextAttributes();
+
+ int iconWidth = CheckImageSize2D.Width;
+
+ int textPaddingLeft = selectButtonAttributes.TextAttributes.PaddingLeft;
+ int textPaddingRight = selectButtonAttributes.TextAttributes.PaddingRight;
+
+ if (LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ selectButtonAttributes.TextAttributes.HorizontalAlignment = HorizontalAlignment.End;
+ selectButtonAttributes.TextAttributes.Position2D.X = textPaddingRight;
+ checkShadowImage.Position2D.X = checkBackgroundImage.Position2D.X = checkImage.Position2D.X = selectButtonAttributes.TextAttributes.Size2D.Width + textPaddingLeft + textPaddingRight + IconPaddingRight;
+
+ }
+ else if (LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ selectButtonAttributes.TextAttributes.HorizontalAlignment = HorizontalAlignment.Begin;
+ selectButtonAttributes.TextAttributes.Position2D.X = IconPaddingLeft + iconWidth + IconPaddingRight + textPaddingLeft;
+ checkShadowImage.Position2D.X = checkBackgroundImage.Position2D.X = checkImage.Position2D.X = IconPaddingLeft;
+ }
+
+ }
+
+ private void OnSelect()
+ {
+ OnSelected();
+
+ if (SelectedEvent != null)
+ {
+ SelectEventArgs eventArgs = new SelectEventArgs();
+ eventArgs.IsSelected = IsSelected;
+ SelectedEvent(this, eventArgs);
+ }
+ }
+
+ private void CreateCheckImageAttributes()
+ {
+ if (selectButtonAttributes.CheckImageAttributes == null)
+ {
+ selectButtonAttributes.CheckImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+
+ private void CreateCheckBackgroundImageAttributes()
+ {
+ if (selectButtonAttributes.CheckBackgroundImageAttributes == null)
+ {
+ selectButtonAttributes.CheckBackgroundImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+
+ private void CreateCheckShadowImageAttributes()
+ {
+ if (selectButtonAttributes.CheckShadowImageAttributes == null)
+ {
+ selectButtonAttributes.CheckShadowImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+
+ /// <summary>
+ /// SelectEventArgs is a class to record item selected arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SelectEventArgs : EventArgs
+ {
+ /// <summary> Select state of SelectButton </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelected;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// SelectionGroup is the base class of CheckBoxGroup and RadioButtonGroup.
+ /// It defines a group that is set of selections and enables the user to choose one or multiple selection.
+ /// </summary>
+ /// <code>
+ /// Refer to CheckBoxGroup and RadioButtonGroup
+ /// </code>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 abstract class SelectGroup
+ {
+ /// <summary> Selection group composed of items </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 List<SelectButton> itemGroup;
+
+ private int selectedIndex;
+
+ /// <summary>
+ /// Get the number of items in the SelectionGroup.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int Count
+ {
+ get
+ {
+ return itemGroup.Count;
+ }
+ }
+
+ /// <summary>
+ /// Get the index of currently or latest selected item.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SelectedIndex
+ {
+ get
+ {
+ return selectedIndex;
+ }
+ }
+
+ /// <summary>
+ /// Construct SelectionGroup
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 SelectGroup()
+ {
+ itemGroup = new List<SelectButton>();
+ }
+
+ /// <summary>
+ /// Determine whether selection is in the SelectionGroup
+ /// </summary>
+ /// <param name="selection">selection in the SelectionGroup</param>
+ /// <returns>true if selection is found in the SelectionGroup; otherwise, false.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool Contains(SelectButton selection)
+ {
+ return itemGroup.Contains(selection);
+ }
+
+ /// <summary>
+ /// Get the index of given selection.
+ /// </summary>
+ /// <param name="selection">selection in the SelectionGroup</param>
+ /// <returns>The index of the selection in selection group if found; otherwise, return -1</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int GetIndex(SelectButton selection)
+ {
+ return itemGroup.IndexOf(selection);
+ }
+
+ /// <summary>
+ /// Adds an selection to the end of the SelectionGroup
+ /// </summary>
+ /// <param name="selection">The selection to be added to the end of the SelectionGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void AddSelection(SelectButton selection)
+ {
+ if (itemGroup.Contains(selection))
+ {
+ return;
+ }
+ itemGroup.Add(selection);
+ selection.SelectedEvent += OnSelectedEvent;
+ }
+
+ /// <summary>
+ /// Removes an selection to the end of the SelectionGroup
+ /// </summary>
+ /// <param name="selection">The selection to remove from the SelectionGroup</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 void RemoveSelection(SelectButton selection)
+ {
+ if (!itemGroup.Contains(selection))
+ {
+ return;
+ }
+ selection.SelectedEvent -= OnSelectedEvent;
+ itemGroup.Remove(selection);
+ }
+
+
+ /// <summary>
+ /// Overrides this method if want to handle behavior after pressing return key by user.
+ /// </summary>
+ /// <param name="selection">The selection selected by user</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void SelectionHandler(SelectButton selection)
+ {
+
+ }
+
+ private void OnSelectedEvent(object sender, SelectButton.SelectEventArgs args)
+ {
+ SelectButton selection = sender as SelectButton;
+ if (selection != null)
+ {
+ if (args.IsSelected == true)
+ {
+ selectedIndex = selection.Index;
+ SelectionHandler(selection);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Selection group event arguments
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SelectGroupEventArgs : EventArgs
+ {
+ /// <summary>The index of selected item</summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SelectedIndex;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// A slider lets users select a value from a continuous or discrete range of values by moving the slider thumb.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Slider : Control
+ {
+ // the background track image object
+ private ImageView bgTrackImage = null;
+ // the slided track image object
+ private ImageView slidedTrackImage = null;
+ // the thumb image object
+ private ImageView thumbImage = null;
+ // the background thumb image object
+ private ImageView bgThumbImage = null;
+ // the low indicator image object
+ private ImageView lowIndicatorImage = null;
+ // the high indicator image object
+ private ImageView highIndicatorImage = null;
+ // the low indicator text object
+ private TextLabel lowIndicatorText = null;
+ // the high indicator text object
+ private TextLabel highIndicatorText = null;
+ // the attributes of the slider
+ private SliderAttributes sliderAttrs = null;
+ // the direction type
+ private DirectionType direction = DirectionType.Horizontal;
+ // the indicator type
+ private IndicatorType indicatorType = IndicatorType.None;
+ private const float round = 0.5f;
+ // the minimum value
+ private float? minValue = null;
+ // the maximum value
+ private float? maxValue = null;
+ // the current value
+ private float? curValue = null;
+ // the size of the low indicator
+ private Size2D lowIndicatorSize = null;
+ // the size of the high indicator
+ private Size2D highIndicatorSize = null;
+ // the track thickness value
+ private uint? trackThickness = null;
+ // the value of the space between track and indicator object
+ private uint? spaceBetweenTrackAndIndicator = null;
+
+ private PanGestureDetector panGestureDetector = null;
+ private float currentSlidedOffset;
+ private EventHandler<ValueChangedArgs> valueChangedHandler;
+ private EventHandler<SlidingFinishedArgs> slidingFinishedHandler;
+ private EventHandler<StateChangedArgs> stateChangedHandler;
+
+ bool isFocused = false;
+ bool isPressed = false;
+
+ /// <summary>
+ /// The constructor of the Slider class.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Slider()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Slider class with specific style.
+ /// </summary>
+ /// <param name="style">The string to initialize the Slider</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Slider(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Slider class with specific Attributes.
+ /// </summary>
+ /// <param name="attributes">The Attributes object to initialize the Slider</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Slider(SliderAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The value changed event handler.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ValueChangedArgs> ValueChangedEvent
+ {
+ add
+ {
+ valueChangedHandler += value;
+ }
+ remove
+ {
+ valueChangedHandler -= value;
+ }
+ }
+
+ /// <summary>
+ /// The sliding finished event handler.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<SlidingFinishedArgs> SlidingFinishedEvent
+ {
+ add
+ {
+ slidingFinishedHandler += value;
+ }
+ remove
+ {
+ slidingFinishedHandler -= value;
+ }
+ }
+
+ /// <summary>
+ /// The state changed event handler.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<StateChangedArgs> StateChangedEvent
+ {
+ add
+ {
+ stateChangedHandler += value;
+ }
+ remove
+ {
+ stateChangedHandler -= value;
+ }
+ }
+
+ /// <summary>
+ /// The direction type of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum DirectionType
+ {
+ /// <summary>
+ /// The Horizontal type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Horizontal,
+
+ /// <summary>
+ /// The Vertical type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Vertical
+ }
+
+ /// <summary>
+ /// The indicator type of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum IndicatorType
+ {
+ /// <summary> Only contains slider bar.</summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ None,
+
+ /// <summary> Contains slider bar, IndicatorImage.</summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Image,
+
+ /// <summary> Contains slider bar, IndicatorText.</summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Text
+ }
+
+ /// <summary>
+ /// Gets or sets the direction type of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DirectionType Direction
+ {
+ get
+ {
+ return direction;
+ }
+ set
+ {
+ if (direction == value)
+ {
+ return;
+ }
+ direction = value;
+ RelayoutBaseComponent(false);
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the indicator type, arrow or sign.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 IndicatorType Indicator
+ {
+ get
+ {
+ return indicatorType;
+ }
+ set
+ {
+ if (indicatorType == value)
+ {
+ return;
+ }
+ indicatorType = value;
+ RelayoutBaseComponent(false);
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the minimum value of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float MinValue
+ {
+ get
+ {
+ return minValue ?? 0;
+ }
+ set
+ {
+ minValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the maximum value of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float MaxValue
+ {
+ get
+ {
+ return maxValue ?? 100;
+ }
+ set
+ {
+ maxValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the current value of slider.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CurrentValue
+ {
+ get
+ {
+ return curValue ?? 0;
+ }
+ set
+ {
+ curValue = value;
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the thumb image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D ThumbSize
+ {
+ get
+ {
+ return sliderAttrs.ThumbAttributes?.Size2D;
+ }
+ set
+ {
+ CreateThumbAttributes();
+ sliderAttrs.ThumbAttributes.Size2D = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource url selector of the thumb image background object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector ThumbImageBackgroundURLSelector
+ {
+ get
+ {
+ return sliderAttrs.ThumbBackgroundAttributes?.ResourceUrl;
+ }
+ set
+ {
+ CreateThumbBackgroundAttributes();
+ if (value != null)
+ {
+ sliderAttrs.ThumbBackgroundAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource url of the thumb image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string ThumbImageURL
+ {
+ get
+ {
+ return sliderAttrs.ThumbAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateThumbAttributes();
+ if (sliderAttrs.ThumbAttributes.ResourceUrl == null)
+ {
+ sliderAttrs.ThumbAttributes.ResourceUrl = new StringSelector();
+ }
+ sliderAttrs.ThumbAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource url selector of the thumb image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector ThumbImageURLSelector
+ {
+ get
+ {
+ return sliderAttrs.ThumbAttributes?.ResourceUrl;
+ }
+ set
+ {
+ CreateThumbAttributes();
+ if (value != null)
+ {
+ sliderAttrs.ThumbAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the color of the background track image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color BgTrackColor
+ {
+ get
+ {
+ return sliderAttrs.BackgroundTrackAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ CreateBackgroundTrackAttributes();
+ if (sliderAttrs.BackgroundTrackAttributes.BackgroundColor == null)
+ {
+ sliderAttrs.BackgroundTrackAttributes.BackgroundColor = new ColorSelector();
+ }
+ sliderAttrs.BackgroundTrackAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the color of the slided track image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color SlidedTrackColor
+ {
+ get
+ {
+ return sliderAttrs.SlidedTrackAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ CreateSlidedTrackAttributes();
+ if (sliderAttrs.SlidedTrackAttributes.BackgroundColor == null)
+ {
+ sliderAttrs.SlidedTrackAttributes.BackgroundColor = new ColorSelector();
+ }
+ sliderAttrs.SlidedTrackAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the thickness value of the track.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint TrackThickness
+ {
+ get
+ {
+ return trackThickness ?? 0;
+ }
+ set
+ {
+ trackThickness = value;
+ if (bgTrackImage != null)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ bgTrackImage.SizeHeight = (float)trackThickness.Value;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ bgTrackImage.SizeWidth = (float)trackThickness.Value;
+ }
+ }
+ if (slidedTrackImage != null)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ slidedTrackImage.SizeHeight = (float)trackThickness.Value;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ slidedTrackImage.SizeWidth = (float)trackThickness.Value;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource url of the low indicator image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string LowIndicatorImageURL
+ {
+ get
+ {
+ return sliderAttrs.LowIndicatorImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateLowIndicatorImageAttributes();
+ if (sliderAttrs.LowIndicatorImageAttributes.ResourceUrl == null)
+ {
+ sliderAttrs.LowIndicatorImageAttributes.ResourceUrl = new StringSelector();
+ }
+ sliderAttrs.LowIndicatorImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the resource url of the high indicator image object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string HighIndicatorImageURL
+ {
+ get
+ {
+ return sliderAttrs.HighIndicatorImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ CreateHighIndicatorImageAttributes();
+ if (sliderAttrs.HighIndicatorImageAttributes.ResourceUrl == null)
+ {
+ sliderAttrs.HighIndicatorImageAttributes.ResourceUrl = new StringSelector();
+ }
+ sliderAttrs.HighIndicatorImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the text content of the low indicator text object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string LowIndicatorTextContent
+ {
+ get
+ {
+ return sliderAttrs.LowIndicatorTextAttributes?.Text?.All;
+ }
+ set
+ {
+ CreateLowIndicatorTextAttributes();
+ if (sliderAttrs.LowIndicatorTextAttributes.Text == null)
+ {
+ sliderAttrs.LowIndicatorTextAttributes.Text = new StringSelector();
+ }
+ sliderAttrs.LowIndicatorTextAttributes.Text.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the text content of the high indicator text object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string HighIndicatorTextContent
+ {
+ get
+ {
+ return sliderAttrs.HighIndicatorTextAttributes?.Text?.All;
+ }
+ set
+ {
+ CreateHighIndicatorTextAttributes();
+ if (sliderAttrs.HighIndicatorTextAttributes.Text == null)
+ {
+ sliderAttrs.HighIndicatorTextAttributes.Text = new StringSelector();
+ }
+ sliderAttrs.HighIndicatorTextAttributes.Text.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the low indicator object(image or text).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D LowIndicatorSize
+ {
+ get
+ {
+ return lowIndicatorSize;
+ }
+ set
+ {
+ lowIndicatorSize = value;
+ UpdateLowIndicatorSize();
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the high indicator object(image or text).
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D HighIndicatorSize
+ {
+ get
+ {
+ return highIndicatorSize;
+ }
+ set
+ {
+ highIndicatorSize = value;
+ UpdateHighIndicatorSize();
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the value of the space between track and indicator.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint SpaceBetweenTrackAndIndicator
+ {
+ get
+ {
+ return spaceBetweenTrackAndIndicator.Value;
+ }
+ set
+ {
+ spaceBetweenTrackAndIndicator = value;
+ UpdateComponentByIndicatorTypeChanged();
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateValue();
+ }
+ }
+
+ /// <summary>
+ /// Focus gained callback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusGained()
+ {
+ //State = ControlStates.Focused;
+ UpdateState(true, isPressed);
+ base.OnFocusGained();
+ }
+
+ /// <summary>
+ /// Focus Lost callback.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnFocusLost()
+ {
+ //State = ControlStates.Normal;
+ UpdateState(false, isPressed);
+ base.OnFocusLost();
+ }
+
+ /// <summary>
+ /// Get Slider attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new SliderAttributes();
+ }
+
+ /// <summary>
+ /// Dispose Slider.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (null != panGestureDetector)
+ {
+ if (null != thumbImage)
+ {
+ panGestureDetector.Detach(thumbImage);
+ }
+ panGestureDetector.Detected -= OnPanGestureDetected;
+ panGestureDetector.Dispose();
+ panGestureDetector = null;
+ }
+
+ if (null != thumbImage)
+ {
+ thumbImage.TouchEvent -= OnTouchEventForThumb;
+ Utility.Dispose(thumbImage);
+ }
+ Utility.Dispose(bgThumbImage);
+ Utility.Dispose(slidedTrackImage);
+ if (null != bgTrackImage)
+ {
+ bgTrackImage.TouchEvent -= OnTouchEventForBgTrack;
+ Utility.Dispose(bgTrackImage);
+ }
+ Utility.Dispose(lowIndicatorImage);
+ Utility.Dispose(highIndicatorImage);
+ Utility.Dispose(lowIndicatorText);
+ Utility.Dispose(highIndicatorText);
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update Slider by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (sliderAttrs.BackgroundTrackAttributes != null && bgTrackImage == null)
+ {
+ bgTrackImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ PositionUsesPivotPoint = true
+ };
+ this.Add(bgTrackImage);
+ bgTrackImage.TouchEvent += OnTouchEventForBgTrack;
+ }
+ if (sliderAttrs.SlidedTrackAttributes != null && slidedTrackImage == null)
+ {
+ slidedTrackImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ if (bgTrackImage != null)
+ {
+ bgTrackImage.Add(slidedTrackImage);
+ }
+ }
+ if (sliderAttrs.ThumbBackgroundAttributes != null && bgThumbImage == null)
+ {
+ bgThumbImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ if (slidedTrackImage != null)
+ {
+ slidedTrackImage.Add(bgThumbImage);
+ }
+ }
+ if (sliderAttrs.ThumbAttributes != null && thumbImage == null)
+ {
+ thumbImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ ParentOrigin = NUI.ParentOrigin.Center,
+ PivotPoint = NUI.PivotPoint.Center,
+ PositionUsesPivotPoint = true
+ };
+ if (bgThumbImage != null)
+ {
+ bgThumbImage.Add(thumbImage);
+ }
+ thumbImage.TouchEvent += OnTouchEventForThumb;
+
+ panGestureDetector = new PanGestureDetector();
+ panGestureDetector.Attach(thumbImage);
+ panGestureDetector.Detected += OnPanGestureDetected;
+ }
+ if (sliderAttrs.LowIndicatorImageAttributes != null && lowIndicatorImage == null)
+ {
+ lowIndicatorImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ this.Add(lowIndicatorImage);
+ }
+ if (sliderAttrs.HighIndicatorImageAttributes != null && highIndicatorImage == null)
+ {
+ highIndicatorImage = new ImageView()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ this.Add(highIndicatorImage);
+ }
+ if (sliderAttrs.LowIndicatorTextAttributes != null && lowIndicatorText == null)
+ {
+ lowIndicatorText = new TextLabel()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ this.Add(lowIndicatorText);
+ }
+ if (sliderAttrs.HighIndicatorTextAttributes != null && highIndicatorText == null)
+ {
+ highIndicatorText = new TextLabel()
+ {
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed
+ };
+ this.Add(highIndicatorText);
+ }
+
+ ApplyAttributes(bgTrackImage, sliderAttrs.BackgroundTrackAttributes);
+ ApplyAttributes(slidedTrackImage, sliderAttrs.SlidedTrackAttributes);
+ ApplyAttributes(bgThumbImage, sliderAttrs.ThumbBackgroundAttributes);
+ ApplyAttributes(thumbImage, sliderAttrs.ThumbAttributes);
+ ApplyAttributes(lowIndicatorImage, sliderAttrs.LowIndicatorImageAttributes);
+ ApplyAttributes(highIndicatorImage, sliderAttrs.HighIndicatorImageAttributes);
+ ApplyAttributes(lowIndicatorText, sliderAttrs.LowIndicatorTextAttributes);
+ ApplyAttributes(highIndicatorText, sliderAttrs.HighIndicatorTextAttributes);
+
+ RelayoutBaseComponent();
+
+ UpdateComponentByIndicatorTypeChanged();
+ UpdateBgTrackSize();
+ UpdateBgTrackPosition();
+ UpdateLowIndicatorSize();
+ UpdateHighIndicatorSize();
+ UpdateValue();
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <param name="sender">serder object</param>
+ /// <param name="e">ThemeChangeEventArgs</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ SliderAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as SliderAttributes;
+ if (tempAttributes != null)
+ {
+ attributes = sliderAttrs = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ private void Initialize()
+ {
+ sliderAttrs = attributes as SliderAttributes;
+ if (null == sliderAttrs)
+ {
+ throw new Exception("Fail to get the slider attributes.");
+ }
+
+ ApplyAttributes(this, sliderAttrs);
+
+ currentSlidedOffset = 0;
+ isFocused = false;
+ isPressed = false;
+ LayoutDirectionChanged += OnLayoutDirectionChanged;
+ }
+
+ private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
+ {
+ RelayoutRequest();
+ }
+
+ private void CreateSlidedTrackAttributes()
+ {
+ if (null == sliderAttrs.SlidedTrackAttributes)
+ {
+ sliderAttrs.SlidedTrackAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateLowIndicatorImageAttributes()
+ {
+ if (null == sliderAttrs.LowIndicatorImageAttributes)
+ {
+ sliderAttrs.LowIndicatorImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateLowIndicatorTextAttributes()
+ {
+ if (null == sliderAttrs.LowIndicatorTextAttributes)
+ {
+ sliderAttrs.LowIndicatorTextAttributes = new TextAttributes();
+ }
+ }
+
+ private void CreateHighIndicatorTextAttributes()
+ {
+ if (null == sliderAttrs.HighIndicatorTextAttributes)
+ {
+ sliderAttrs.HighIndicatorTextAttributes = new TextAttributes();
+ }
+ }
+
+ private void CreateHighIndicatorImageAttributes()
+ {
+ if (null == sliderAttrs.HighIndicatorImageAttributes)
+ {
+ sliderAttrs.HighIndicatorImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateBackgroundTrackAttributes()
+ {
+ if (null == sliderAttrs.BackgroundTrackAttributes)
+ {
+ sliderAttrs.BackgroundTrackAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateThumbAttributes()
+ {
+ if (null == sliderAttrs.ThumbAttributes)
+ {
+ sliderAttrs.ThumbAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateThumbBackgroundAttributes()
+ {
+ if (null == sliderAttrs.ThumbBackgroundAttributes)
+ {
+ sliderAttrs.ThumbBackgroundAttributes = new ImageAttributes();
+ }
+ }
+
+ private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
+ {
+ if (e.PanGesture.State == Gesture.StateType.Started)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ currentSlidedOffset = slidedTrackImage.SizeWidth;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ currentSlidedOffset = slidedTrackImage.SizeHeight;
+ }
+ UpdateState(isFocused, true);
+ }
+
+ if (e.PanGesture.State == Gesture.StateType.Continuing || e.PanGesture.State == Gesture.StateType.Started)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ CalculateCurrentValueByGesture(e.PanGesture.Displacement.X);
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ CalculateCurrentValueByGesture(-e.PanGesture.Displacement.Y);
+ }
+ UpdateValue();
+ }
+
+ if (e.PanGesture.State == Gesture.StateType.Finished)
+ {
+ if (null != slidingFinishedHandler)
+ {
+ SlidingFinishedArgs args = new SlidingFinishedArgs();
+ args.CurrentValue = curValue.Value;
+ slidingFinishedHandler(this, args);
+ }
+
+ UpdateState(isFocused, false);
+ }
+ }
+
+ // Relayout basic component: track, thumb and indicator
+ private void RelayoutBaseComponent(bool isInitial = true)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ if (slidedTrackImage != null)
+ {
+ slidedTrackImage.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ slidedTrackImage.PivotPoint = NUI.PivotPoint.CenterLeft;
+ slidedTrackImage.PositionUsesPivotPoint = true;
+ }
+ if (bgThumbImage != null)
+ {
+ bgThumbImage.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ bgThumbImage.PivotPoint = NUI.PivotPoint.Center;
+ bgThumbImage.PositionUsesPivotPoint = true;
+ }
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ lowIndicatorImage.PivotPoint = NUI.PivotPoint.CenterLeft;
+ lowIndicatorImage.PositionUsesPivotPoint = true;
+ }
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ highIndicatorImage.PivotPoint = NUI.PivotPoint.CenterRight;
+ highIndicatorImage.PositionUsesPivotPoint = true;
+ }
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.ParentOrigin = NUI.ParentOrigin.CenterLeft;
+ lowIndicatorText.PivotPoint = NUI.PivotPoint.CenterLeft;
+ lowIndicatorText.PositionUsesPivotPoint = true;
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.ParentOrigin = NUI.ParentOrigin.CenterRight;
+ highIndicatorText.PivotPoint = NUI.PivotPoint.CenterRight;
+ highIndicatorText.PositionUsesPivotPoint = true;
+ }
+ if (panGestureDetector != null)
+ {
+ if (!isInitial)
+ {
+ panGestureDetector.RemoveDirection(PanGestureDetector.DirectionVertical);
+ }
+ panGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
+ }
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ if (slidedTrackImage != null)
+ {
+ slidedTrackImage.ParentOrigin = NUI.ParentOrigin.BottomCenter;
+ slidedTrackImage.PivotPoint = NUI.PivotPoint.BottomCenter;
+ slidedTrackImage.PositionUsesPivotPoint = true;
+ }
+ if (bgThumbImage != null)
+ {
+ bgThumbImage.ParentOrigin = NUI.ParentOrigin.TopCenter;
+ bgThumbImage.PivotPoint = NUI.PivotPoint.Center;
+ bgThumbImage.PositionUsesPivotPoint = true;
+ }
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.ParentOrigin = NUI.ParentOrigin.BottomCenter;
+ lowIndicatorImage.PivotPoint = NUI.PivotPoint.BottomCenter;
+ lowIndicatorImage.PositionUsesPivotPoint = true;
+ }
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.ParentOrigin = NUI.ParentOrigin.TopCenter;
+ highIndicatorImage.PivotPoint = NUI.PivotPoint.TopCenter;
+ highIndicatorImage.PositionUsesPivotPoint = true;
+ }
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.ParentOrigin = NUI.ParentOrigin.BottomCenter;
+ lowIndicatorText.PivotPoint = NUI.PivotPoint.BottomCenter;
+ lowIndicatorText.PositionUsesPivotPoint = true;
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.ParentOrigin = NUI.ParentOrigin.TopCenter;
+ highIndicatorText.PivotPoint = NUI.PivotPoint.TopCenter;
+ highIndicatorText.PositionUsesPivotPoint = true;
+ }
+ if (panGestureDetector != null)
+ {
+ if (!isInitial)
+ {
+ panGestureDetector.RemoveDirection(PanGestureDetector.DirectionHorizontal);
+ }
+ panGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
+ }
+ }
+ }
+
+ private int BgTrackLength()
+ {
+ int bgTrackLength = 0;
+ IndicatorType type = CurrentIndicatorType();
+
+ if (type == IndicatorType.None)
+ {
+ if (direction == DirectionType.Horizontal)
+ {
+ bgTrackLength = this.Size2D.Width;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ bgTrackLength = this.Size2D.Height;
+ }
+ }
+ else if (type == IndicatorType.Image)
+ {// <lowIndicatorImage> <spaceBetweenTrackAndIndicator> <bgTrack> <spaceBetweenTrackAndIndicator> <highIndicatorImage>
+ Size2D lowIndicatorImageSize = LowIndicatorImageSize();
+ Size2D highIndicatorImageSize = HighIndicatorImageSize();
+ int curSpace = (int)CurrentSpaceBetweenTrackAndIndicator();
+ if (direction == DirectionType.Horizontal)
+ {
+ int lowIndicatorSpace = ((lowIndicatorImageSize.Width == 0) ? (0) : (curSpace + lowIndicatorImageSize.Width));
+ int highIndicatorSpace = ((highIndicatorImageSize.Width == 0) ? (0) : (curSpace + highIndicatorImageSize.Width));
+ bgTrackLength = this.Size2D.Width - lowIndicatorSpace - highIndicatorSpace;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ int lowIndicatorSpace = ((lowIndicatorImageSize.Height == 0) ? (0) : (curSpace + lowIndicatorImageSize.Height));
+ int highIndicatorSpace = ((highIndicatorImageSize.Height == 0) ? (0) : (curSpace + highIndicatorImageSize.Height));
+ bgTrackLength = this.Size2D.Height - lowIndicatorSpace - highIndicatorSpace;
+ }
+ }
+ else if (type == IndicatorType.Text)
+ {// <lowIndicatorText> <spaceBetweenTrackAndIndicator> <bgTrack> <spaceBetweenTrackAndIndicator> <highIndicatorText>
+ Size2D lowIndicatorTextSize = LowIndicatorTextSize();
+ Size2D highIndicatorTextSize = HighIndicatorTextSize();
+ int curSpace = (int)CurrentSpaceBetweenTrackAndIndicator();
+ if (direction == DirectionType.Horizontal)
+ {
+ int lowIndicatorSpace = ((lowIndicatorTextSize.Width == 0) ? (0) : (curSpace + lowIndicatorTextSize.Width));
+ int highIndicatorSpace = ((highIndicatorTextSize.Width == 0) ? (0) : (curSpace + highIndicatorTextSize.Width));
+ bgTrackLength = this.Size2D.Width - lowIndicatorSpace - highIndicatorSpace;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ int lowIndicatorSpace = ((lowIndicatorTextSize.Height == 0) ? (0) : (curSpace + lowIndicatorTextSize.Height));
+ int highIndicatorSpace = ((highIndicatorTextSize.Height == 0) ? (0) : (curSpace + highIndicatorTextSize.Height));
+ bgTrackLength = this.Size2D.Height - lowIndicatorSpace - highIndicatorSpace;
+ }
+ }
+ return bgTrackLength;
+ }
+
+ private void UpdateLowIndicatorSize()
+ {
+ if (lowIndicatorSize != null)
+ {
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.Size2D = lowIndicatorSize;
+ }
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.Size2D = lowIndicatorSize;
+ }
+ }
+ else
+ {
+ if (lowIndicatorImage != null && sliderAttrs != null && sliderAttrs.LowIndicatorImageAttributes != null && sliderAttrs.LowIndicatorImageAttributes.Size2D != null)
+ {
+ lowIndicatorImage.Size2D = sliderAttrs.LowIndicatorImageAttributes.Size2D;
+ }
+ if (lowIndicatorText != null && sliderAttrs != null && sliderAttrs.LowIndicatorTextAttributes != null && sliderAttrs.LowIndicatorTextAttributes.Size2D != null)
+ {
+ lowIndicatorText.Size2D = sliderAttrs.LowIndicatorTextAttributes.Size2D;
+ }
+ }
+ }
+
+ private void UpdateHighIndicatorSize()
+ {
+ if (highIndicatorSize != null)
+ {
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.Size2D = highIndicatorSize;
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.Size2D = highIndicatorSize;
+ }
+ }
+ else
+ {
+ if (highIndicatorImage != null && sliderAttrs != null && sliderAttrs.HighIndicatorImageAttributes != null && sliderAttrs.HighIndicatorImageAttributes.Size2D != null)
+ {
+ highIndicatorImage.Size2D = sliderAttrs.HighIndicatorImageAttributes.Size2D;
+ }
+ if (highIndicatorText != null && sliderAttrs != null && sliderAttrs.HighIndicatorTextAttributes != null && sliderAttrs.HighIndicatorTextAttributes.Size2D != null)
+ {
+ highIndicatorText.Size2D = sliderAttrs.HighIndicatorTextAttributes.Size2D;
+ }
+ }
+ }
+
+ private void UpdateBgTrackSize()
+ {
+ if(bgTrackImage == null)
+ {
+ return;
+ }
+ int curTrackThickness = (int)CurrentTrackThickness();
+ int bgTrackLength = BgTrackLength();
+ if (direction == DirectionType.Horizontal)
+ {
+ bgTrackImage.Size2D = new Size2D(bgTrackLength, curTrackThickness);
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ bgTrackImage.Size2D = new Size2D(curTrackThickness, bgTrackLength);
+ }
+ }
+
+ private void UpdateBgTrackPosition()
+ {
+ if (bgTrackImage == null)
+ {
+ return;
+ }
+ IndicatorType type = CurrentIndicatorType();
+
+ if (type == IndicatorType.None)
+ {
+ bgTrackImage.Position2D = new Position2D(0, 0);
+ }
+ else if (type == IndicatorType.Image)
+ {
+ Size2D lowIndicatorImageSize = LowIndicatorImageSize();
+ Size2D highIndicatorImageSize = HighIndicatorImageSize();
+ int curSpace = (int)CurrentSpaceBetweenTrackAndIndicator();
+ if (direction == DirectionType.Horizontal)
+ {
+ int lowIndicatorSpace = ((lowIndicatorImageSize.Width == 0) ? (0) : (curSpace + lowIndicatorImageSize.Width));
+ int highIndicatorSpace = ((highIndicatorImageSize.Width == 0) ? (0) : (curSpace + highIndicatorImageSize.Width));
+ bgTrackImage.Position2D = new Position2D(lowIndicatorSpace - (lowIndicatorSpace + highIndicatorSpace) / 2, 0);
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ int lowIndicatorSpace = ((lowIndicatorImageSize.Height == 0) ? (0) : (curSpace + lowIndicatorImageSize.Height));
+ int highIndicatorSpace = ((highIndicatorImageSize.Height == 0) ? (0) : (curSpace + highIndicatorImageSize.Height));
+ bgTrackImage.Position2D = new Position2D(0, lowIndicatorSpace - (lowIndicatorSpace + highIndicatorSpace) / 2);
+ }
+ }
+ else if (type == IndicatorType.Text)
+ {
+ Size2D lowIndicatorTextSize = LowIndicatorTextSize();
+ Size2D highIndicatorTextSize = HighIndicatorTextSize();
+ int curSpace = (int)CurrentSpaceBetweenTrackAndIndicator();
+ if (direction == DirectionType.Horizontal)
+ {
+ int lowIndicatorSpace = ((lowIndicatorTextSize.Width == 0) ? (0) : (curSpace + lowIndicatorTextSize.Width));
+ int highIndicatorSpace = ((highIndicatorTextSize.Width == 0) ? (0) : (curSpace + highIndicatorTextSize.Width));
+ bgTrackImage.Position2D = new Position2D(lowIndicatorSpace - (lowIndicatorSpace + highIndicatorSpace) / 2, 0);
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ int lowIndicatorSpace = ((lowIndicatorTextSize.Height == 0) ? (0) : (curSpace + lowIndicatorTextSize.Height));
+ int highIndicatorSpace = ((highIndicatorTextSize.Height == 0) ? (0) : (curSpace + highIndicatorTextSize.Height));
+ bgTrackImage.Position2D = new Position2D(0, -(lowIndicatorSpace - (lowIndicatorSpace + highIndicatorSpace) / 2));
+ }
+ }
+ }
+
+ private void UpdateValue()
+ {
+ if (slidedTrackImage == null || curValue == null || minValue == null || maxValue == null)
+ {
+ return;
+ }
+ if (curValue < minValue || curValue > maxValue || minValue >= maxValue)
+ {
+ return;
+ }
+
+ float ratio = 0;
+ ratio = (float)(curValue - minValue) / (float)(maxValue - minValue);
+
+ uint curTrackThickness = CurrentTrackThickness();
+
+ if (direction == DirectionType.Horizontal)
+ {
+ if (LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ ratio = 1.0f - ratio;
+ }
+ float slidedTrackLength = (float)BgTrackLength() * ratio;
+ slidedTrackImage.Size2D = new Size2D((int)(slidedTrackLength + round), (int)curTrackThickness); //Add const round to reach Math.Round function.
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ float slidedTrackLength = (float)BgTrackLength() * ratio;
+ slidedTrackImage.Size2D = new Size2D((int)(curTrackThickness + round), (int)slidedTrackLength); //Add const round to reach Math.Round function.
+ }
+ }
+
+ private uint CurrentTrackThickness()
+ {
+ uint curTrackThickness = 0;
+ if (trackThickness != null)
+ {
+ curTrackThickness = trackThickness.Value;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.TrackThickness != null)
+ {
+ curTrackThickness = sliderAttrs.TrackThickness.Value;
+ }
+ }
+ return curTrackThickness;
+ }
+
+ private uint CurrentSpaceBetweenTrackAndIndicator()
+ {
+ uint curSpace = 0;
+ if (spaceBetweenTrackAndIndicator != null)
+ {
+ curSpace = spaceBetweenTrackAndIndicator.Value;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.SpaceBetweenTrackAndIndicator != null)
+ {
+ curSpace = sliderAttrs.SpaceBetweenTrackAndIndicator.Value;
+ }
+ }
+ return curSpace;
+ }
+
+ private IndicatorType CurrentIndicatorType()
+ {
+ IndicatorType type = IndicatorType.None;
+ if (sliderAttrs != null)
+ {
+ type = sliderAttrs.IndicatorType;
+ }
+ return type;
+ }
+
+ private Size2D LowIndicatorImageSize()
+ {
+ Size2D size = new Size2D(0, 0);
+ if (lowIndicatorSize != null)
+ {
+ size = lowIndicatorSize;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.LowIndicatorImageAttributes != null && sliderAttrs.LowIndicatorImageAttributes.Size2D != null)
+ {
+ size = sliderAttrs.LowIndicatorImageAttributes.Size2D;
+ }
+ }
+ return size;
+ }
+
+ private Size2D HighIndicatorImageSize()
+ {
+ Size2D size = new Size2D(0, 0);
+ if (highIndicatorSize != null)
+ {
+ size = highIndicatorSize;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.HighIndicatorImageAttributes != null && sliderAttrs.HighIndicatorImageAttributes.Size2D != null)
+ {
+ size = sliderAttrs.HighIndicatorImageAttributes.Size2D;
+ }
+ }
+ return size;
+ }
+
+ private Size2D LowIndicatorTextSize()
+ {
+ Size2D size = new Size2D(0, 0);
+ if (lowIndicatorSize != null)
+ {
+ size = lowIndicatorSize;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.LowIndicatorTextAttributes != null && sliderAttrs.LowIndicatorTextAttributes.Size2D != null)
+ {
+ size = sliderAttrs.LowIndicatorTextAttributes.Size2D;
+ }
+ }
+ return size;
+ }
+
+ private Size2D HighIndicatorTextSize()
+ {
+ Size2D size = new Size2D(0, 0);
+ if (highIndicatorSize != null)
+ {
+ size = highIndicatorSize;
+ }
+ else
+ {
+ if (sliderAttrs != null && sliderAttrs.HighIndicatorTextAttributes != null && sliderAttrs.HighIndicatorTextAttributes.Size2D != null)
+ {
+ size = sliderAttrs.HighIndicatorTextAttributes.Size2D;
+ }
+ }
+ return size;
+ }
+
+ private void CalculateCurrentValueByGesture(float offset)
+ {
+ currentSlidedOffset += offset;
+
+ if (currentSlidedOffset <= 0)
+ {
+ curValue = minValue;
+ }
+ else if (currentSlidedOffset >= BgTrackLength())
+ {
+ curValue = maxValue;
+ }
+ else
+ {
+ int bgTrackLength = BgTrackLength();
+ if (bgTrackLength != 0)
+ {
+ curValue = ((currentSlidedOffset / (float)bgTrackLength) * (float)(maxValue - minValue)) + minValue;
+ }
+ }
+ if (valueChangedHandler != null)
+ {
+ ValueChangedArgs args = new ValueChangedArgs();
+ args.CurrentValue = curValue.Value;
+ valueChangedHandler(this, args);
+ }
+ }
+
+ private bool OnTouchEventForBgTrack(object source, TouchEventArgs e)
+ {
+ PointStateType state = e.Touch.GetState(0);
+ if (state == PointStateType.Down)
+ {
+ Vector2 pos = e.Touch.GetLocalPosition(0);
+ CalculateCurrentValueByTouch(pos);
+ UpdateValue();
+ if (null != slidingFinishedHandler)
+ {
+ SlidingFinishedArgs args = new SlidingFinishedArgs();
+ args.CurrentValue = curValue.Value;
+ slidingFinishedHandler(this, args);
+ }
+ }
+ return false;
+ }
+
+ private bool OnTouchEventForThumb(object source, TouchEventArgs e)
+ {
+ PointStateType state = e.Touch.GetState(0);
+ if (state == PointStateType.Down)
+ {
+ UpdateState(isFocused, true);
+ }
+ else if (state == PointStateType.Up)
+ {
+ UpdateState(isFocused, false);
+ }
+ return true;
+ }
+
+ private void CalculateCurrentValueByTouch(Vector2 pos)
+ {
+ int bgTrackLength = BgTrackLength();
+ if (direction == DirectionType.Horizontal)
+ {
+ currentSlidedOffset = pos.X;
+ }
+ else if (direction == DirectionType.Vertical)
+ {
+ currentSlidedOffset = bgTrackLength - pos.Y;
+ }
+ if (bgTrackLength != 0)
+ {
+ curValue = ((currentSlidedOffset / (float)bgTrackLength) * (maxValue - minValue)) + minValue;
+ if (null != valueChangedHandler)
+ {
+ ValueChangedArgs args = new ValueChangedArgs();
+ args.CurrentValue = curValue.Value;
+ valueChangedHandler(this, args);
+ }
+ }
+ }
+
+ private void UpdateState(bool isFocusedNew, bool isPressedNew)
+ {
+ if (isFocused == isFocusedNew && isPressed == isPressedNew)
+ {
+ return;
+ }
+ if (thumbImage == null || sliderAttrs == null)
+ {
+ return;
+ }
+ isFocused = isFocusedNew;
+ isPressed = isPressedNew;
+
+ if (!isFocused && !isPressed)
+ {
+ State = ControlStates.Normal;
+ ApplyAttributes(bgThumbImage, sliderAttrs.ThumbBackgroundAttributes);
+ ApplyAttributes(thumbImage, sliderAttrs.ThumbAttributes);
+ if (stateChangedHandler != null)
+ {
+ StateChangedArgs args = new StateChangedArgs();
+ args.CurrentState = ControlStates.Normal;
+ stateChangedHandler(this, args);
+ }
+ }
+ else if (isPressed)
+ {
+ State = ControlStates.Pressed;
+ ApplyAttributes(bgThumbImage, sliderAttrs.ThumbBackgroundAttributes);
+ ApplyAttributes(thumbImage, sliderAttrs.ThumbAttributes);
+
+ if (stateChangedHandler != null)
+ {
+ StateChangedArgs args = new StateChangedArgs();
+ args.CurrentState = ControlStates.Pressed;
+ stateChangedHandler(this, args);
+ }
+ }
+ else if (!isPressed && isFocused)
+ {
+ State = ControlStates.Focused;
+ ApplyAttributes(bgThumbImage, sliderAttrs.ThumbBackgroundAttributes);
+ ApplyAttributes(thumbImage, sliderAttrs.ThumbAttributes);
+
+ if (stateChangedHandler != null)
+ {
+ StateChangedArgs args = new StateChangedArgs();
+ args.CurrentState = ControlStates.Focused;
+ stateChangedHandler(this, args);
+ }
+ }
+ }
+
+ private void UpdateComponentByIndicatorTypeChanged()
+ {
+ IndicatorType type = CurrentIndicatorType();
+ if (type == IndicatorType.None)
+ {
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.Hide();
+ }
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.Hide();
+ }
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.Hide();
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.Hide();
+ }
+ }
+ else if (type == IndicatorType.Image)
+ {
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.Show();
+ }
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.Show();
+ }
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.Hide();
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.Hide();
+ }
+ }
+ else if (type == IndicatorType.Text)
+ {
+ if (lowIndicatorText != null)
+ {
+ lowIndicatorText.Show();
+ }
+ if (highIndicatorText != null)
+ {
+ highIndicatorText.Show();
+ }
+ if (lowIndicatorImage != null)
+ {
+ lowIndicatorImage.Hide();
+ }
+ if (highIndicatorImage != null)
+ {
+ highIndicatorImage.Hide();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Value Changed event data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ValueChangedArgs : EventArgs
+ {
+ /// <summary>
+ /// Curren value
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CurrentValue;
+ }
+
+ /// <summary>
+ /// Value Changed event data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SlidingFinishedArgs : EventArgs
+ {
+ /// <summary>
+ /// Curren value
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float CurrentValue;
+ }
+
+ /// <summary>
+ /// State Changed event data.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class StateChangedArgs : EventArgs
+ {
+ /// <summary>
+ /// Curent state
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ControlStates CurrentState;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Switch is one kind of common component, it can be used as selector.
+ /// User can handle Navigation by adding/inserting/deleting NavigationItem.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Switch : Button
+ {
+ private const int aniTime = 100; // will be defined in const file later
+ private ImageView switchBackgroundImage;
+ private ImageView switchHandlerImage;
+ private Animation handlerAni = null;
+ private SwitchAttributes switchAttributes;
+
+ /// <summary>
+ /// Creates a new instance of a Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Switch() : base()
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Switch with style.
+ /// </summary>
+ /// <param name="style">Create Switch by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Switch(string style) : base(style)
+ {
+ Initialize();
+ }
+ /// <summary>
+ /// Creates a new instance of a Switch with attributes.
+ /// </summary>
+ /// <param name="attrs">Create Switch by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Switch(SwitchAttributes attrs) : base(attrs)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<SelectEventArgs> SelectedEvent;
+
+ /// <summary>
+ /// Background image's resource url in Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string SwitchBackgroundImageURL
+ {
+ get
+ {
+ return switchAttributes?.SwitchBackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateSwitchBackgroundImageAttributes();
+ if (switchAttributes.SwitchBackgroundImageAttributes.ResourceUrl == null)
+ {
+ switchAttributes.SwitchBackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+ switchAttributes.SwitchBackgroundImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Background image's resource url selector in Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector SwitchBackgroundImageURLSelector
+ {
+ get
+ {
+ return switchAttributes?.SwitchBackgroundImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateSwitchBackgroundImageAttributes();
+ switchAttributes.SwitchBackgroundImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Handler image's resource url in Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string SwitchHandlerImageURL
+ {
+ get
+ {
+ return switchAttributes?.SwitchHandlerImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateSwitchHandlerImageAttributes();
+ if (switchAttributes.SwitchHandlerImageAttributes.ResourceUrl == null)
+ {
+ switchAttributes.SwitchHandlerImageAttributes.ResourceUrl = new StringSelector();
+ }
+ switchAttributes.SwitchHandlerImageAttributes.ResourceUrl.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Handler image's resource url selector in Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector SwitchHandlerImageURLSelector
+ {
+ get
+ {
+ return switchAttributes?.SwitchHandlerImageAttributes?.ResourceUrl;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateSwitchHandlerImageAttributes();
+ switchAttributes.SwitchHandlerImageAttributes.ResourceUrl = value.Clone() as StringSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Handler image's size in Switch.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D SwitchHandlerImageSize2D
+ {
+ get
+ {
+ return switchAttributes?.SwitchHandlerImageAttributes?.Size2D ?? new Size2D(0, 0);
+ }
+ set
+ {
+ CreateSwitchHandlerImageAttributes();
+ switchAttributes.SwitchHandlerImageAttributes.Size2D = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Dispose Switch and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (handlerAni != null)
+ {
+ if (handlerAni.State == Animation.States.Playing)
+ {
+ handlerAni.Stop();
+ }
+ handlerAni.Dispose();
+ handlerAni = null;
+ }
+
+ if (switchHandlerImage != null)
+ {
+ Utility.Dispose(switchHandlerImage);
+ }
+ if (switchBackgroundImage != null)
+ {
+ Utility.Dispose(switchBackgroundImage);
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update Switch by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ base.OnUpdate();
+
+ if (switchAttributes.SwitchBackgroundImageAttributes != null)
+ {
+ if (switchBackgroundImage == null)
+ {
+ switchBackgroundImage = new ImageView()
+ {
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ PositionUsesPivotPoint = true,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ };
+ switchBackgroundImage.Name = "SwitchBackgroundImage";
+ Add(switchBackgroundImage);
+ }
+ ApplyAttributes(switchBackgroundImage, switchAttributes.SwitchBackgroundImageAttributes);
+
+ if (switchAttributes.SwitchHandlerImageAttributes != null)
+ {
+ if (switchHandlerImage == null)
+ {
+ switchHandlerImage = new ImageView()
+ {
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ PositionUsesPivotPoint = true,
+ };
+ switchHandlerImage.Name = "SwitchHandlerImage";
+ switchBackgroundImage.Add(switchHandlerImage);
+ }
+ ApplyAttributes(switchHandlerImage, switchAttributes.SwitchHandlerImageAttributes);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Called after a key event is received by the view that has had its focus set.
+ /// </summary>
+ /// <param name="key">The key event.</param>
+ /// <returns>True if the key event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnKey(Key key)
+ {
+ if (IsEnabled == false)
+ {
+ return false;
+ }
+ bool ret = base.OnKey(key);
+ if (key.State == Key.StateType.Up)
+ {
+ if (key.KeyPressedName == "Return")
+ {
+ OnSelect();
+ }
+ }
+
+ return ret;
+ }
+
+ /// <summary>
+ /// Called after a touch event is received by the owning view.<br />
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).<br />
+ /// </summary>
+ /// <param name="touch">The touch event.</param>
+ /// <returns>True if the event should be consumed.</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override bool OnTouch(Touch touch)
+ {
+ if(IsEnabled == false)
+ {
+ return false;
+ }
+ PointStateType state = touch.GetState(0);
+ bool ret = base.OnTouch(touch);
+ switch (state)
+ {
+ case PointStateType.Up:
+ OnSelect();
+ break;
+ default:
+ break;
+ }
+ return ret;
+ }
+
+ /// <summary>
+ /// Get Switch attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new SwitchAttributes();
+ }
+
+ private void Initialize()
+ {
+ switchAttributes = attributes as SwitchAttributes;
+ if (switchAttributes == null)
+ {
+ throw new Exception("Switch attribute parse error.");
+ }
+
+ switchAttributes.IsSelectable = true;
+ CreateHandlerAnimation();
+ }
+
+ private void CreateSwitchBackgroundImageAttributes()
+ {
+ if (switchAttributes.SwitchBackgroundImageAttributes == null)
+ {
+ switchAttributes.SwitchBackgroundImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ };
+ }
+ }
+
+ private void CreateSwitchHandlerImageAttributes()
+ {
+ if (switchAttributes.SwitchHandlerImageAttributes == null)
+ {
+ switchAttributes.SwitchHandlerImageAttributes = new ImageAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ };
+ }
+ }
+
+ private void CreateHandlerAnimation()
+ {
+ if (handlerAni == null)
+ {
+ handlerAni = new Animation(aniTime);
+ }
+ }
+
+ private void OnSelect()
+ {
+ if (handlerAni.State == Animation.States.Playing)
+ {
+ handlerAni.Stop();
+ }
+ handlerAni.Clear();
+ if (switchHandlerImage != null)
+ {
+ handlerAni.AnimateTo(switchHandlerImage, "PositionX", Size2D.Width - switchHandlerImage.Size2D.Width - switchHandlerImage.Position2D.X);
+ }
+ if (switchBackgroundImage != null)
+ {
+ switchBackgroundImage.Opacity = 0.5f; ///////need defined by UX
+ handlerAni.AnimateTo(switchBackgroundImage, "Opacity", 1);
+ }
+ handlerAni.Play();
+
+ if (SelectedEvent != null)
+ {
+ SelectEventArgs eventArgs = new SelectEventArgs();
+ eventArgs.IsSelected = IsSelected;
+ SelectedEvent(this, eventArgs);
+ }
+ }
+
+ /// <summary>
+ /// SelectEventArgs is a class to record item selected arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class SelectEventArgs : EventArgs
+ {
+ /// <summary> Select state of Switch </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsSelected;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Tab is one kind of common component, it can be used as menu label.
+ /// User can handle Tab by adding/inserting/deleting TabItem.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Tab : Control
+ {
+ private const int aniTime = 100; // will be defined in const file later
+ private List<TabItem> itemList = new List<TabItem>();
+ private int curIndex = 0;
+ private View underline = null;
+ private TabAttributes tabAttributes = null;
+ private Animation underlineAni = null;
+ private bool isNeedAnimation = false;
+
+ /// <summary>
+ /// Creates a new instance of a Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Tab() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Tab with style.
+ /// </summary>
+ /// <param name="style">Create Tab by special style defined in UX.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Tab(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Creates a new instance of a Tab with attributes.
+ /// </summary>
+ /// <param name="attributes">Create Tab by attributes customized by user.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Tab(TabAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// An event for the item changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ItemChangeEventArgs> ItemChangedEvent;
+
+ /// <summary>
+ /// Selected item's index in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int SelectedItemIndex
+ {
+ get
+ {
+ return curIndex;
+ }
+ set
+ {
+ if (value < itemList.Count)
+ {
+ UpdateSelectedItem(itemList[value]);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Flag to decide if TabItem is adjusted by text's natural width.
+ /// If true, TabItem's width will be equal as text's natural width, if false, it will be decided by Tab's width and tab item count.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 bool IsNatureTextWidth
+ {
+ get
+ {
+ return tabAttributes.IsNatureTextWidth;
+ }
+ set
+ {
+ tabAttributes.IsNatureTextWidth = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gap between items.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int ItemGap
+ {
+ get
+ {
+ return tabAttributes.ItemGap;
+ }
+ set
+ {
+ tabAttributes.ItemGap = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Left space in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int LeftSpace
+ {
+ get
+ {
+ return (int)tabAttributes.Space.X;
+ }
+ set
+ {
+ tabAttributes.Space.X = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Bottom space in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int BottomSpace
+ {
+ get
+ {
+ return (int)tabAttributes.Space.W;
+ }
+ set
+ {
+ tabAttributes.Space.W = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Right space in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int RightSpace
+ {
+ get
+ {
+ return (int)tabAttributes.Space.Y;
+ }
+ set
+ {
+ tabAttributes.Space.Y = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Top space in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TopSpace
+ {
+ get
+ {
+ return (int)tabAttributes.Space.Z;
+ }
+ set
+ {
+ tabAttributes.Space.Z = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// UnderLine view's size in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2D UnderLineSize2D
+ {
+ get
+ {
+ return tabAttributes.UnderLineAttributes?.Size2D;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateUnderLineAttributes();
+ tabAttributes.UnderLineAttributes.Size2D = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// UnderLine view's background in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color UnderLineBackgroundColor
+ {
+ get
+ {
+ return tabAttributes.UnderLineAttributes?.BackgroundColor?.All;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateUnderLineAttributes();
+ if (tabAttributes.UnderLineAttributes.BackgroundColor == null)
+ {
+ tabAttributes.UnderLineAttributes.BackgroundColor = new ColorSelector();
+ }
+ tabAttributes.UnderLineAttributes.BackgroundColor.All = value;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Text point size in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float PointSize
+ {
+ get
+ {
+ return tabAttributes.TextAttributes?.PointSize?.All ?? 0;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (tabAttributes.TextAttributes.PointSize == null)
+ {
+ tabAttributes.TextAttributes.PointSize = new FloatSelector();
+ }
+ tabAttributes.TextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text font family in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get
+ {
+ return tabAttributes.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateTextAttributes();
+ tabAttributes.TextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text color in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TextColor
+ {
+ get
+ {
+ return tabAttributes.TextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (tabAttributes.TextAttributes.TextColor == null)
+ {
+ tabAttributes.TextAttributes.TextColor = new ColorSelector();
+ }
+ tabAttributes.TextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Text color selector in Tab.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector TextColorSelector
+ {
+ get
+ {
+ return tabAttributes.TextAttributes.TextColor;
+ }
+ set
+ {
+ if (value != null)
+ {
+ CreateTextAttributes();
+ tabAttributes.TextAttributes.TextColor = value.Clone() as ColorSelector;
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Add tab item by item data. The added item will be added to end of all items automatically.
+ /// </summary>
+ /// <param name="itemData">Item data which will apply to tab item view.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AddItem(TabItemData itemData)
+ {
+ AddItemByIndex(itemData, itemList.Count);
+ }
+
+ /// <summary>
+ /// Insert tab item by item data. The inserted item will be added to the special position by index automatically.
+ /// </summary>
+ /// <param name="itemData">Item data which will apply to tab item view.</param>
+ /// <param name="index">Position index where will be inserted.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 InsertItem(TabItemData itemData, int index)
+ {
+ AddItemByIndex(itemData, index);
+ }
+
+ /// <summary>
+ /// Delete tab item by index.
+ /// </summary>
+ /// <param name="itemIndex">Position index where will be deleted.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 DeleteItem(int itemIndex)
+ {
+ if(itemList == null || itemIndex < 0 || itemIndex >= itemList.Count)
+ {
+ return;
+ }
+
+ if (curIndex > itemIndex || (curIndex == itemIndex && itemIndex == itemList.Count - 1))
+ {
+ curIndex--;
+ }
+
+ Remove(itemList[itemIndex]);
+ itemList[itemIndex].Dispose();
+ itemList.RemoveAt(itemIndex);
+
+ UpdateItems();
+ }
+
+ /// <summary>
+ /// Dispose Tab and all children on it.
+ /// </summary>
+ /// <param name="type">Dispose type.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if(underlineAni != null)
+ {
+ if(underlineAni.State == Animation.States.Playing)
+ {
+ underlineAni.Stop();
+ }
+ underlineAni.Dispose();
+ underlineAni = null;
+ }
+ Utility.Dispose(underline);
+ if(itemList != null)
+ {
+ for(int i = 0; i < itemList.Count; i++)
+ {
+ Remove(itemList[i]);
+ itemList[i].Dispose();
+ itemList[i] = null;
+ }
+ itemList.Clear();
+ itemList = null;
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Update Tab by attributes.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (tabAttributes.UnderLineAttributes != null)
+ {
+ if (underline == null)
+ {
+ underline = new View()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ };
+ Add(underline);
+ CreateUnderLineAnimation();
+ }
+ ApplyAttributes(underline, tabAttributes.UnderLineAttributes);
+ }
+
+ if (tabAttributes.TextAttributes != null)
+ {
+ if (curIndex >= 0 && curIndex < itemList.Count)
+ {
+ itemList[curIndex].UpdateItemText(tabAttributes.TextAttributes);
+ }
+ }
+
+ LayoutChild();
+ }
+
+ /// <summary>
+ /// Get Tab attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new TabAttributes();
+ }
+
+ /// <summary>
+ /// Theme change callback when theme is changed, this callback will be trigger.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
+ {
+ TabAttributes tempAttributes = StyleManager.Instance.GetAttributes(style) as TabAttributes;
+ if (tempAttributes != null)
+ {
+ tempAttributes.IsNatureTextWidth = tabAttributes.IsNatureTextWidth; // keep IsNatureTextWidth as original
+ attributes = tabAttributes = tempAttributes;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Layout child in Tab and it can be override by user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void LayoutChild()
+ {
+ if (tabAttributes == null || itemList == null)
+ {
+ return;
+ }
+ int totalNum = itemList.Count;
+ if (totalNum == 0)
+ {
+ return;
+ }
+
+ int preX = (int)tabAttributes.Space.X;
+ int preW = 0;
+ int itemGap = tabAttributes.ItemGap;
+
+ if (LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ if (tabAttributes.IsNatureTextWidth == true)
+ {
+ for (int i = 0; i < totalNum; i++)
+ {
+ preW = itemList[i].TextItem.NaturalSize2D.Width;
+ itemList[i].Position2D.X = preX;
+ itemList[i].Size2D.Width = preW;
+ preX = itemList[i].Position2D.X + preW + itemGap;
+ itemList[i].Index = i;
+ }
+ }
+ else
+ {
+ preW = (Size2D.Width - (int)tabAttributes.Space.X - (int)tabAttributes.Space.Y) / totalNum;
+ for (int i = 0; i < totalNum; i++)
+ {
+ itemList[i].Position2D.X = preX;
+ itemList[i].Size2D.Width = preW;
+ preX = itemList[i].Position2D.X + preW + itemGap;
+ itemList[i].Index = i;
+ }
+ }
+ }
+ else
+ {
+ preX = (int)tabAttributes.Space.Y;
+ if (tabAttributes.IsNatureTextWidth == true)
+ {
+ int w = Size2D.Width;
+ for (int i = 0; i < totalNum; i++)
+ {
+ preW = itemList[i].TextItem.NaturalSize2D.Width;
+ itemList[i].Position2D.X = w - preW - preX;
+ itemList[i].Size2D.Width = preW;
+ preX = w - itemList[i].Position2D.X + itemGap;
+ itemList[i].Index = i;
+ }
+ }
+ else
+ {
+ preW = (Size2D.Width - (int)tabAttributes.Space.X - (int)tabAttributes.Space.Y) / totalNum;
+ for (int i = totalNum - 1; i >= 0; i--)
+ {
+ itemList[i].Position2D.X = preX;
+ itemList[i].Size2D.Width = preW;
+ preX = itemList[i].Position2D.X + preW + itemGap;
+ itemList[i].Index = i;
+ }
+ }
+ }
+ UpdateUnderLinePos();
+ }
+
+ private void Initialize()
+ {
+ tabAttributes = attributes as TabAttributes;
+ if (tabAttributes == null)
+ {
+ throw new Exception("Tab attribute parse error.");
+ }
+
+ ApplyAttributes(this, tabAttributes);
+ LayoutDirectionChanged += OnLayoutDirectionChanged;
+ }
+
+ private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
+ {
+ LayoutChild();
+ }
+
+ private void AddItemByIndex(TabItemData itemData, int index)
+ {
+ int h = 0;
+ int topSpace = (int)tabAttributes.Space.Z;
+ if (tabAttributes.UnderLineAttributes != null && tabAttributes.UnderLineAttributes.Size2D != null)
+ {
+ h = tabAttributes.UnderLineAttributes.Size2D.Height;
+ }
+ Tab.TabItem item = new TabItem();
+ ApplyAttributes(item.TextItem, tabAttributes.TextAttributes);
+ item.TextItem.Text = itemData.Text;
+ item.Size2D.Height = Size2D.Height - h - topSpace;
+ item.Position2D.Y = topSpace;
+ item.TouchEvent += ItemTouchEvent;
+ Add(item);
+
+ if(index >= itemList.Count)
+ {
+ itemList.Add(item);
+ }
+ else
+ {
+ itemList.Insert(index, item);
+ }
+
+ UpdateItems();
+ }
+
+ private void UpdateItems()
+ {
+ LayoutChild();
+ if (itemList != null && curIndex >= 0 && curIndex < itemList.Count)
+ {
+ itemList[curIndex].State = ControlStates.Selected;
+ itemList[curIndex].UpdateItemText(tabAttributes.TextAttributes);
+ UpdateUnderLinePos();
+ }
+ else
+ {
+ if (underline != null)
+ {
+ underline.Hide();
+ }
+ }
+ }
+
+ private void CreateUnderLineAttributes()
+ {
+ if (tabAttributes.UnderLineAttributes == null)
+ {
+ tabAttributes.UnderLineAttributes = new ViewAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ };
+ }
+ }
+
+ private void CreateTextAttributes()
+ {
+ if (tabAttributes.TextAttributes == null)
+ {
+ tabAttributes.TextAttributes = new TextAttributes()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ };
+ }
+ }
+
+ private void CreateUnderLineAnimation()
+ {
+ if (underlineAni == null)
+ {
+ underlineAni = new Animation(aniTime);
+ }
+ }
+
+ private void UpdateUnderLinePos()
+ {
+ if (underline == null || tabAttributes.UnderLineAttributes == null || tabAttributes.UnderLineAttributes.Size2D == null
+ || itemList == null || itemList.Count <= 0)
+ {
+ return;
+ }
+
+ tabAttributes.UnderLineAttributes.Size2D.Width = itemList[curIndex].Size2D.Width;
+
+ underline.Size2D = new Size2D(itemList[curIndex].Size2D.Width, tabAttributes.UnderLineAttributes.Size2D.Height);
+ underline.BackgroundColor = tabAttributes.UnderLineAttributes.BackgroundColor.All;
+ if (isNeedAnimation)
+ {
+ CreateUnderLineAnimation();
+ if (underlineAni.State == Animation.States.Playing)
+ {
+ underlineAni.Stop();
+ }
+ underlineAni.Clear();
+ underlineAni.AnimateTo(underline, "PositionX", itemList[curIndex].Position2D.X);
+ underlineAni.Play();
+ }
+ else
+ {
+ underline.Position2D.X = itemList[curIndex].Position2D.X;
+ isNeedAnimation = true;
+ }
+
+ underline.Show();
+ }
+
+ private void UpdateSelectedItem(TabItem item)
+ {
+ if(item == null || curIndex == item.Index)
+ {
+ return;
+ }
+
+ ItemChangeEventArgs e = new ItemChangeEventArgs
+ {
+ PreviousIndex = curIndex,
+ CurrentIndex = item.Index
+ };
+ ItemChangedEvent?.Invoke(this, e);
+
+ itemList[curIndex].State = ControlStates.Normal;
+ itemList[curIndex].UpdateItemText(tabAttributes.TextAttributes);
+ curIndex = item.Index;
+ itemList[curIndex].State = ControlStates.Selected;
+ itemList[curIndex].UpdateItemText(tabAttributes.TextAttributes);
+
+ UpdateUnderLinePos();
+ }
+
+ private bool ItemTouchEvent(object source, TouchEventArgs e)
+ {
+ TabItem item = source as TabItem;
+ if(item == null)
+ {
+ return false;
+ }
+ PointStateType state = e.Touch.GetState(0);
+ if (state == PointStateType.Up)
+ {
+ UpdateSelectedItem(item);
+ }
+
+ return true;
+ }
+
+ internal class TabItem : Control
+ {
+ public TabItem() : base()
+ {
+ TextItem = new TextLabel()
+ {
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ PositionUsesPivotPoint = true,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center
+ };
+ Add(TextItem);
+ }
+
+ public string Text
+ {
+ get
+ {
+ return TextItem.Text;
+ }
+ set
+ {
+ TextItem.Text = value;
+ }
+ }
+
+ internal int Index
+ {
+ get;
+ set;
+ }
+
+ internal TextLabel TextItem
+ {
+ get;
+ set;
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ if (TextItem != null)
+ {
+ Remove(TextItem);
+ TextItem.Dispose();
+ TextItem = null;
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ protected override Attributes GetAttributes()
+ {
+ return null;
+ }
+
+ internal void UpdateItemText(TextAttributes attrs)
+ {
+ ApplyAttributes(TextItem, attrs);
+ }
+ }
+
+ /// <summary>
+ /// TabItemData is a class to record all data which will be applied to Tab item.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class TabItemData
+ {
+ /// <summary>
+ /// Text string in tab item view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Text
+ {
+ get;
+ set;
+ }
+ }
+
+ /// <summary>
+ /// ItemChangeEventArgs is a class to record item change event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ItemChangeEventArgs : EventArgs
+ {
+ /// <summary> Previous selected index of Tab </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int PreviousIndex;
+ /// <summary> Current selected index of Tab </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int CurrentIndex;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Use a toast to provide simple messages when the user does not need to make an additional action or confirmation.
+ /// Unlike other popups, a toast only has the body field as it is just used for providing simple feedback to user actions.
+ /// A toast will automatically disappear after a certain time.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Toast : Control
+ {
+ /// <summary>
+ /// textLabels.
+ /// </summary>
+ protected TextLabel[] textLabels = null;
+ private ToastAttributes toastAttributes = null;
+ private string[] textArray = null;
+ private NPatchVisual toastBackground = null;
+ private Timer timer = null;
+
+ private readonly int maxTextAreaWidth = 808;
+ private readonly uint textLineHeight = 56;
+ private readonly uint textLineSpace = 4;
+ private readonly float textPointSize = 38;
+ private readonly int textPaddingLeft = 96;
+ private readonly int textPaddingRight = 96;
+ private readonly int textPaddingTop = 38;
+ private readonly int textPaddingBottom = 38;
+ private readonly uint duration = 3000;
+
+ /// <summary>
+ /// Construct Toast with null.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Toast() : base()
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// The constructor of the Toast class with specific Attributes.
+ /// </summary>
+ /// <param name="attributes">Construct Attributes</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Toast(ToastAttributes attributes) : base(attributes)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Constructor of the Toast class with special style.
+ /// </summary>
+ /// <param name="style"> style name </param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Toast(string style) : base(style)
+ {
+ Initialize();
+ }
+
+ /// <summary>
+ /// Gets or sets the text array of toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string[] TextArray
+ {
+ get
+ {
+ return textArray;
+ }
+ set
+ {
+ if (null != value)
+ {
+ textArray = value;
+ SetToastText();
+ RelayoutRequest();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text point size in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 float PointSize
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.PointSize?.All ?? textPointSize;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (null == toastAttributes.TextAttributes.PointSize)
+ {
+ toastAttributes.TextAttributes.PointSize = new FloatSelector();
+ }
+ toastAttributes.TextAttributes.PointSize.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text font family in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string FontFamily
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.FontFamily;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.FontFamily = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text color in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Color TextColor
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.TextColor?.All;
+ }
+ set
+ {
+ CreateTextAttributes();
+ if (null == toastAttributes.TextAttributes.TextColor)
+ {
+ toastAttributes.TextAttributes.TextColor = new ColorSelector();
+ }
+ toastAttributes.TextAttributes.TextColor.All = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text horizontal alignment in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignment TextAlignment
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.HorizontalAlignment = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets background image resource of toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string BackgroundImageURL
+ {
+ get
+ {
+ return toastAttributes.BackgroundImageAttributes?.ResourceUrl?.All;
+ }
+ set
+ {
+ if (null != value)
+ {
+ CreateBackgroundAttributes();
+ if (null == toastAttributes.BackgroundImageAttributes?.ResourceUrl)
+ {
+ toastAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+
+ toastAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
+ SetToastBackground();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets background image's border of toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Rectangle BackgroundImageBorder
+ {
+ get
+ {
+ return toastAttributes.BackgroundImageAttributes?.Border?.All;
+ }
+ set
+ {
+ if (null != value)
+ {
+ CreateBackgroundAttributes();
+ if (null == toastAttributes.BackgroundImageAttributes.Border)
+ {
+ toastAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ toastAttributes.BackgroundImageAttributes.Border.All = value;
+ SetToastBackground();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text left padding in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingLeft
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.PaddingLeft ?? textPaddingLeft;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.PaddingLeft = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text right padding in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingRight
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.PaddingRight ?? textPaddingRight;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.PaddingRight = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text top padding in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingTop
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.PaddingTop ?? textPaddingTop;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.PaddingTop = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text bottom padding in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 int TextPaddingBottom
+ {
+ get
+ {
+ return toastAttributes.TextAttributes?.PaddingBottom ?? textPaddingBottom;
+ }
+ set
+ {
+ CreateTextAttributes();
+ toastAttributes.TextAttributes.PaddingBottom = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text line height in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint TextLineHeight
+ {
+ get
+ {
+ return toastAttributes.TextLineHeight ?? textLineHeight;
+ }
+ set
+ {
+ toastAttributes.TextLineHeight = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets text line space in toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint TextLineSpace
+ {
+ get
+ {
+ return toastAttributes.TextLineSpace ?? textLineSpace;
+ }
+ set
+ {
+ toastAttributes.TextLineSpace = value;
+ RelayoutRequest();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets duration of toast.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 uint Duration
+ {
+ get
+ {
+ return toastAttributes.Duration ?? duration;
+ }
+ set
+ {
+ toastAttributes.Duration = value;
+ timer.Interval = value;
+ }
+ }
+
+ /// <summary>
+ /// Dispose ToastPopup.
+ /// </summary>
+ /// <param name="type">dispose types.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ this.VisibilityChanged -= OnVisibilityChanged;
+ if (null != timer)
+ {
+ timer.Tick -= OnTick;
+ timer.Dispose();
+ timer = null;
+ }
+ if (null != textLabels)
+ {
+ for (int i=0; i<textLabels.Length; i++)
+ {
+ Utility.Dispose(textLabels[i]);
+ }
+ }
+ }
+
+ base.Dispose(type);
+ }
+
+ /// <summary>
+ /// Relayout control's elements
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override void OnUpdate()
+ {
+ if (null == toastAttributes)
+ {
+ return;
+ }
+ if (null != toastAttributes.TextAttributes)
+ {
+ for (int i = 0; i < textLabels.Length; i++)
+ {
+ ApplyAttributes(textLabels[i], toastAttributes.TextAttributes);
+ }
+ }
+ LayoutChild();
+ }
+
+ /// <summary>
+ /// LayoutChild include textLabel.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 virtual void LayoutChild()
+ {
+ int _textPaddingLeft = toastAttributes.TextAttributes?.PaddingLeft ?? textPaddingLeft;
+ int _textPaddingRight = toastAttributes.TextAttributes?.PaddingRight ?? _textPaddingLeft;
+ int _textPaddingTop = toastAttributes.TextAttributes?.PaddingTop ?? textPaddingTop;
+ int _textPaddingBottom = toastAttributes.TextAttributes?.PaddingBottom ?? _textPaddingTop;
+
+ int _textAreaWidth = this.Size2D.Width - _textPaddingLeft - _textPaddingRight;
+ int _textAreaHeight = this.Size2D.Height - _textPaddingTop - _textPaddingBottom;
+ int _textLineSpace = (int)(toastAttributes.TextLineSpace ?? textLineSpace);
+ int _textLineHeight = (int)(toastAttributes.TextLineHeight ?? textLineHeight);
+ int _positionY = 0;
+
+ _textAreaWidth = _textAreaWidth > maxTextAreaWidth ? maxTextAreaWidth : _textAreaWidth;
+ if (LayoutDirection == ViewLayoutDirectionType.LTR)
+ {
+ for (int i = 0; i < textLabels?.Length; i++)
+ {
+ textLabels[i].Position2D = new Position2D(_textPaddingLeft, _textPaddingTop + _positionY);
+ textLabels[i].Size2D = new Size2D(_textAreaWidth, _textLineHeight);
+ _positionY += _textLineHeight + _textLineSpace;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < textLabels?.Length; i++)
+ {
+ textLabels[i].ParentOrigin = Tizen.NUI.ParentOrigin.TopRight;
+ textLabels[i].PivotPoint = Tizen.NUI.PivotPoint.TopRight;
+ textLabels[i].PositionUsesPivotPoint = true;
+ textLabels[i].Position2D = new Position2D(-_textPaddingLeft, _textPaddingTop + _positionY);
+ textLabels[i].Size2D = new Size2D(_textAreaWidth, _textLineHeight);
+ _positionY += _textLineHeight + _textLineSpace;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Get Toast attribues.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 override Attributes GetAttributes()
+ {
+ return new ToastAttributes();
+ }
+
+ private void Initialize()
+ {
+ toastAttributes = attributes as ToastAttributes;
+ if (null == toastAttributes)
+ {
+ throw new Exception("Toast attribute parse error.");
+ }
+ ApplyAttributes(this, toastAttributes);
+
+ toastBackground = new NPatchVisual();
+ SetToastBackground();
+
+ this.VisibilityChanged += OnVisibilityChanged;
+ timer = new Timer(toastAttributes.Duration ?? duration);
+ timer.Tick += OnTick;
+ timer.Start();
+ }
+
+ private bool OnTick(object sender, EventArgs e)
+ {
+ Hide();
+ return false;
+ }
+
+ private void OnVisibilityChanged(object sender, VisibilityChangedEventArgs e)
+ {
+ if (true == e.Visibility)
+ {
+ timer.Start();
+ }
+ }
+
+ private void SetToastText()
+ {
+ for (int i = 0; i < textLabels?.Length; i++)
+ {
+ if (null != textLabels[i])
+ {
+ this.Remove(textLabels[i]);
+ textLabels[i].Dispose();
+ textLabels[i] = null;
+ }
+ }
+
+ textLabels = new TextLabel[textArray.Length];
+ for (int i = 0; i < textArray.Length; i++)
+ {
+ textLabels[i] = new TextLabel();
+ textLabels[i].Text = textArray[i];
+ textLabels[i].BackgroundColor = Color.Blue;
+ this.Add(textLabels[i]);
+ }
+ }
+
+ private void SetToastBackground()
+ {
+ if (null != toastAttributes?.BackgroundImageAttributes?.ResourceUrl)
+ {
+ toastBackground.URL = toastAttributes.BackgroundImageAttributes.ResourceUrl.All;
+ }
+ if (null != toastAttributes?.BackgroundImageAttributes?.Border)
+ {
+ toastBackground.Border = toastAttributes.BackgroundImageAttributes.Border.All;
+ }
+ this.Background = toastBackground.OutputVisualMap;
+ }
+
+ private void CreateBackgroundAttributes()
+ {
+ if (null == toastAttributes.BackgroundImageAttributes)
+ {
+ toastAttributes.BackgroundImageAttributes = new ImageAttributes();
+ }
+ }
+
+ private void CreateTextAttributes()
+ {
+ if (null == toastAttributes.TextAttributes)
+ {
+ toastAttributes.TextAttributes = new TextAttributes();
+ }
+ }
+ }
+}
--- /dev/null
+using System.Runtime.CompilerServices;
+
+[assembly: InternalsVisibleTo("Tizen.FH.NUI, PublicKey=0024000004800000940000000602000000240000525341310004000001000100edd17ed375b5865e35ee337fe9e90ef0fb0c258c091874889540bb4eaeedc992755ec0e0a6deadfbfbb685bddfc99a850418e94b6a9e831fb47bcc52be1a5110dbc141943b51ebefe6daf4e415dc430c6b3f10175188db4b3dc0073d662318fe8463dfdb22aaa3e8e9aa97313fb4b3b157cf32c9b6b340dab9812fe97fd2d6c4")]
+
+namespace Tizen.NUI.CommonUI
+{
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <TizenCreateTpkOnBuild>false</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
+ <ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
+ </ItemGroup>
+
+
+ <!-- Include Nuget Package for Tizen Project building -->
+
+</Project>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Enumeration for describing the states of the view.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 enum ControlStates
+ {
+ /// <summary>
+ /// The normal state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Normal,
+ /// <summary>
+ /// The focused state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Focused,
+ /// <summary>
+ /// The disabled state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Disabled,
+ /// <summary>
+ /// The Selected state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Selected,
+ /// <summary>
+ /// The Pressed state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Pressed,
+ /// <summary>
+ /// The DisabledFocused state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ DisabledFocused,
+ /// <summary>
+ /// The SelectedFocused state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ SelectedFocused,
+ /// <summary>
+ /// The DisabledSelected state.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ DisabledSelected,
+ /// <summary>
+ /// Max all.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ Max
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// Selector class, which is related by Control State, it is base class for other Selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Selector<T>
+ {
+
+ /// <summary>
+ /// All State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T All
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Normal State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Normal
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Pressed State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Pressed
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Focused State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Focused
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Selected State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Selected
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Disabled State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Disabled
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// DisabledFocused State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T DisabledFocused
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// SelectedFocused State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ public T SelectedFocused
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// DisabledSelected State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T DisabledSelected
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Other State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T Other
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Get value by State.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 T GetValue(ControlStates state)
+ {
+ if(All != null)
+ {
+ return All;
+ }
+ switch(state)
+ {
+ case ControlStates.Normal:
+ return Normal != null? Normal : Other;
+ case ControlStates.Focused:
+ return Focused != null? Focused : Other;
+ case ControlStates.Pressed:
+ return Pressed != null? Pressed : Other;
+ case ControlStates.Disabled:
+ return Disabled != null? Disabled : Other;
+ case ControlStates.Selected:
+ return Selected != null? Selected : Other;
+ case ControlStates.DisabledFocused:
+ return DisabledFocused != null? DisabledFocused : Other;
+ case ControlStates.DisabledSelected:
+ return DisabledSelected != null? DisabledSelected : Other;
+ default:
+ return Other;
+ }
+ }
+ /// <summary>
+ /// Clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Clone(Selector<T> selector)
+ {
+ All = selector.All;
+ Normal = selector.Normal;
+ Focused = selector.Focused;
+ Pressed = selector.Pressed;
+ Disabled = selector.Disabled;
+ Selected = selector.Selected;
+ DisabledSelected = selector.DisabledSelected;
+ DisabledFocused = selector.DisabledFocused;
+ Other = selector.Other;
+ }
+
+ }
+
+ /// <summary>
+ /// Int selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class IntSelector : Selector<int?>
+ {
+ /// <summary>
+ /// Int selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 IntSelector Clone()
+ {
+ IntSelector selector = new IntSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Float selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class FloatSelector : Selector<float?>
+ {
+ /// <summary>
+ /// Float selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 FloatSelector Clone()
+ {
+ FloatSelector selector = new FloatSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+ /// <summary>
+ /// Bool selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class BoolSelector : Selector<bool?>
+ {
+ /// <summary>
+ /// Bool selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 BoolSelector Clone()
+ {
+ BoolSelector selector = new BoolSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+ /// <summary>
+ /// String selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class StringSelector : Selector<string>
+ {
+ /// <summary>
+ /// String selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StringSelector Clone()
+ {
+ StringSelector selector = new StringSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Color selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ColorSelector : Selector<Color>
+ {
+ /// <summary>
+ /// Color selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ColorSelector Clone()
+ {
+ ColorSelector selector = new ColorSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Size2D selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class Size2DSelector : Selector<Size2D>
+ {
+ /// <summary>
+ /// Size2D selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Size2DSelector Clone()
+ {
+ Size2DSelector selector = new Size2DSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+ /// <summary>
+ /// Position2D selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class Position2DSelector : Selector<Position2D>
+ {
+ /// <summary>
+ /// Position2D selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Position2DSelector Clone()
+ {
+ Position2DSelector selector = new Position2DSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Position selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class PositionSelector : Selector<Position>
+ {
+ /// <summary>
+ /// Position selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 PositionSelector Clone()
+ {
+ PositionSelector selector = new PositionSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Vector2 selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class Vector2Selector : Selector<Vector2>
+ {
+ /// <summary>
+ /// Vector selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector2Selector Clone()
+ {
+ Vector2Selector selector = new Vector2Selector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Vector3 selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class Vector3Selector : Selector<Vector3>
+ {
+ /// <summary>
+ /// Vector3 selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Vector3Selector Clone()
+ {
+ Vector3Selector selector = new Vector3Selector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Rectangle selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class RectangleSelector : Selector<Rectangle>
+ {
+ /// <summary>
+ /// Rectangle selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RectangleSelector Clone()
+ {
+ RectangleSelector selector = new RectangleSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// Horizontal alignment selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class HorizontalAlignmentSelector : Selector<HorizontalAlignment?>
+ {
+ /// <summary>
+ /// Horizontal alignment selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 HorizontalAlignmentSelector Clone()
+ {
+ HorizontalAlignmentSelector selector = new HorizontalAlignmentSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+ /// <summary>
+ /// Vertical alignment selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class VerticalAlignmentSelector : Selector<VerticalAlignment?>
+ {
+ /// <summary>
+ /// Vertical alignment selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 VerticalAlignmentSelector Clone()
+ {
+ VerticalAlignmentSelector selector = new VerticalAlignmentSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// AutoScrollStopMode selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class AutoScrollStopModeSelector : Selector<AutoScrollStopMode?>
+ {
+ /// <summary>
+ /// AutoScrollStopMode selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 AutoScrollStopModeSelector Clone()
+ {
+ AutoScrollStopModeSelector selector = new AutoScrollStopModeSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+ /// <summary>
+ /// ResizePolicyType selector.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ internal class ResizePolicyTypeSelector : Selector<ResizePolicyType?>
+ {
+ /// <summary>
+ /// ResizePolicyType selector clone function.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 ResizePolicyTypeSelector Clone()
+ {
+ ResizePolicyTypeSelector selector = new ResizePolicyTypeSelector();
+ selector.Clone(this);
+ return selector;
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// StyleBase class.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class StyleBase
+ {
+ /// <summary>
+ /// StyleBase construct.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 StyleBase()
+ {
+ }
+ /// <summary>
+ /// Content object.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 object Content
+ {
+ get;
+ set;
+ }
+ /// <summary>
+ /// Get attributes.
+ /// </summary>
+ /// <returns>Attributes</returns>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 internal virtual Attributes GetAttributes()
+ {
+ return Content as Attributes;
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.CommonUI
+{
+ /// <summary>
+ /// StyleManager is a class to manager all style.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 sealed class StyleManager
+ {
+ private string theme = "default";
+ private Dictionary<string, Dictionary<string, Type>> themeStyleSet = new Dictionary<string, Dictionary<string, Type>>();
+ private Dictionary<string, Type> defaultStyleSet = new Dictionary<string, Type>();
+ private EventHandler<ThemeChangeEventArgs> themeChangeHander;
+
+ /// <summary>
+ /// StyleManager construct.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ private StyleManager()
+ {
+ }
+ /// <summary>
+ /// An event for the theme changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 event EventHandler<ThemeChangeEventArgs> ThemeChangedEvent
+ {
+ add
+ {
+ themeChangeHander += value;
+ }
+ remove
+ {
+ themeChangeHander -= value;
+ }
+ }
+
+ /// <summary>
+ /// StyleManager static instance.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 static StyleManager Instance { get; } = new StyleManager();
+
+ /// <summary>
+ /// Style theme.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 string Theme
+ {
+ get
+ {
+ return theme;
+ }
+
+ set
+ {
+ if(theme != value)
+ {
+ theme = value;
+ themeChangeHander?.Invoke(null, new ThemeChangeEventArgs { CurrentTheme = theme });
+ }
+ }
+ }
+
+ /// <summary>
+ /// Register style in StyleManager.
+ /// </summary>
+ /// <param name="style">Style name.</param>
+ /// <param name="theme">Theme.</param>
+ /// <param name="styleType">Style type.</param>
+ /// <param name="bDefault">Flag to decide if it is default style.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 RegisterStyle(string style, string theme, Type styleType, bool bDefault = false)
+ {
+ if(style == null)
+ {
+ throw new InvalidOperationException($"style can't be null");
+ }
+
+ if(theme == null || bDefault == true)
+ {
+ if(defaultStyleSet.ContainsKey(style))
+ {
+ throw new InvalidOperationException($"{style}] already be used");
+ }
+ else
+ {
+ defaultStyleSet.Add(style, styleType);
+ }
+ return;
+ }
+
+ if(themeStyleSet.ContainsKey(style) && themeStyleSet[style].ContainsKey(theme))
+ {
+ throw new InvalidOperationException($"{style}] already be used");
+ }
+ if(!themeStyleSet.ContainsKey(style))
+ {
+ themeStyleSet.Add(style, new Dictionary<string, Type>());
+ }
+ themeStyleSet[style].Add(theme, styleType);
+ }
+
+ /// <summary>
+ /// Get attributes by style.
+ /// </summary>
+ /// <param name="style">Style name.</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 Attributes GetAttributes(string style)
+ {
+ if(style == null)
+ {
+ return null;
+ }
+ object obj = null;
+
+ if(themeStyleSet.ContainsKey(style) && themeStyleSet[style].ContainsKey(Theme))
+ {
+ obj = Activator.CreateInstance(themeStyleSet[style][Theme]);
+ }
+ else if(defaultStyleSet.ContainsKey(style))
+ {
+ obj = Activator.CreateInstance(defaultStyleSet[style]);
+ }
+
+ return (obj as StyleBase)?.GetAttributes();
+ }
+
+ /// <summary>
+ /// ThemeChangeEventArgs is a class to record theme change event arguments which will sent to user.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ /// 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 class ThemeChangeEventArgs : EventArgs
+ {
+ public string CurrentTheme;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2019 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;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.CommonUI
+{
+ internal class Utility
+ {
+ public static void Dispose(View child)
+ {
+ View parent = child?.GetParent() as View;
+ if(child != null)
+ {
+ if(parent != null)
+ {
+ parent.Remove(child);
+
+ }
+
+ child.Dispose();
+ child = null;
+ }
+ }
+ }
+}