Пример #1
0
        private void SwigDirectorMeasureChildWithMargins(global::System.IntPtr child, global::System.IntPtr parentWidthMeasureSpec, global::System.IntPtr widthUsed, global::System.IntPtr parentHeightMeasureSpec, global::System.IntPtr heightUsed)
        {
            HandleRef CPtrHandleRef = new global::System.Runtime.InteropServices.HandleRef(this, child);

            global::System.IntPtr refObjectPtr = LayoutPINVOKE.LayoutItemPtr_Get(CPtrHandleRef);
            LayoutItem layoutItem = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as LayoutItem;

            MeasureChildWithMargins(layoutItem, new LayoutMeasureSpec(parentWidthMeasureSpec, true), new LayoutLength(widthUsed, true), new LayoutMeasureSpec(parentHeightMeasureSpec, true), new LayoutLength(heightUsed, true));

            LayoutPINVOKE.delete_LayoutItemPtr(CPtrHandleRef);
            CPtrHandleRef = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
        }
Пример #2
0
        public LayoutItem GetChild(uint childId)
        {
            IntPtr cPtr = LayoutPINVOKE.LayoutGroupWrapperImpl_GetChild(swigCPtr, childId);
            HandleRef CPtrHandleRef = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);

            global::System.IntPtr refObjectPtr = LayoutPINVOKE.LayoutItemPtr_Get(CPtrHandleRef);
            LayoutItem ret = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as LayoutItem;

            LayoutPINVOKE.delete_LayoutItemPtr(CPtrHandleRef);
            CPtrHandleRef = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);

            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            return ret;
        }
Пример #3
0
        private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
        {
            if (detectedEventHandler != null)
            {
                DetectedEventArgs e = new DetectedEventArgs();

                // Populate all members of "e" (PanGestureEventArgs) with real data
                e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
                if (null == e.View)
                {
                    e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
                }

                e.PanGesture = Tizen.NUI.PanGesture.GetPanGestureFromPtr(panGesture);
                detectedEventHandler(this, e);
            }
        }
Пример #4
0
        private void OnRotationGestureDetected(IntPtr actor, IntPtr rotationGesture)
        {
            if (detectedEventHandler != null)
            {
                DetectedEventArgs e = new DetectedEventArgs();

                // Populate all members of "e" (DetectedEventArgs) with real data.
                e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;
                if (null == e.View)
                {
                    e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
                }

                e.RotationGesture = Tizen.NUI.RotationGesture.GetRotationGestureFromPtr(rotationGesture);
                //Here we send all data to user event handlers.
                detectedEventHandler(this, e);
            }
        }
Пример #5
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);

                return((IntPtr)PropertyValue.getCPtr(value));
            }
            else
            {
                return(IntPtr.Zero);
            }
        }
Пример #6
0
        private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
        {
            DetectedEventArgs e = new DetectedEventArgs();

            // Populate all members of "e" (DetectedEventArgs) with real data
            e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View;

            if (null == e.View)
            {
                e.View = Registry.GetManagedBaseHandleFromRefObject(actor) as View;
            }

            e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture);

            if (_tapGestureEventHandler != null)
            {
                //here we send all data to user event handlers
                _tapGestureEventHandler(this, e);
            }
        }
Пример #7
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);
            }
        }