示例#1
0
 /// <summary>
 ///Constructor, Native window handle is set to handle.
 /// </summary>
 /// <since_tizen> 4 </since_tizen>
 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
 {
     SetHandle(NUIApplication.GetDefaultWindow().GetNativeWindowHandler());
 }
示例#2
0
 public virtual float ConvertFromPixel(float value)
 {
     return(value * (defaultDpi / NUIApplication.GetDefaultWindow().Dpi.X));
 }
示例#3
0
        private bool SetFrame(float left, float top, float right, float bottom, bool independent)
        {
            bool changed = false;

            if (_layoutPositionData.Left != left ||
                _layoutPositionData.Right != right ||
                _layoutPositionData.Top != top ||
                _layoutPositionData.Bottom != bottom)
            {
                changed = true;

                float oldWidth    = _layoutPositionData.Right - _layoutPositionData.Left;
                float oldHeight   = _layoutPositionData.Bottom - _layoutPositionData.Top;
                float newWidth    = right - left;
                float newHeight   = bottom - top;
                bool  sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);

                // Set condition to layout changed as currently unspecified. Add, Remove would have specified a condition.
                if (ConditionForAnimation.Equals(TransitionCondition.Unspecified))
                {
                    ConditionForAnimation = TransitionCondition.LayoutChanged;
                }

                // Store new layout position data
                _layoutPositionData = new LayoutData(this, ConditionForAnimation, left, top, right, bottom);

                Debug.WriteLineIf(LayoutDebugFrameData, "LayoutItem FramePositionData View:" + _layoutPositionData.Item.Owner.Name +
                                  " left:" + _layoutPositionData.Left +
                                  " top:" + _layoutPositionData.Top +
                                  " right:" + _layoutPositionData.Right +
                                  " bottom:" + _layoutPositionData.Bottom);

                Container onwerContainer = Owner.GetParent();
                View      onwerView      = onwerContainer is Layer ? new View(Layer.getCPtr(onwerContainer).Handle, false) : onwerContainer as View;

                if (onwerView != null && onwerView.Layout != null && onwerView.Layout.LayoutWithTransition)
                {
                    NUIApplication.GetDefaultWindow().LayoutController.AddTransitionDataEntry(_layoutPositionData);
                }
                else
                {
                    if (independent)
                    {
                        // If height or width specification is not explicitly defined,
                        // the size of the owner view must be reset even the ExcludeLayouting is true.
                        if (Owner.HeightSpecification < 0 || Owner.WidthSpecification < 0)
                        {
                            Owner.SetSize(right - left, bottom - top);
                        }
                    }
                    else
                    {
                        Owner.SetSize(right - left, bottom - top);
                        Owner.SetPosition(left, top);
                    }
                }

                // Reset condition for animation ready for next transition when required.
                ConditionForAnimation = TransitionCondition.Unspecified;
            }

            return(changed);
        }
示例#4
0
 public virtual float ConvertToPixel(float value)
 {
     return(value * (NUIApplication.GetDefaultWindow().Dpi.X / defaultDpi));
 }