Ejemplo n.º 1
0
 internal PropertyArray(PropertyArray other) : this(Interop.Property.NewPropertyArray(PropertyArray.getCPtr(other)), true)
 {
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create an instance of TransitionData.
 /// </summary>
 /// <param name="transition">The transition data to store (an array of maps of animators).</param>
 /// <since_tizen> 3 </since_tizen>
 public TransitionData(PropertyArray transition) : this(Interop.TransitionData.NewByArray(PropertyArray.getCPtr(transition)), true)
 {
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates an array property value.
 /// </summary>
 /// <param name="arrayValue">An array.</param>
 /// <since_tizen> 3 </since_tizen>
 public PropertyValue(PropertyArray arrayValue) : this(Interop.PropertyValue.NewPropertyValueArray(PropertyArray.getCPtr(arrayValue)), true)
 {
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Compose the out visual map.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 protected override void ComposingPropertyMap()
 {
     if (_urls != null)
     {
         _outputVisualMap = new PropertyMap();
         _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage));
         if (_urls.Count == 1)
         {
             _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0]));
         }
         else
         {
             var urlArray = new PropertyArray();
             foreach (var url in _urls)
             {
                 urlArray.Add(new PropertyValue(url));
             }
             _outputVisualMap.Add(ImageVisualProperty.URL, (new PropertyValue(urlArray)));
         }
         if (_batchSize != null)
         {
             _outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize));
         }
         if (_cacheSize != null)
         {
             _outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize));
         }
         if (_frameDelay != null)
         {
             _outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay));
         }
         if (_loopCount != null)
         {
             _outputVisualMap.Add((int)ImageVisualProperty.LoopCount, new PropertyValue((int)_loopCount));
         }
         if (_shader != null)
         {
             _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader));
         }
         if (_premultipliedAlpha != null)
         {
             _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha));
         }
         if (_mixColor != null)
         {
             _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor));
         }
         if (_opacity != null)
         {
             _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity));
         }
         if (_visualFittingMode != null)
         {
             _outputVisualMap.Add((int)Visual.Property.VisualFittingMode, new PropertyValue((int)_visualFittingMode));
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieves an array property value.
        /// </summary>
        /// <param name="arrayValue">On return, the array as a vector property values.</param>
        /// <returns>Returns true if the value is successfully retrieved, false if the type is not convertible.</returns>
        /// <since_tizen> 3 </since_tizen>
        public bool Get(PropertyArray arrayValue)
        {
            bool ret = Interop.PropertyValue.GetArray(swigCPtr, PropertyArray.getCPtr(arrayValue));

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds an element to the array.
        /// </summary>
        /// <param name="value">The value to add at the end of the array.</param>
        /// <since_tizen> 3 </since_tizen>
        public PropertyArray Add(PropertyValue value)
        {
            PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(swigCPtr, PropertyValue.getCPtr(value)), false);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Compose the out visual map.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 protected override void ComposingPropertyMap()
 {
     if (_urls != null)
     {
         _outputVisualMap = new PropertyMap();
         PropertyValue temp = new PropertyValue((int)Visual.Type.AnimatedImage);
         _outputVisualMap.Add(Visual.Property.Type, temp);
         temp.Dispose();
         if (_urls.Count == 1)
         {
             temp = new PropertyValue(_urls[0]);
             _outputVisualMap.Add(ImageVisualProperty.URL, temp);
             temp.Dispose();
         }
         else
         {
             var urlArray = new PropertyArray();
             foreach (var url in _urls)
             {
                 urlArray.Add(new PropertyValue(url));
             }
             temp = new PropertyValue(urlArray);
             _outputVisualMap.Add(ImageVisualProperty.URL, temp);
             temp.Dispose();
             urlArray.Dispose();
         }
         if (_batchSize != null)
         {
             temp = new PropertyValue((int)_batchSize);
             _outputVisualMap.Add(ImageVisualProperty.BatchSize, temp);
             temp.Dispose();
         }
         if (_cacheSize != null)
         {
             temp = new PropertyValue((int)_cacheSize);
             _outputVisualMap.Add(ImageVisualProperty.CacheSize, temp);
             temp.Dispose();
         }
         if (_frameDelay != null)
         {
             temp = new PropertyValue((float)_frameDelay);
             _outputVisualMap.Add(ImageVisualProperty.FrameDelay, temp);
             temp.Dispose();
         }
         if (_loopCount != null)
         {
             temp = new PropertyValue((int)_loopCount);
             _outputVisualMap.Add(ImageVisualProperty.LoopCount, temp);
             temp.Dispose();
         }
         base.ComposingPropertyMap();
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Adds an keyvalue to the array.
        /// This function should be first
        /// </summary>
        /// <param name="value">The value to add at the end of the array.</param>
        /// <exception cref="global::System.ArgumentNullException"> Thrown when value is null. </exception>
        public PropertyArray Add(KeyValue value)
        {
            if (null == value)
            {
                throw new global::System.ArgumentNullException(nameof(value));
            }
            PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(swigCPtr, PropertyValue.getCPtr(value.TrueValue)), false);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 9
0
        public void SetAvailableOrientations(List <GLWindow.GLWindowOrientation> orientations)
        {
            PropertyArray orientationArray = new PropertyArray();

            for (int i = 0; i < orientations.Count; i++)
            {
                orientationArray.PushBack(new PropertyValue((int)orientations[i]));
            }

            Interop.GLWindow.GlWindow_SetAvailableOrientations(swigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
        }
Ejemplo n.º 10
0
        public void SetAvailableOrientations(List <GLWindow.GLWindowOrientation> orientations)
        {
            if (null == orientations)
            {
                throw new ArgumentNullException(nameof(orientations));
            }

            PropertyArray orientationArray = new PropertyArray();

            for (int i = 0; i < orientations.Count; i++)
            {
                PropertyValue val = new PropertyValue((int)orientations[i]);
                orientationArray.PushBack(val);
                val.Dispose();
            }

            Interop.GLWindow.GlWindowSetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
            orientationArray.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
        }
Ejemplo n.º 11
0
        public int SetText(TextLabel label, string str)
        {
            if (label == null || str == null)
            {
                return(0);
            }

            // perform this operation to match the utf32 character used in native Dali.
            bool previousMarkup = label.EnableMarkup;

            label.EnableMarkup = false;
            label.Text         = str;
            pageString         = label.Text;
            label.EnableMarkup = previousMarkup;
            label.MultiLine    = true;
            label.Ellipsis     = false;

            int length       = pageString.Length;
            int remainLength = length;
            int offset       = 0;
            int cutOffIndex  = 0;

            // init
            totalPageCnt  = 0;
            pageList      = new List <PageData>();
            tagList       = new List <TagData>();
            characterList = new List <char>();

            stream = new StringReader(pageString);

            RendererParameters textParameters = new RendererParameters();

            textParameters.Text = pageString;
            textParameters.HorizontalAlignment = label.HorizontalAlignment;
            textParameters.VerticalAlignment   = label.VerticalAlignment;
            textParameters.FontFamily          = label.FontFamily;
            textParameters.FontWeight          = "";
            textParameters.FontWidth           = "";
            textParameters.FontSlant           = "";
            textParameters.Layout          = TextLayout.MultiLine;
            textParameters.TextColor       = Color.Black;
            textParameters.FontSize        = label.PointSize;
            textParameters.TextWidth       = (uint)label.Size.Width;
            textParameters.TextHeight      = (uint)label.Size.Height;
            textParameters.EllipsisEnabled = true;
            textParameters.MarkupEnabled   = previousMarkup;
            textParameters.MinLineSize     = label.MinLineSize;
            textParameters.Padding         = label.Padding;


            Tizen.NUI.PropertyArray cutOffIndexArray = TextUtils.GetLastCharacterIndex(textParameters);
            uint count = cutOffIndexArray.Count();

            for (uint i = 0; i < count; i++)
            {
                var temp = cutOffIndexArray.GetElementAt(i);
                temp.Get(out cutOffIndex); // Gets the last index of text shown on the actual screen.
                temp.Dispose();

                // If markup is enabled, It should parse markup
                if (label.EnableMarkup)
                {
                    int preOffset = offset;
                    offset        = MarkupProcess(offset, cutOffIndex - preOffset);
                    remainLength -= (offset - preOffset);
                }
                //If markup is not enabled, parsing is not required.
                else
                {
                    PageData pageData = new PageData();
                    pageData.StartOffset = offset;
                    int cnt = (cutOffIndex - offset) < remainLength ? (cutOffIndex - offset) : remainLength;
                    remainLength      -= cnt;
                    offset            += cnt;
                    pageData.EndOffset = offset;
                    pageList.Add(pageData);
                }
                totalPageCnt++;
                if (offset <= 0 || remainLength <= 0)
                {
                    break;
                }
            }

            textParameters.Dispose();
            cutOffIndexArray.Dispose();
            stream = null;
            return(totalPageCnt);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Sets a property value on a view.
        /// </summary>
        private void SetPropertyValue(IntPtr refObjectPtr, string propertyName, IntPtr propertyValuePtr)
        {
            // Get the C# control that maps to the C++ control
            NUILog.Debug("SetPropertyValue   refObjectPtr = {0:X}" + refObjectPtr);

            PropertyValue propValue = new PropertyValue(propertyValuePtr, false);

            // Get the C# control that maps to the C++ control
            View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View;

            if (view != null)
            {
                System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName);
                // We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type
                System.Type type = propertyInfo.PropertyType;
                bool        ok   = false;

                if (type.Equals(typeof(Int32)))
                {
                    int value = 0;
                    ok = propValue.Get(out value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(bool)))
                {
                    bool value = false;
                    ok = propValue.Get(out value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(float)))
                {
                    float value = 0;
                    ok = propValue.Get(out value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(string)))
                {
                    string value = "";
                    ok = propValue.Get(out value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(Vector2)))
                {
                    Vector2 value = new Vector2();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(Vector3)))
                {
                    Vector3 value = new Vector3();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(Vector4)))
                {
                    Vector4 value = new Vector4();
                    ok = propValue.Get(value);

                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(Position)))
                {
                    Position value = new Position();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                }
                else if (type.Equals(typeof(Size)))
                {
                    Size value = new Size();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, new Size(value.Width, value.Height, value.Depth));
                    }
                    ;
                }
                else if (type.Equals(typeof(Color)))
                {
                    // Colors are stored as Vector4's in DALi
                    Color value = new Color();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, (Color)value);
                    }
                    ;
                }
                else if (type.Equals(typeof(PropertyMap)))
                {
                    PropertyMap map = new PropertyMap();
                    ok = propValue.Get(map);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, map);
                    }
                }
                else if (type.Equals(typeof(PropertyArray)))
                {
                    PropertyArray array = new PropertyArray();
                    ok = propValue.Get(array);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, array);
                    }
                }
                else
                {
                    throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName);
                }
                if (!ok)
                {
                    throw new global::System.InvalidOperationException("SetPropertyValue propValue.Get failed");
                }
            }
            else
            {
                throw new global::System.InvalidOperationException("failed to find the control to write a property to: cptr = " + refObjectPtr);
            }
        }
Ejemplo n.º 13
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyArray obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }