Пример #1
0
        private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
        {
            if (keyEvent == global::System.IntPtr.Zero)
            {
                NUILog.Error("keyEvent should not be null!");
                return(true);
            }

            KeyEventArgs e = new KeyEventArgs();

            bool result = false;

            e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);

            if (_keyEventHandler != null)
            {
                Delegate[] delegateList = _keyEventHandler.GetInvocationList();

                // Oring the result of each callback.
                foreach (EventHandlerWithReturnType <object, KeyEventArgs, bool> del in delegateList)
                {
                    result |= del(this, e);
                }
            }

            return(result);
        }
Пример #2
0
        internal System.IntPtr GetNativePlayerHandle()
        {
            var ret = Interop.VideoView.GetNativePlayerHandle(SwigCPtr);

            NUILog.Debug($"NativePlayerHandle=0x{ret:X}");
            return(ret);
        }
Пример #3
0
        // Callback for View TouchSignal
        private bool OnInterceptTouch(IntPtr view, IntPtr touchData)
        {
            if (touchData == global::System.IntPtr.Zero)
            {
                NUILog.Error("touchData should not be null!");
                return(true);
            }

            // DisallowInterceptTouchEvent prevents the parent from intercepting touch.
            if (DisallowInterceptTouchEvent)
            {
                return(false);
            }

            TouchEventArgs e = new TouchEventArgs();

            e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);

            bool consumed = false;

            if (_interceptTouchDataEventHandler != null)
            {
                consumed = _interceptTouchDataEventHandler(this, e);
            }

            return(consumed);
        }
Пример #4
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            NUILog.Debug($"Dispose(type={type})!");

            if (type == DisposeTypes.Explicit)
            {
                //Called by User
                //Release your own managed resources here.
                //You should release all of your own disposable objects here.
            }

            //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.

            //disconnect event signal!
            if (finishedEventHandler != null && visualEventSignalCallback != null)
            {
                VisualEventSignal().Disconnect(visualEventSignalCallback);
                finishedEventHandler = null;
                NUILog.Debug($"disconnect event signal!!!!");
            }

            base.Dispose(type);
        }
Пример #5
0
        /// <summary>
        /// Lowers the view to below the target view.
        /// </summary>
        /// <remarks>The sibling order of views within the parent will be updated automatically.
        /// Lowering this view below views with the same sibling order as each other will lower this view above them.
        /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
        /// </remarks>
        /// <param name="target">Will be lowered below this view.</param>
        internal void LowerBelow(View target)
        {
            var parentChildren = GetParent()?.Children;

            if (parentChildren != null)
            {
                int currentIndex = parentChildren.IndexOf(this);
                int targetIndex  = parentChildren.IndexOf(target);
                if (currentIndex < 0 || targetIndex < 0 ||
                    currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
                {
                    NUILog.Error("index should be bigger than 0 and less than children of layer count");
                    return;
                }

                // If the currentIndex is not already the 0th index and the target has the same parent.
                if ((currentIndex != 0) && (targetIndex != -1) &&
                    (currentIndex > targetIndex))
                {
                    parentChildren.Remove(this);
                    parentChildren.Insert(targetIndex, this);

                    Interop.NDalic.LowerBelow(swigCPtr, View.getCPtr(target));
                    if (NDalicPINVOKE.SWIGPendingException.Pending)
                    {
                        throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                    }
                }
            }
        }
Пример #6
0
 public new void Pause()
 {
     NUILog.Debug($"Pause() called!");
     debugPrint();
     base.Pause();
     AnimationState = AnimationStates.Paused;
 }
Пример #7
0
 public new void Play()
 {
     NUILog.Debug($"Play() called!");
     debugPrint();
     base.Play();
     AnimationState = AnimationStates.Playing;
 }
Пример #8
0
        // Callback for View TouchSignal
        private bool OnTouch(IntPtr view, IntPtr touchData)
        {
            if (touchData == global::System.IntPtr.Zero)
            {
                NUILog.Error("touchData should not be null!");
                return(true);
            }

            TouchEventArgs e = new TouchEventArgs();

            e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);

            bool consumed = false;

            if (_touchDataEventHandler != null)
            {
                consumed = _touchDataEventHandler(this, e);
            }

            if (enableControlState && !consumed)
            {
                consumed = HandleControlStateOnTouch(e.Touch);
            }

            return(consumed);
        }
Пример #9
0
        /// <summary>
        /// Raises the view to above the target view.
        /// </summary>
        /// <remarks>The sibling order of views within the parent will be updated automatically.
        /// Views on the level above the target view will still be shown above this view.
        /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
        /// </remarks>
        /// <param name="target">Will be raised above this view.</param>
        /// <since_tizen> 9 </since_tizen>
        public void RaiseAbove(View target)
        {
            var parentChildren = GetParent()?.Children;

            if (parentChildren != null)
            {
                int currentIndex = parentChildren.IndexOf(this);
                int targetIndex  = parentChildren.IndexOf(target);

                if (currentIndex < 0 || targetIndex < 0 ||
                    currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
                {
                    NUILog.Error("index should be bigger than 0 and less than children of layer count");
                    return;
                }
                // If the currentIndex is less than the target index and the target has the same parent.
                if (currentIndex < targetIndex)
                {
                    parentChildren.Remove(this);
                    parentChildren.Insert(targetIndex, this);

                    Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
                    if (NDalicPINVOKE.SWIGPendingException.Pending)
                    {
                        throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                    }
                }
            }
        }
Пример #10
0
 private void debugPrint()
 {
     NUILog.Debug($"===================================");
     NUILog.Debug($"<[{GetId()}] get currentStates : url={currentStates.url}, loopCount={currentStates.loopCount}, \nframePlayRangeMin/Max({currentStates.framePlayRangeMin},{currentStates.framePlayRangeMax}) ");
     NUILog.Debug($"  get from Property : StopBehavior={StopBehavior}, LoopMode={LoopingMode}, LoopCount={LoopCount}, PlayState={PlayState}");
     NUILog.Debug($"  RedrawInScalingDown={RedrawInScalingDown} >");
     NUILog.Debug($"===================================");
 }
Пример #11
0
        internal void SetPlayRange(Vector2 range)
        {
            PropertyMap map = new PropertyMap();

            map.Add(ImageVisualProperty.PlayRange, new PropertyValue(range));
            DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map));
            NUILog.Debug($"SetPlayRange(range min={range.X}, max={range.Y})");
        }
Пример #12
0
        public static TXaml LoadFromXamlFile <TXaml>(this TXaml view, string nameOfXamlFile)
        {
            NUILog.Debug($"LoadFromXamlFile(nameOfXamlFile={nameOfXamlFile})");

            string xamlScript = XamlLoader.GetXamlForName(nameOfXamlFile);

            XamlLoader.Load(view, xamlScript);
            return(view);
        }
Пример #13
0
        internal static string GetXamlForName(string nameOfXamlFile)
        {
            string xaml;
            string resourceName = nameOfXamlFile + ".xaml";
            string resource     = Tizen.Applications.Application.Current.DirectoryInfo.Resource;

            NUILog.Debug($"resource=({resource})");

            int windowWidth  = NUIApplication.GetDefaultWindow().Size.Width;
            int windowHeight = NUIApplication.GetDefaultWindow().Size.Height;

            string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName;

            NUILog.Debug($"likelyResourcePath=({likelyResourcePath})");


            if (!File.Exists(likelyResourcePath))
            {
                likelyResourcePath = resource + "layout/" + resourceName;
            }

            //Find the xaml file in the layout folder
            if (File.Exists(likelyResourcePath))
            {
                StreamReader reader = new StreamReader(likelyResourcePath);
                xaml = reader.ReadToEnd();

                NUILog.Debug($"File is exist!, try with xaml: {xaml}");

                // Layer
                var pattern = String.Format("x:Class *= *\"{0}\"", "Tizen.NUI.Layer");
                var regex   = new Regex(pattern, RegexOptions.ECMAScript);
                if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", "Tizen.NUI.Layer")))
                {
                    reader.Dispose();
                    return(xaml);
                }
                // View
                pattern = String.Format("x:Class *= *\"{0}\"", "Tizen.NUI.BaseComponents.View");
                regex   = new Regex(pattern, RegexOptions.ECMAScript);
                if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", "Tizen.NUI.BaseComponents.View")))
                {
                    reader.Dispose();
                    return(xaml);
                }

                reader.Dispose();
                throw new XamlParseException(string.Format("Can't find type {0}", "Tizen.NUI.XamlMainPage nor View nor Layer"), new XmlLineInfo());
            }
            return(null);
        }
Пример #14
0
        public void SetMinAndMaxFrame(int minFrame, int maxFrame)
        {
            var mMinFrame = (minFrame) > 0 ? minFrame : 0;
            var mMaxFrame = (maxFrame) > 0 ? maxFrame : 0;

            if (mMinFrame > mMaxFrame)
            {
                return;
            }
            NUILog.Debug($"SetMinAndMaxFrame()! minFrame={mMinFrame}, maxFrame={mMaxFrame}");

            Vector2 range = new Vector2((float)mMinFrame, (float)mMaxFrame);

            SetFramePlayRange(range);
        }
Пример #15
0
 public VectorAnimationViewTBD() : base()
 {
     NUILog.Debug($"AnimatedVectorImageView() constructor!");
     //default value in NUI level
     currentStates.url               = "";
     currentStates.frame             = 0;
     currentStates.loopCount         = 0;
     currentStates.repeatMode        = RepeatModes.Restart;
     currentStates.stopEndAction     = EndActions.Cancel;
     currentStates.framePlayRangeMin = -1;
     currentStates.framePlayRangeMax = -1;
     currentStates.changed           = false;
     currentStates.totalFrame        = -1;
     currentStates.scale             = 1.0f;
 }
Пример #16
0
        public void Stop(EndActions endAction = EndActions.Cancel)
        {
            NUILog.Debug($"Stop()!");
            if (AnimationState == AnimationStates.Stopped)
            {
                return;
            }

            AnimationState = AnimationStates.Stopped;
            StopEndAction  = (int)endAction;

            NUILog.Debug($"Stop() called!");
            debugPrint();
            base.Stop();
        }
Пример #17
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }
            NUILog.Debug($"AnimatedVectorImageView START");

            //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.

            base.Dispose(type);

            NUILog.Debug($"AnimatedVectorImageView END");
        }
Пример #18
0
        //temporary fix to pass TCT

        internal void UpdateVisual(int visualIndex, string visualName, VisualMap visualMap)
        {
            VisualBase visual = null;

            visual            = VisualFactory.Instance.CreateVisual(visualMap.OutputVisualMap);
            visual.Name       = visualName;
            visual.DepthIndex = visualMap.DepthIndex;

            RegisterVisual(visualIndex, visual);

            visualDictionary[visualIndex]   = visual;
            tranformDictionary[visualIndex] = visualMap.OutputTransformMap;

            RelayoutRequest();
            NUILog.Debug("UpdateVisual() name=" + visualName);
        }
Пример #19
0
        internal void SetFramePlayRange(Vector2 range)
        {
            currentStates.framePlayRangeMin = (int)range.X;
            currentStates.framePlayRangeMax = (int)range.Y;
            currentStates.changed           = true;

            PropertyArray array = new PropertyArray();

            array.PushBack(new PropertyValue(currentStates.framePlayRangeMin));
            array.PushBack(new PropertyValue(currentStates.framePlayRangeMax));

            PropertyMap map = new PropertyMap();

            map.Add(ImageVisualProperty.PlayRange, new PropertyValue(array));
            DoAction(vectorImageVisualIndex, (int)actionType.updateProperty, new PropertyValue(map));
            NUILog.Debug($"SetFramePlayRange(range min={currentStates.framePlayRangeMin}, max={currentStates.framePlayRangeMax})");
        }
Пример #20
0
        public Tuple <int, int> GetMinMaxFrame()
        {
            NUILog.Debug($"< [{GetId()}] GetMinMaxFrame()! total frame={currentStates.totalFrame}");

            PropertyMap map = Image;

            if (map != null)
            {
                PropertyValue val = map.Find(ImageVisualProperty.PlayRange);
                if (val != null)
                {
                    PropertyArray array = new PropertyArray();
                    if (val.Get(array))
                    {
                        uint cnt = array.Count();
                        int  item1 = -1, item2 = -1;
                        for (uint i = 0; i < cnt; i++)
                        {
                            PropertyValue v = array.GetElementAt(i);
                            int           intRet;
                            if (v.Get(out intRet))
                            {
                                NUILog.Debug($"Got play range of string [{i}]: {intRet}");
                                if (i == 0)
                                {
                                    item1 = intRet;
                                }
                                else if (i == 1)
                                {
                                    item2 = intRet;
                                }
                            }
                            else
                            {
                                Tizen.Log.Error("NUI", $"[ERR] fail to get play range from dali! case#1");
                            }
                        }
                        NUILog.Debug($"  [{GetId()}] GetMinMaxFrame(min:{item1}, max:{item2})! >");
                        return(new Tuple <int, int>(item1, item2));
                    }
                }
            }
            Tizen.Log.Error("NUI", $"[ERR] fail to get play range from dali! case#2");
            return(new Tuple <int, int>(-1, -1));
        }
