Exemple #1
0
        private void StartTransition(VisualView view, bool activate)
        {
            if (_animation)
            {
                _animation.Stop();
                _animation.Finished += OnTransitionFinished;
            }

            if (activate)
            {
                view.AnimateVisualAdd(_icon, "Position", new Position2D(80, 80), 0, 2000, AlphaFunction.BuiltinFunctions.Linear, new Position2D(5, 5));
                view.AnimateVisualAdd(_icon2, "Opacity", 0.0f, 0, 2000, AlphaFunction.BuiltinFunctions.Linear);
                view.AnimateVisualAdd(_icon3, "MixColor", Color.Green, 0, 2000, AlphaFunction.BuiltinFunctions.Linear);
                view.AnimateVisualAdd(_icon4, "Size", new Size2D(150, 150), 0, 2000, AlphaFunction.BuiltinFunctions.Linear);
                _animation = view.AnimateVisualAddFinish();
            }
            else
            {
                view.AnimateVisualAdd(_icon, "Position", new Position2D(5, 5), 0, 2000, AlphaFunction.BuiltinFunctions.Linear, new Position2D(80, 80));
                view.AnimateVisualAdd(_icon2, "Opacity", 1.0f, 0, 2000);
                view.AnimateVisualAdd(_icon3, "MixColor", Color.Red, 0, 2000);
                view.AnimateVisualAdd(_icon4, "Size", new Size2D(50, 50), 0, 2000, AlphaFunction.BuiltinFunctions.Linear);
                _animation = view.AnimateVisualAddFinish();
            }

            if (_animation)
            {
                _animation.Finished  += OnTransitionFinished;
                _animation.EndAction  = Animation.EndActions.StopFinal;
                _transitionInProgress = true;
                _animation.Play();
            }
        }
Exemple #2
0
        /// <summary>
        /// ImageView Sample Application initialisation.
        /// </summary>
        public void Initialize()
        {
            // Create Background view.
            View focusIndicator = new View();

            FocusManager.Instance.FocusIndicator = focusIndicator;
            Window.Instance.BackgroundColor      = Color.Black;
            guide = new TextLabel();
            guide.HorizontalAlignment    = HorizontalAlignment.Center;
            guide.VerticalAlignment      = VerticalAlignment.Center;
            guide.PositionUsesPivotPoint = true;
            guide.ParentOrigin           = ParentOrigin.TopLeft;
            guide.PivotPoint             = PivotPoint.TopLeft;
            guide.Size2D     = new Size2D(1920, 96);
            guide.FontFamily = "Samsung One 600";
            guide.Position2D = new Position2D(0, 94);
            guide.MultiLine  = false;
            //guide.PointSize = 15.0f;
            guide.PointSize = PointSize15;
            guide.Text      = "Visual Sample \n";
            guide.TextColor = Color.White;
            //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
            Window.Instance.GetDefaultLayer().Add(guide);

            _visualView = new VisualView();
            _visualView.PositionUsesPivotPoint = true;
            _visualView.ParentOrigin           = ParentOrigin.TopLeft;
            _visualView.PivotPoint             = PivotPoint.TopLeft;
            _visualView.Position2D             = new Position2D(0, 160);
            _visualView.Size2D = new Size2D(1920, 800);
            Window.Instance.GetDefaultLayer().Add(_visualView);

            Populate();
            Window.Instance.KeyEvent += AppBack;
        }
Exemple #3
0
        void Initialize()
        {
            Window.Instance.KeyEvent       += OnKeyEvent;
            Window.Instance.BackgroundColor = Color.Black;

            View _mainView = new View();

            _mainView.Size2D = Window.Instance.WindowSize;
            Window.Instance.Add(_mainView);

            VisualView _visualView = new VisualView();

            _visualView.BackgroundColor        = new Color(0.88f, 0.88f, 0.88f, 1.0f);
            _visualView.Size2D                 = new Size2D(650, 900);
            _visualView.ParentOrigin           = ParentOrigin.Center;
            _visualView.PositionUsesPivotPoint = true;
            _visualView.PivotPoint             = PivotPoint.Center;

            ColorVisual _colorVisual = new ColorVisual();

            _colorVisual.Color = Color.Red;
            _colorVisual.Size  = new Size2D(400, 400);

            _visualView.AddVisual("color_visual", _colorVisual);

            _mainView.Add(_visualView);
        }
Exemple #4
0
        private static void SetDialogScrim(Dialog dialog)
        {
            if (dialog == null)
            {
                return;
            }

            var window           = NUIApplication.GetDefaultWindow();
            var defaultNavigator = window.GetDefaultNavigator();
            var defaultScrim     = dialog.Scrim;

            //Copies default scrim's GUI properties.
            var scrim = new VisualView();

            scrim.BackgroundColor = defaultScrim.BackgroundColor;
            scrim.Size            = defaultScrim.Size;
            scrim.TouchEvent     += (object source, View.TouchEventArgs e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    defaultNavigator.Pop();
                }

                return(true);
            };

            dialog.Scrim = scrim;
        }
        public FrameTest1Page()
        {
            FrameView = new VisualView()
            {
                Size            = new Size(500, 100),
                BackgroundColor = Tizen.NUI.Color.White,
                BoxShadow       = new Shadow(10.0f, new Color(0.2f, 0.2f, 0.2f, 1.0f), new Vector2(5, 5)),
            };

            FrameText                     = new TextVisual();
            FrameText.Text                = "Frame With Shadow";
            FrameText.TextColor           = Tizen.NUI.Color.Black;
            FrameText.PointSize           = 10;
            FrameText.HorizontalAlignment = HorizontalAlignment.Center;

            BorderVisual borderVisual = new BorderVisual();

            borderVisual.BorderSize   = 2.0f;
            borderVisual.Color        = Tizen.NUI.Color.Blue;
            borderVisual.RelativeSize = new RelativeVector2(1.0f, 1.0f);

            FrameView.AddVisual("_borderVisual", borderVisual);
            FrameView.AddVisual("_textVisual", FrameText);

            InitializeComponent();
            Add(FrameView);

            ShadowOnBackground.Clicked  += OnShadowOnButtonClicked;
            ShadowOffBackground.Clicked += OnShadowOffButtonClicked;
        }
Exemple #6
0
        public Dialog(View content = null) : base()
        {
            EnableScrim          = true;
            EnableDismissOnScrim = true;

            //FIXME: Needs to separate GUI implementation codes to style cs file.
            var scrim = new VisualView();

            scrim.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.5f);
            //FIXME: Needs to set proper size to Scrim.
            scrim.Size        = NUIApplication.GetDefaultWindow().Size;
            scrim.TouchEvent += (object source, TouchEventArgs e) =>
            {
                if ((EnableDismissOnScrim == true) && (e.Touch.GetState(0) == PointStateType.Up))
                {
                    //TODO: To show hide animation.
                    this.Hide();
                    this.Dispose();
                }
                return(true);
            };

            Scrim = scrim;

            if (content != null)
            {
                content.RaiseAbove(scrim);
                Content = content;
            }
        }
Exemple #7
0
        void Initialize()
        {
            Window.Instance.KeyEvent       += OnKeyEvent;
            Window.Instance.BackgroundColor = Color.Black;

            View _mainView = new View();

            _mainView.Size2D = Window.Instance.WindowSize;
            Window.Instance.Add(_mainView);

            VisualView _visualView = new VisualView();

            _visualView.BackgroundColor        = new Color(0.88f, 0.88f, 0.88f, 1.0f);
            _visualView.Size2D                 = new Size2D(650, 950);
            _visualView.ParentOrigin           = ParentOrigin.Center;
            _visualView.PositionUsesPivotPoint = true;
            _visualView.PivotPoint             = PivotPoint.Center;

            SVGVisual _svgVisual = new SVGVisual();

            _svgVisual.URL          = _imageUrl + "tiger.svg";
            _svgVisual.Origin       = Visual.AlignType.BottomEnd;
            _svgVisual.AnchorPoint  = Visual.AlignType.BottomEnd;
            _svgVisual.RelativeSize = new RelativeVector2(0.5f, 0.5f);

            _visualView.AddVisual("SVG-Image", _svgVisual);

            _mainView.Add(_visualView);
        }
Exemple #8
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (selectAnimation != null)
                {
                    if (selectAnimation.State == Animation.States.Playing)
                    {
                        selectAnimation.Stop();
                    }
                    selectAnimation.Dispose();
                    selectAnimation = null;
                }

                container.RemoveAll();
                indicatorList.Clear();

                this.Remove(container);
                container.Dispose();
                container = null;
            }

            base.Dispose(type);
        }
 public void RegisterView(VisualView view)
 {
     Views[view.Name] = view;
     if (!this.views.Contains(view.Name))
     {
         this.views.Add(view.Name);
     }
 }
Exemple #10
0
        public void Initialize()
        {
            Window window = Window.Instance;

            /* Create a visual view. */
            _visualView = new VisualView();
            _visualView.ParentOrigin = ParentOrigin.TopLeft;
            _visualView.PivotPoint   = PivotPoint.TopLeft;
            _visualView.Size2D       = new Size2D(window.Size.Width, window.Size.Height);

            /* color visual */
            ColorVisual colorVisualMap1 = new ColorVisual();

            colorVisualMap1.Color  = Color.Green;
            _visualView.Background = colorVisualMap1.OutputVisualMap;

            window.Add(_visualView);

            /* image visual 1. No transform setting case. */
            imageVisualMap1            = new ImageVisual();
            imageVisualMap1.URL        = resources + "/images/image-1.jpg";
            imageVisualMap1.DepthIndex = 1;
            //_visualView.AddVisual("imageVisual1", imageVisualMap1);

            /* image visual 2. Using RelativePosition and SizePolicyWidth setting case. */
            imageVisualMap2     = new ImageVisual();
            imageVisualMap2.URL = resources + "/images/image-2.jpg";
            /* Using Size, you can set SizePolicyWidth and SizePolicyHeight separately, default by relative. */
            imageVisualMap2.Size = new Vector2(400.0f, 0.3f);
            /* Using RelativePosition, then PositionPolicyX and PositionPolicyY will be relative. */
            imageVisualMap2.RelativePosition = new Vector2(0.1f, 0.1f);
            imageVisualMap2.SizePolicyWidth  = VisualTransformPolicyType.Absolute;
            imageVisualMap2.Origin           = Visual.AlignType.TopBegin;
            imageVisualMap2.AnchorPoint      = Visual.AlignType.TopBegin;
            /* Ensure imageVisual show  */
            imageVisualMap2.DepthIndex = 9;
            _visualView.AddVisual("imageVisual2", imageVisualMap2);

            /* If imageVisual2 added first, the it will be covered by imageVisual1.
             * so, we need to set their depth index to ensure they all can be showed.
             */
            _visualView.AddVisual("imageVisual1", imageVisualMap1);

            _window = Window.Instance;
            _window.FocusChanged += (sender, ee) =>
            {
                cnt++;
                Tizen.Log.Debug("NUI", "[WindowFocusTest] WindowFocusChanged event comes! focus gained=" + ee.FocusGained);
            };

            Tizen.Log.Debug("NUI", "[WindowFocusTest] is focus acceptable=" + _window.IsFocusAcceptable());
            _window.SetAcceptFocus(false);
            Tizen.Log.Debug("NUI", "[WindowFocusTest] set focus acceptable=false!!!");
            Tizen.Log.Debug("NUI", "[WindowFocusTest] is focus acceptable=" + _window.IsFocusAcceptable());
            _window.SetAcceptFocus(true);
            Tizen.Log.Debug("NUI", "[WindowFocusTest] set focus acceptable=true!!!");
            Tizen.Log.Debug("NUI", "[WindowFocusTest] is focus acceptable=" + _window.IsFocusAcceptable());
        }
Exemple #11
0
 private void Initialize()
 {
     container = new VisualView()
     {
         Name                   = "Container",
         ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
         PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft,
         PositionUsesPivotPoint = true,
     };
     this.Add(container);
 }
Exemple #12
0
        private void Initialize()
        {
            container = new VisualView()
            {
                Name                   = "Container",
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft,
                PositionUsesPivotPoint = true,
            };
            this.Add(container);

            //TODO: Apply color properties from PaginationStyle class.
            indicatorColor         = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            selectedIndicatorColor = new Color(1.0f, 1.0f, 1.0f, 1.0f);
        }
Exemple #13
0
        /// <inheritdoc/>
        public virtual void Draw(ICanvas canvas, RectF dirtyRect)
        {
            canvas.FillColor   = FillColor;
            canvas.StrokeColor = StrokeColor;

            var boundingBox = VisualView.GetBoundingBox();
            var x           = (boundingBox.X / Density) + Offset.X;
            var y           = (boundingBox.Y / Density) + Offset.Y;
            var width       = boundingBox.Width / Density;
            var height      = boundingBox.Height / Density;

            DrawnRectangle = new Rect(x, y, width, height);

            canvas.FillRectangle(DrawnRectangle);
        }
        public BrushBorderTestPage()
        {
            InitializeComponent();

            ButtonSolid.Clicked          += OnClickedSolid;
            ButtonGradientLinear.Clicked += OnClickedLinear;
            ButtonGradientRadial.Clicked += OnClickedRadial;

            FrameView = new VisualView()
            {
                Size            = new Size(500, 100),
                BackgroundColor = Tizen.NUI.Color.White,
                BoxShadow       = new Shadow(10.0f, new Color(0.2f, 0.2f, 0.2f, 1.0f), new Vector2(5, 5))
            };

            FrameText                     = new TextVisual();
            FrameText.Text                = "Frame With Shadow";
            FrameText.TextColor           = Tizen.NUI.Color.Black;
            FrameText.PointSize           = 10;
            FrameText.HorizontalAlignment = HorizontalAlignment.Center;

            PropertyArray stopColor = new PropertyArray();

            stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f));
            stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f));

            LinearGradient               = new GradientVisual();
            LinearGradient.StopColor     = stopColor;
            LinearGradient.StartPosition = new Vector2(0.0f, 0.0f);
            LinearGradient.EndPosition   = new Vector2(0.3f, 0.3f);
            LinearGradient.Origin        = Visual.AlignType.TopBegin;

            RadialGradient           = new GradientVisual();
            RadialGradient.Center    = new Vector2(0.0f, 0.0f);
            RadialGradient.Radius    = 0.5f;
            RadialGradient.StopColor = stopColor;
            RadialGradient.Origin    = Visual.AlignType.TopBegin;

            FrameBorder              = new BorderVisual();
            FrameBorder.BorderSize   = 2.0f;
            FrameBorder.Color        = Tizen.NUI.Color.Blue;
            FrameBorder.RelativeSize = new RelativeVector2(1.0f, 1.0f);

            FrameView.AddVisual(BorderId, FrameBorder);
            FrameView.AddVisual(TextId, FrameText);

            ContentView.Add(FrameView);
        }
Exemple #15
0
        private void Initialize()
        {
            paginationStyle = Style as PaginationStyle;
            if (paginationStyle == null)
            {
                throw new Exception("Pagination attributes is null.");
            }

            container = new VisualView()
            {
                Name                   = "Container",
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft,
                PositionUsesPivotPoint = true,
            };
            this.Add(container);
        }
        private void StartTransition(VisualView view, VisualMap target, string property, bool activate)
        {
            if (_animation)
            {
                _animation.Stop();
                _animation.Finished += OnTransitionFinished;
            }

            if (activate)
            {
                if (property == "Position")
                {
                    _animation = view.AnimateVisual(target, property, new Position2D(20, 20), 0, 1000, AlphaFunction.BuiltinFunctions.Linear, new Position2D(40, 40));
                }
                else if (property == "Opacity")
                {
                    _animation = view.AnimateVisual(target, property, 0.0f, 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
                }
                else if (property == "MixColor")
                {
                    _animation = view.AnimateVisual(target, property, Color.Green, 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
                }
            }
            else
            {
                if (property == "Position")
                {
                    _animation = view.AnimateVisual(target, property, new Position2D(5, 5), 0, 1000);
                }
                else if (property == "Opacity")
                {
                    _animation = view.AnimateVisual(target, property, 1.0f, 0, 1000);
                }
                else if (property == "MixColor")
                {
                    _animation = view.AnimateVisual(target, property, Color.Red, 0, 1000);
                }
            }

            if (_animation)
            {
                _animation.Finished  += OnTransitionFinished;
                _transitionInProgress = true;
                _animation.Play();
            }
        }
Exemple #17
0
        private void Initialize()
        {
            circularPaginationStyle = ViewStyle as CircularPaginationStyle;
            if (circularPaginationStyle == null)
            {
                throw new Exception("CircularPagination style is null.");
            }

            container = new VisualView()
            {
                Name                   = "Container",
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                PositionUsesPivotPoint = true,
            };
            this.Add(container);
        }
Exemple #18
0
        private View CreateDefaultScrim()
        {
            var scrimStyle = ThemeManager.GetStyle("Tizen.NUI.Components.DialogPage.Scrim");
            var scrim      = new VisualView(scrimStyle);

            //FIXME: Needs to set proper size to Scrim.
            scrim.Size        = NUIApplication.GetDefaultWindow().Size;
            scrim.TouchEvent += (object source, TouchEventArgs e) =>
            {
                if ((EnableDismissOnScrim == true) && (e.Touch.GetState(0) == PointStateType.Up))
                {
                    this.Navigator.Pop();
                }
                return(true);
            };

            return(scrim);
        }
Exemple #19
0
        private View CreateDefaultScrim()
        {
            //FIXME: Needs to separate GUI implementation codes to style cs file.
            var scrim = new VisualView();

            scrim.BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.5f);
            //FIXME: Needs to set proper size to Scrim.
            scrim.Size        = NUIApplication.GetDefaultWindow().Size;
            scrim.TouchEvent += (object source, TouchEventArgs e) =>
            {
                if ((EnableDismissOnScrim == true) && (e.Touch.GetState(0) == PointStateType.Up))
                {
                    this.Navigator.Pop();
                }
                return(true);
            };

            return(scrim);
        }
Exemple #20
0
        /// <summary>
        /// you can override it to clean-up your own resources.
        /// </summary>
        /// <param name="type">DisposeTypes</param>
        /// <since_tizen> 8 </since_tizen>
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                container.RemoveAll();
                indicatorList.Clear();

                this.Remove(container);
                container.Dispose();
                container = null;
            }

            base.Dispose(type);
        }
        /// <summary>
        /// The method to set visual view visible after clicking the button2
        /// - contains visuals images
        /// </summary>
        /// <returns> The created VisualView </returns>
        private VisualView CreateVisualView2()
        {
            VisualView CurrentVisualView = new VisualView();

            CurrentVisualView.Size2D                 = new Size2D(CurrentWidth, CurrentHeight);
            CurrentVisualView.ParentOrigin           = ParentOrigin.TopLeft;
            CurrentVisualView.PositionUsesPivotPoint = true;
            CurrentVisualView.PivotPoint             = PivotPoint.TopLeft;
            CurrentVisualView.Position2D             = new Position2D(WindowWidth + FrameSize, 0);
            CurrentVisualView.BackgroundColor        = Color.White;

            VisualMap ThisVisualMap = null;

            /// the main title
            ThisVisualMap = CreateTextVisual("VISUALS", 20.0f, new RelativeVector2(0.5f, 0.0f));
            CurrentVisualView.AddVisual("TextVisuals", ThisVisualMap);

            RelativeVector2[] ImageTextRelativePosition =
            {
                new RelativeVector2(0.3f, 0.3f),
                new RelativeVector2(0.7f, 0.3f),
                new RelativeVector2(0.3f, 0.9f),
                new RelativeVector2(0.7f, 0.9f),
                new RelativeVector2(0.5f, 0.6f)
            };

            for (uint i = 0; i < ImageCount; ++i)
            {
                ThisVisualMap = CreateVisualMap(ImageType[i]);
                /// to show how nice NPatch can be stretched
                if (ImageType[i] == "NPatch")
                {
                    ThisVisualMap.RelativeSize = new RelativeVector2(2 * ImageRelativeWidth, ImageRelativeHeight);
                }

                CurrentVisualView.AddVisual(ImageType[i], ThisVisualMap);
                CurrentVisualView.AddVisual("Text" + ImageType[i], CreateTextVisual(ImageType[i], 9.0f, ImageTextRelativePosition[i]));
            }

            MainVisualView.Add(CurrentVisualView);
            return(CurrentVisualView);
        }
        void Initialize()
        {
            Window.Instance.KeyEvent   += WindowKeyEvent;
            Window.Instance.TouchEvent += WindowTouchEvent;
            WindowWidth  = (int)Window.Instance.WindowSize[0];
            WindowHeight = (int)Window.Instance.WindowSize[1];
            WindowShift  = new Position2D(WindowWidth, 0);

            // the view is parent for the MainVisualView and the PaginationExample
            MainView        = new View();
            MainView.Size2D = new Size2D(WindowWidth, WindowHeight);
            Window.Instance.Add(MainView);

            // VisualView of the size = 3 * window_size; contains 3 images
            MainVisualView                        = new VisualView();
            MainVisualView.Size2D                 = new Size2D(3 * WindowWidth, WindowHeight);
            MainVisualView.PivotPoint             = PivotPoint.TopLeft;
            MainVisualView.ParentOrigin           = ParentOrigin.TopLeft;
            MainVisualView.PositionUsesPivotPoint = true;
            MainVisualView.BackgroundColor        = Color.White;
            MainView.Add(MainVisualView);

            // adds images to the ImageVisuals
            ImageVisual ThisImageVisual = null;

            for (uint i = 1; i <= 3; ++i)
            {
                ThisImageVisual          = CreateImageVisual(i);
                ThisImageVisual.Position = new Vector2((WindowWidth - ThisImageVisual.Size[0]) / 2 + (i - 1) * WindowWidth, 50);
                MainVisualView.AddVisual("image" + i.ToString(), ThisImageVisual);
            }

            // registers the pagination's custom style
            Tizen.NUI.Components.StyleManager.Instance.RegisterStyle("CustomPagination", null, typeof(NUI_Pagination.CustomPaginationStyle));

            PaginationExample = new Pagination("CustomPagination");
            PaginationExample.IndicatorCount = 3;
            PaginationExample.SelectedIndex  = 0;

            MainView.Add(PaginationExample);
        }
        /// <summary>
        /// The method to set the visual view visible after clicking the button3
        /// - contains visuals primitives
        /// </summary>
        /// <returns> The created VisualView </returns>
        private VisualView CreateVisualView3()
        {
            VisualView CurrentVisualView = new VisualView();

            CurrentVisualView.Size2D                 = new Size2D(CurrentWidth, CurrentHeight);
            CurrentVisualView.ParentOrigin           = ParentOrigin.TopLeft;
            CurrentVisualView.PositionUsesPivotPoint = true;
            CurrentVisualView.PivotPoint             = PivotPoint.TopLeft;
            CurrentVisualView.Position2D             = new Position2D(2 * WindowWidth + FrameSize, 0);
            CurrentVisualView.BackgroundColor        = Color.White;

            VisualMap ThisVisualMap = null;

            /// the main title
            ThisVisualMap = CreateTextVisual("VISUALS", 20.0f, new RelativeVector2(0.5f, 0.0f));
            CurrentVisualView.AddVisual("TextVisuals", ThisVisualMap);

            float           DeltaWidth             = (1.0f + PrimitiveRelativeWidth) / 6.0f;
            float           DeltaHeight            = (float)((0.9f - Math.Ceiling(PrimitiveCount / 2.0f) * PrimitiveRelativeHeight) / (1.0f + Math.Ceiling(PrimitiveCount / 2.0f)));
            RelativeVector2 VisualRelativePosition = new RelativeVector2(-DeltaWidth, 0.1f + DeltaHeight);

            for (uint i = 0; i < PrimitiveCount; ++i)
            {
                ThisVisualMap = CreateVisualMap(PrimitiveName[i]);
                ThisVisualMap.RelativePosition = VisualRelativePosition + new RelativeVector2(0, 0.06f);
                CurrentVisualView.AddVisual(PrimitiveName[i], ThisVisualMap);
                CurrentVisualView.AddVisual("Text" + PrimitiveName[i], CreateTextVisual(PrimitiveName[i], 9.0f, VisualRelativePosition + new RelativeVector2(0.5f, PrimitiveRelativeHeight)));
                if (i % 2 == 0)
                {
                    VisualRelativePosition += new RelativeVector2(2.0f * DeltaWidth, (DeltaHeight + PrimitiveRelativeHeight) / 2.0f);
                }
                else
                {
                    VisualRelativePosition += new RelativeVector2(-2.0f * DeltaWidth, (DeltaHeight + PrimitiveRelativeHeight) / 2.0f);
                }
            }

            MainVisualView.Add(CurrentVisualView);
            return(CurrentVisualView);
        }
