Ejemplo n.º 1
0
        private void SetTransformMap(PropertyMap transformMap)
        {
            if (transformMap == null)
            {
                return;
            }

            PropertyValue temp = transformMap.Find((int)VisualTransformPropertyType.Offset);

            temp?.Get(Offset);
            temp?.Dispose();
            temp = transformMap.Find((int)VisualTransformPropertyType.ExtraSize);
            temp?.Get(Extents);
            temp?.Dispose();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a Shadow from a property map.
        /// </summary>
        internal Shadow(PropertyMap propertyMap) : base(propertyMap)
        {
            Color = noColor;
            PropertyValue pValue = propertyMap.Find(ColorVisualProperty.MixColor);

            pValue?.Get(Color);
            pValue?.Dispose();

            float blurRadius = 0;

            pValue = propertyMap.Find(ColorVisualProperty.BlurRadius);
            pValue?.Get(out blurRadius);
            pValue?.Dispose();
            BlurRadius = blurRadius;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a Shadow from a propertyMap.
        /// </summary>
        internal ImageShadow(PropertyMap propertyMap) : base(propertyMap)
        {
            Border = noBorder;
            PropertyValue pValue = propertyMap.Find(ImageVisualProperty.Border);

            pValue?.Get(Border);
            pValue?.Dispose();

            string url = null;

            pValue = propertyMap.Find(ImageVisualProperty.URL);
            pValue?.Get(out url);
            pValue?.Dispose();
            Url = url;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a key frame.
        /// </summary>
        /// <param name="progress">A progress value between 0.0 and 1.0.</param>
        /// <param name="value">A value</param>
        /// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
        /// <since_tizen> 3 </since_tizen>
        public void Add(float progress, object value, AlphaFunction alpha)
        {
            PropertyValue val = PropertyValue.CreateFromObject(value);

            Add(progress, val, alpha);
            val.Dispose();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a key frame.
        /// </summary>
        /// <param name="progress">A progress value between 0.0 and 1.0.</param>
        /// <param name="value">A value.</param>
        /// <since_tizen> 3 </since_tizen>
        public void Add(float progress, object value)
        {
            PropertyValue val = PropertyValue.CreateFromObject(value);

            Add(progress, val);
            val.Dispose();
        }
Ejemplo n.º 6
0
        private void DirectorOnPropertySet(int index, global::System.IntPtr propertyValue)
        {
            var value = new PropertyValue(propertyValue, true);

            OnPropertySet?.Invoke(index, value);
            value.Dispose();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Overrides the method of OnInitialize() for the CustomView class.<br />
        /// This method is called after the control has been initialized.<br />
        /// Derived classes should do any second phase initialization by overriding this method.<br />
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        public override void OnInitialize()
        {
            // Initialize the propertiesControl
            arrowImage          = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png";
            textBackgroundColor = new Color(0.6f, 0.6f, 0.6f, 1.0f);
            currentValue        = 0;
            minValue            = 0;
            maxValue            = 0;
            singleStep          = 1;
            maxTextLength       = 0;

            // Create image visual for the arrow keys
            var temp = new PropertyValue(arrowImage);

            arrowVisualPropertyIndex = RegisterProperty("ArrowImage", temp, Tizen.NUI.PropertyAccessMode.ReadWrite);
            temp.Dispose();

            var ptMap = new PropertyMap();

            temp = new PropertyValue((int)Visual.Type.Image);
            ptMap.Add(Visual.Property.Type, temp);
            temp.Dispose();

            temp = new PropertyValue(arrowImage);
            ptMap.Add(ImageVisualProperty.URL, temp);
            temp.Dispose();

            temp = new PropertyValue(150);
            ptMap.Add(ImageVisualProperty.DesiredHeight, temp);
            temp.Dispose();

            temp = new PropertyValue(150);
            ptMap.Add(ImageVisualProperty.DesiredWidth, temp);
            temp.Dispose();

            arrowVisual = VisualFactory.Instance.CreateVisual(ptMap);
            ptMap.Dispose();
            RegisterVisual(arrowVisualPropertyIndex, arrowVisual);

            // Create a text field
            textField                     = new TextField();
            textField.PivotPoint          = Tizen.NUI.PivotPoint.Center;
            textField.WidthResizePolicy   = ResizePolicyType.SizeRelativeToParent;
            textField.HeightResizePolicy  = ResizePolicyType.SizeRelativeToParent;
            textField.SizeModeFactor      = new Vector3(1.0f, 0.45f, 1.0f);
            textField.PlaceholderText     = "----";
            textField.BackgroundColor     = textBackgroundColor;
            textField.HorizontalAlignment = HorizontalAlignment.Center;
            textField.VerticalAlignment   = VerticalAlignment.Center;
            textField.Focusable           = (true);
            textField.Name                = "_textField";
            textField.Position2D          = new Position2D(0, 40);

            this.Add(textField);

            textField.FocusGained += TextFieldKeyInputFocusGained;
            textField.FocusLost   += TextFieldKeyInputFocusLost;
        }
Ejemplo n.º 8
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            TrueValue?.Dispose();

            base.Dispose();
        }
Ejemplo n.º 9
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.º 10
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                TrueValue?.Dispose();
            }
            disposed = true;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Compose the out visual map.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        protected override void ComposingPropertyMap()
        {
            PropertyMap   animator = new PropertyMap();
            PropertyValue temp     = new PropertyValue(alphaFunction);

            animator.Add("alphaFunction", temp);
            temp.Dispose();

            PropertyMap timePeriod = new PropertyMap();

            temp = new PropertyValue((endTime - startTime) / 1000.0f);
            timePeriod.Add("duration", temp);
            temp.Dispose();

            temp = new PropertyValue(startTime / 1000.0f);
            timePeriod.Add("delay", temp);
            temp.Dispose();

            temp = new PropertyValue(timePeriod);
            animator.Add("timePeriod", temp);
            temp.Dispose();

            StringBuilder sb = new StringBuilder(propertyIndex);

            sb[0] = (char)(sb[0] | 0x20);
            string str = sb.ToString();

            PropertyValue val = PropertyValue.CreateFromObject(destinationValue);

            PropertyMap transition = new PropertyMap();

            temp = new PropertyValue(target);
            transition.Add("target", temp);
            temp.Dispose();

            temp = new PropertyValue(str);
            transition.Add("property", temp);
            temp.Dispose();

            transition.Add("targetValue", val);
            temp = new PropertyValue(animator);
            transition.Add("animator", temp);
            temp.Dispose();

            _outputVisualMap = transition;
            base.ComposingPropertyMap();

            animator.Dispose();
            timePeriod.Dispose();
            val.Dispose();
        }
Ejemplo n.º 12
0
        private PropertyMap ComposingInputMethodMap()
        {
            PropertyMap   outputMap = new PropertyMap();
            PropertyValue temp;

            if (panelLayout != null)
            {
                temp = new PropertyValue((int)panelLayout);
                outputMap.Add("PANEL_LAYOUT", temp);
                temp.Dispose();
            }
            if (actionButton != null)
            {
                // Temporarily specify the values to match the types of ecore_imf.
                if (actionButton == InputMethod.ActionButtonTitleType.Search)
                {
                    actionButton = (InputMethod.ActionButtonTitleType.Search - 1);                                                           // 6
                }
                else if (actionButton == InputMethod.ActionButtonTitleType.Send)
                {
                    actionButton = (InputMethod.ActionButtonTitleType.Send - 1);                                                              // 7
                }
                else if (actionButton == InputMethod.ActionButtonTitleType.SignIn)
                {
                    actionButton = (InputMethod.ActionButtonTitleType.SignIn - 1);                                                                // 8
                }
                else if (actionButton == InputMethod.ActionButtonTitleType.Unspecified || actionButton == InputMethod.ActionButtonTitleType.None)
                {
                    actionButton = InputMethod.ActionButtonTitleType.Default;
                }
                temp = new PropertyValue((int)actionButton);
                outputMap.Add("BUTTON_ACTION", temp);
                temp.Dispose();
            }
            if (autoCapital != null)
            {
                temp = new PropertyValue((int)autoCapital);
                outputMap.Add("AUTO_CAPITALIZE", temp);
                temp.Dispose();
            }
            if (variation != null)
            {
                temp = new PropertyValue((int)variation);
                outputMap.Add("VARIATION", temp);
                temp.Dispose();
            }
            return(outputMap);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Compose the out visual map.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        protected override void ComposingPropertyMap()
        {
            if (objectURL != null)
            {
                _outputVisualMap = new PropertyMap();
                PropertyValue temp = new PropertyValue((int)Visual.Type.Mesh);
                _outputVisualMap.Add(Visual.Property.Type, temp);
                temp.Dispose();

                temp = new PropertyValue(objectURL);
                _outputVisualMap.Add(MeshVisualProperty.ObjectURL, temp);
                temp.Dispose();

                if (materialURL != null)
                {
                    temp = new PropertyValue(materialURL);
                    _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, temp);
                    temp.Dispose();
                }
                if (texturesPath != null)
                {
                    temp = new PropertyValue(texturesPath);
                    _outputVisualMap.Add(MeshVisualProperty.TexturesPath, temp);
                    temp.Dispose();
                }
                if (shadingMode != null)
                {
                    temp = new PropertyValue((int)shadingMode);
                    _outputVisualMap.Add(MeshVisualProperty.ShadingMode, temp);
                    temp.Dispose();
                }
                if (useMipmapping != null)
                {
                    temp = new PropertyValue((bool)useMipmapping);
                    _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, temp);
                    temp.Dispose();
                }
                if (useSoftNormals != null)
                {
                    temp = new PropertyValue((bool)useSoftNormals);
                    _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, temp);
                    temp.Dispose();
                }
                base.ComposingPropertyMap();
            }
        }
Ejemplo n.º 14
0
        public void SetAvailableOrientations(List <GLWindow.GLWindowOrientation> 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.GlWindow_SetAvailableOrientations(swigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
            orientationArray.Dispose();
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Compose the out visual map.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        protected virtual void ComposingPropertyMap()
        {
            if (null == _outputVisualMap)
            {
                _outputVisualMap = new PropertyMap();
            }

            if (_shader != null)
            {
                PropertyValue temp = new PropertyValue(_shader);
                _outputVisualMap.Add(Visual.Property.Shader, temp);
                temp.Dispose();
            }
            if (_premultipliedAlpha != null)
            {
                PropertyValue temp = new PropertyValue((bool)_premultipliedAlpha);
                _outputVisualMap.Add(Visual.Property.PremultipliedAlpha, temp);
                temp.Dispose();
            }
            if (_mixColor != null)
            {
                PropertyValue temp = new PropertyValue(_mixColor);
                _outputVisualMap.Add(Visual.Property.MixColor, temp);
                temp.Dispose();
            }
            if (_opacity != null)
            {
                PropertyValue temp = new PropertyValue((float)_opacity);
                _outputVisualMap.Add(Visual.Property.Opacity, temp);
                temp.Dispose();
            }
            if (_visualFittingMode != null)
            {
                PropertyValue temp = new PropertyValue((int)_visualFittingMode);
                _outputVisualMap.Add(Visual.Property.VisualFittingMode, temp);
                temp.Dispose();
            }
            if (cornerRadius != null)
            {
                PropertyValue temp = new PropertyValue(cornerRadius);
                _outputVisualMap.Add(Visual.Property.CornerRadius, temp);
                temp.Dispose();
            }
        }
Ejemplo n.º 16
0
        private Geometry CreateQuadGeometry()
        {
            /* Create Property buffer */
            PropertyValue  value        = new PropertyValue((int)PropertyType.Vector2);
            PropertyMap    vertexFormat = new PropertyMap();
            PropertyBuffer vertexBuffer = new PropertyBuffer(vertexFormat);

            vertexFormat.Add("aPosition", value);
            vertexBuffer.SetData(RectangleDataPtr(), 4);

            Geometry geometry = new Geometry();

            geometry.AddVertexBuffer(vertexBuffer);
            geometry.SetType(Geometry.Type.TRIANGLE_STRIP);

            value.Dispose();
            vertexFormat.Dispose();
            vertexBuffer.Dispose();

            return(geometry);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Gets a property value from a view.
        /// </summary>
        private IntPtr GetPropertyValue(IntPtr refObjectPtr, string propertyName)
        {
            // Get the C# control that maps to the C++ control
            View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View;

            if (view != null)
            {
                // call the get property function
                System.Object val = view.GetType().GetProperty(propertyName).GetAccessors()[0].Invoke(view, null);

                PropertyValue value = PropertyValue.CreateFromObject(val);
                IntPtr        ptr   = (IntPtr)PropertyValue.getCPtr(value);
                value.Dispose();

                return(ptr);
            }
            else
            {
                return(IntPtr.Zero);
            }
        }
Ejemplo n.º 18
0
 private void ComposingTransformMap()
 {
     visualTransformMap = new PropertyMap();
     if (visualSize != null)
     {
         PropertyValue temp = new PropertyValue(visualSize);
         visualTransformMap.Add((int)VisualTransformPropertyType.Size, temp);
         temp.Dispose();
     }
     if (visualOffset != null)
     {
         PropertyValue temp = new PropertyValue(visualOffset);
         visualTransformMap.Add((int)VisualTransformPropertyType.Offset, temp);
         temp.Dispose();
     }
     if (visualOffsetPolicy != null)
     {
         PropertyValue temp = new PropertyValue(visualOffsetPolicy);
         visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, temp);
         temp.Dispose();
     }
     if (visualSizePolicy != null)
     {
         PropertyValue temp = new PropertyValue(visualSizePolicy);
         visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, temp);
         temp.Dispose();
     }
     if (visualOrigin != null)
     {
         PropertyValue temp = new PropertyValue((int)visualOrigin);
         visualTransformMap.Add((int)VisualTransformPropertyType.Origin, temp);
         temp.Dispose();
     }
     if (visualAnchorPoint != null)
     {
         PropertyValue temp = new PropertyValue((int)visualAnchorPoint);
         visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, temp);
         temp.Dispose();
     }
 }
Ejemplo n.º 19
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);
                    }
                    value.Dispose();
                }
                else if (type.Equals(typeof(Vector3)))
                {
                    Vector3 value = new Vector3();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                    value.Dispose();
                }
                else if (type.Equals(typeof(Vector4)))
                {
                    Vector4 value = new Vector4();
                    ok = propValue.Get(value);

                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                    value.Dispose();
                }
                else if (type.Equals(typeof(Position)))
                {
                    Position value = new Position();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, value);
                    }
                    value.Dispose();
                }
                else if (type.Equals(typeof(Size)))
                {
                    Size value = new Size();
                    ok = propValue.Get(value);
                    if (ok)
                    {
                        Size sz = new Size(value.Width, value.Height, value.Depth);
                        propertyInfo.SetValue(view, sz);
                        sz.Dispose();
                    }
                    ;
                    value.Dispose();
                }
                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);
                    }
                    ;
                    value.Dispose();
                }
                else if (type.Equals(typeof(PropertyMap)))
                {
                    PropertyMap map = new PropertyMap();
                    ok = propValue.Get(map);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, map);
                    }
                    map.Dispose();
                }
                else if (type.Equals(typeof(PropertyArray)))
                {
                    PropertyArray array = new PropertyArray();
                    ok = propValue.Get(array);
                    if (ok)
                    {
                        propertyInfo.SetValue(view, array);
                    }
                    array.Dispose();
                }
                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);
            }
            propValue.Dispose();
        }