Пример #21
0
        // Callback for View Wheel signal
        private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
        {
            if (wheelEvent == global::System.IntPtr.Zero)
            {
                NUILog.Error("wheelEvent should not be null!");
                return(true);
            }

            WheelEventArgs e = new WheelEventArgs();

            e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);

            if (_wheelEventHandler != null)
            {
                return(_wheelEventHandler(this, e));
            }
            return(false);
        }
Пример #22
0
        // Callback for View Hover signal
        private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
        {
            if (hoverEvent == global::System.IntPtr.Zero)
            {
                NUILog.Error("hoverEvent should not be null!");
                return(true);
            }

            HoverEventArgs e = new HoverEventArgs();

            e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);

            if (_hoverEventHandler != null)
            {
                return(_hoverEventHandler(this, e));
            }
            return(false);
        }
Пример #23
0
        // Callback for View TouchSignal
        private bool OnTouch(IntPtr view, IntPtr touchData)
        {
            if (touchData == global::System.IntPtr.Zero)
            {
                NUILog.Error("touchData should not be null!");
                return(true);
            }

            TouchEventArgs e = new TouchEventArgs();

            e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);

            if (_touchDataEventHandler != null)
            {
                return(_touchDataEventHandler(this, e));
            }
            return(false);
        }
Пример #24
0
        /// <summary>
        /// Get the list of layers' information such as the start frame and the end frame in the Lottie file.
        /// </summary>
        /// <returns>List of Tuple (string of layer name, integer of start frame, integer of end frame)</returns>
        /// <since_tizen> 7 </since_tizen>
        public List <Tuple <string, int, int> > GetContentInfo()
        {
            NUILog.Debug($"<");
            if (currentStates.contentInfo != null)
            {
                return(currentStates.contentInfo);
            }

            PropertyMap imageMap   = base.Image;
            PropertyMap contentMap = new PropertyMap();

            if (imageMap != null)
            {
                PropertyValue val = imageMap.Find(ImageVisualProperty.ContentInfo);
                if (val != null)
                {
                    if (val.Get(contentMap))
                    {
                        currentStates.contentInfo = new List <Tuple <string, int, int> >();
                        for (uint i = 0; i < contentMap.Count(); i++)
                        {
                            string        key = contentMap.GetKeyAt(i).StringKey;
                            PropertyArray arr = new PropertyArray();
                            contentMap.GetValue(i).Get(arr);
                            if (arr != null)
                            {
                                int startFrame, endFrame;
                                arr.GetElementAt(0).Get(out startFrame);
                                arr.GetElementAt(1).Get(out endFrame);

                                NUILog.Debug($"[{i}] layer name={key}, startFrame={startFrame}, endFrame={endFrame}");

                                Tuple <string, int, int> item = new Tuple <string, int, int>(key, startFrame, endFrame);

                                currentStates.contentInfo?.Add(item);
                            }
                        }
                    }
                }
            }
            NUILog.Debug($">");
            return(currentStates.contentInfo);
        }
Пример #25
0
        /// <summary>
        /// Set the minimum and the maximum frame.
        /// </summary>
        /// <param name="minFrame">minimum frame</param>
        /// <param name="maxFrame">maximum frame</param>
        /// <since_tizen> 7 </since_tizen>
        public void SetMinMaxFrame(int minFrame, int maxFrame)
        {
            NUILog.Debug($"< [{GetId()}] SetPlayRange({minFrame}, {maxFrame})");

            currentStates.changed           = true;
            currentStates.framePlayRangeMin = minFrame;
            currentStates.framePlayRangeMax = maxFrame;

            PropertyArray array = new PropertyArray();

            array.PushBack(new PropertyValue(currentStates.framePlayRangeMin));
            array.PushBack(new PropertyValue(currentStates.framePlayRangeMax));

            PropertyMap map = new PropertyMap();

            map.Add(ImageVisualProperty.PlayRange, new PropertyValue(array));
            DoAction(ImageView.Property.IMAGE, Interop.Visual.GetActionUpdateProperty(), new PropertyValue(map));
            NUILog.Debug($"  [{GetId()}] currentStates.min:({currentStates.framePlayRangeMin}, max:{currentStates.framePlayRangeMax})>");
        }