Exemple #24
0
        private void VisualSample_FocusLost(object sender, EventArgs e)
        {
            VisualView view = sender as VisualView;

            view.BackgroundColor = Color.Green;
            view.Scale           = new Vector3(1.0f, 1.0f, 1.0f);

            view.AddVisual("iconVisual", dimImageMap);

            if (view.Name == "MyView1")
            {
                imageMap2.MixColor = new Color(1, 0, 0, 0.5f);
                imageMap2.Opacity  = 0.5f;
            }
            else if (view.Name == "MyView0")
            {
                imageMap.MixColor = new Color(1, 0, 0, 0.5f);
                imageMap.Opacity  = 0.5f;
            }

            Tizen.Log.Fatal("NUI", "FocusLost-" + view.Name);
        }
Exemple #25
0
        private void VisualSample_FocusGained(object sender, EventArgs e)
        {
            VisualView view = sender as VisualView;

            view.BackgroundColor = Color.Yellow;
            view.Scale           = new Vector3(1.2f, 1.2f, 1.0f);

            view.AddVisual("iconVisual", highlightImageMap);

            if (view.Name == "MyView1")
            {
                imageMap2.MixColor = new Color(1, 1, 1, 1);
                imageMap2.Opacity  = 1.0f;
            }
            else if (view.Name == "MyView0")
            {
                imageMap.MixColor = new Color(1, 1, 1, 1);
                imageMap.Opacity  = 1.0f;
            }

            Tizen.Log.Fatal("NUI", "FocusGained-" + view.Name);
        }