Пример #26
0
        /// <summary>
        /// LottieAnimationView constructor
        /// </summary>
        /// <param name="scale">The factor of scaling image, default : 1.0f</param>
        /// <param name="shown">false : not displayed (hidden), true : displayed (shown), default : true</param>
        /// <remarks>
        /// If the shown parameter is false, the animation is not visible even if the LottieAnimationView instance is created.
        /// </remarks>
        /// <example>
        /// <code>
        /// LottieAnimationView myLottie = new LottieAnimationView();
        /// LottieAnimationView myLottie2 = new LottieAnimationView(2.0f);
        /// LottieAnimationView myLottie3 = new LottieAnimationView(1.0f, false);
        /// </code>
        /// </example>
        /// <since_tizen> 7 </since_tizen>
        public LottieAnimationView(float scale = 1.0f, bool shown = true) : base()
        {
            ActionPlay  = Interop.LottieAnimationView.AnimatedVectorImageVisualActionPlayGet();
            ActionPause = Interop.LottieAnimationView.AnimatedVectorImageVisualActionPauseGet();
            ActionStop  = Interop.LottieAnimationView.AnimatedVectorImageVisualActionStopGet();

            NUILog.Debug($"< constructor GetId={GetId()} >");
            currentStates.url                 = "";
            currentStates.frame               = -1;
            currentStates.loopCount           = 1;
            currentStates.loopMode            = LoopingModeType.Restart;
            currentStates.stopEndAction       = StopBehaviorType.CurrentFrame;
            currentStates.framePlayRangeMin   = -1;
            currentStates.framePlayRangeMax   = -1;
            currentStates.changed             = false;
            currentStates.totalFrame          = -1;
            currentStates.scale               = scale;
            currentStates.redrawInScalingDown = true;
            SetVisible(shown);
        }
Пример #27
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            //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.

            //disconnect event signal
            if (finishedEventHandler != null && visualEventSignalCallback != null)
            {
                VisualEventSignal().Disconnect(visualEventSignalCallback);
                finishedEventHandler = null;
                NUILog.Debug($"disconnect event signal");
            }

            base.Dispose(type);
        }
Пример #28
0
        private static uint AccessibilityGetInterfaces(IntPtr self)
        {
            // Currently a maximum of one AccessibilityInterface per View is supported.
            // This will change when we implement AT-SPI interfaces as native C# interfaces.
            // Then, this method will look like:
            //
            // uint flags = 0U;
            // if (view is IAtspiSelection) flags |= (1U << (int)AccessibilityInterface.Selection)
            // if (view is IAtspiValue) flags |= (1U << (int)AccessibilityInterface.Value)
            // ...
            // return flags;

            View view = GetViewFromRefObject(self);

            if (!view.AtspiInterfaceFlags.HasValue)
            {
                NUILog.Error("AtspiInterfaceFlags are not set!");
                return(0U);
            }

            return(view.AtspiInterfaceFlags.Value);
        }
Пример #29
0
        public void SetMinMaxFrameByMarker(string marker1, string marker2 = null)
        {
            NUILog.Debug($"< [{GetId()}] SetMinMaxFrameByMarker({marker1}, {marker2})");

            currentStates.changed = true;
            currentStates.mark1   = marker1;
            currentStates.mark2   = marker2;

            PropertyArray array = new PropertyArray();

            array.PushBack(new PropertyValue(currentStates.mark1));
            if (marker2 != null)
            {
                array.PushBack(new PropertyValue(currentStates.mark2));
            }

            PropertyMap map = new PropertyMap();

            map.Add(ImageVisualProperty.PlayRange, new PropertyValue(array));
            DoAction(ImageView.Property.IMAGE, Interop.Visual.GetActionUpdateProperty(), new PropertyValue(map));
            NUILog.Debug($"  [{GetId()}] currentStates.mark1:{currentStates.mark1}, mark2:{currentStates.mark2} >");
        }
Пример #30
0
        private void onVisualEventSignal(IntPtr targetView, int visualIndex, int signalId)
        {
            OnFinished();

            if (targetView != IntPtr.Zero)
            {
                View v = Registry.GetManagedBaseHandleFromNativePtr(targetView) as View;
                if (v != null)
                {
                    NUILog.Debug($"targetView is not null! name={v.Name}");
                }
                else
                {
                    NUILog.Debug($"target is something created from dali");
                }
            }
            VisualEventSignalArgs e = new VisualEventSignalArgs();

            e.VisualIndex = visualIndex;
            e.SignalId    = signalId;
            visualEventSignalHandler?.Invoke(this, e);

            NUILog.Debug($"<[{GetId()}] onVisualEventSignal()! visualIndex={visualIndex}, signalId={signalId}>");
        }