Exemple #26
0
        private View CreateDefaultScrim()
        {
            var scrim = new VisualView()
            {
                // Scrim is added to Menu so Scrim should exclude layouting
                // not to enlarge Menu size.
                ExcludeLayouting = true,
                BackgroundColor  = Color.Transparent,
                Size             = new Size(NUIApplication.GetDefaultWindow().Size),
            };

            scrim.TouchEvent += (object source, TouchEventArgs e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    this.Dismiss();
                }
                return(true);
            };

            return(scrim);
        }
Exemple #27
0
        public void VisualViewConstructorWithCustomViewBehaviour()
        {
            tlog.Debug(tag, $"VisualViewConstructorWithCustomViewBehaviour START");

            ViewStyle style = new ViewStyle()
            {
                Size = new Size2D(200, 200),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.CenterRight,
                PivotPoint             = PivotPoint.CenterRight,
                BackgroundColor        = Color.Azure,
                Focusable = true,
            };

            var testingTarget = new VisualView(CustomViewBehaviour.DisableStyleChangeSignals, style);

            Assert.IsNotNull(testingTarget, "Can't create success object VisualView");
            Assert.IsInstanceOf <VisualView>(testingTarget, "Should be an instance of VisualView type.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"VisualViewConstructorWithCustomViewBehaviour END (OK)");
        }
        void Initialize()
        {
            Window.Instance.KeyEvent       += OnKeyEvent;
            Window.Instance.BackgroundColor = Color.Blue;
            Size2D WindowinSize = Window.Instance.WindowSize;

            WindowWidth = (int)WindowinSize[0];
            int WindowHeight = (int)WindowinSize[1];


            /// the buttons visual view
            ButtonVisualView                        = new VisualView();
            ButtonVisualView.Size2D                 = new Size2D((int)(WindowWidth - 2 * FrameSize), (int)((WindowHeight - 3 * FrameSize) * ButtonToMainRatio));
            ButtonVisualView.ParentOrigin           = ParentOrigin.BottomLeft;
            ButtonVisualView.PositionUsesPivotPoint = true;
            ButtonVisualView.PivotPoint             = PivotPoint.BottomLeft;
            ButtonVisualView.Position2D             = new Position2D(FrameSize, -FrameSize);
            InitializeButtons();
            Buttons[0].BackgroundColor = new Color(0.66f, 0.6f, 0.9f, 1);
            Window.Instance.Add(ButtonVisualView);

            /// the main visual view
            MainVisualView                        = new VisualView();
            CurrentWidth                          = WindowWidth - 2 * FrameSize;
            CurrentHeight                         = (int)((WindowHeight - 3 * FrameSize) * (1 - ButtonToMainRatio));
            MainVisualView.Size2D                 = new Size2D(3 * WindowWidth, CurrentHeight);
            MainVisualView.ParentOrigin           = ParentOrigin.TopLeft;
            MainVisualView.PositionUsesPivotPoint = true;
            MainVisualView.PivotPoint             = PivotPoint.TopLeft;
            MainVisualView.Position2D             = new Position2D(0, FrameSize);
            MainVisualView.BackgroundColor        = Color.Blue;
            Window.Instance.Add(MainVisualView);

            CurrentVisualView.Add(CreateVisualView1());
            CurrentVisualView.Add(CreateVisualView2());
            CurrentVisualView.Add(CreateVisualView3());
        }
Exemple #29
0
        private void Initialize()
        {
            paginationAttributes = attributes as PaginationAttributes;
            if (paginationAttributes == null)
            {
                throw new Exception("Pagination attributes is null.");
            }

            container = new VisualView()
            {
                Name                   = "Container",
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft,
                PositionUsesPivotPoint = true,
                //BackgroundColor = Color.Yellow
            };
            this.Add(container);

            selectIndicator = new ImageVisual()
            {
                URL = " "
            };
            container.AddVisual("SelectIndicator", selectIndicator);
        }
        /// <summary>
        /// Create TableView, Create PushButtons and add them to tableView.
        /// </summary>
        private void CreateVisuals()
        {
            // Visual View to contain each visual
            mVisualView = new VisualView();
            mVisualView.PositionUsesPivotPoint = true;
            mVisualView.ParentOrigin           = ParentOrigin.CenterLeft;
            mVisualView.PivotPoint             = PivotPoint.CenterLeft;
            // Set the VisualView size for the 14 kind of visuals
            mVisualView.Size2D = new Size2D(14 * 360, mVisualSize.Height);

            Window.Instance.GetDefaultLayer().Add(mVisualView);

            // Default Visual position
            Vector2 visualPosition = new Vector2(180, 0);
            uint    visualIndex    = 0;

            for (; visualIndex < mVisualCount; ++visualIndex)
            {
                // Create each Visual Map
                mVisualView.Add(CreateVisualMap(mVisualType[visualIndex], visualPosition));
                // Update Visual Position for the next visual
                visualPosition += new Vector2(360, 0);
            }
        }