private void WorldMap_ResizeStart(object sender, ResizedEventArgs e)
        {
            float newCellHeight = (float)(e.Height / e.Rows);
            float newCellWidth  = (float)(e.Width / e.Rows);

            this.Visible  = false;
            this.Size     = new Size((int)newCellWidth, (int)newCellHeight);
            this.Location = new Point((int)(newCellWidth * Cell.Coordinates[0]), (int)(newCellHeight * Cell.Coordinates[1]));
        }
Esempio n. 2
0
        private void OnResized(IntPtr windowSize)
        {
            ResizedEventArgs e = new ResizedEventArgs();
            var val            = new Uint16Pair(windowSize, false);

            e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
            val.Dispose();

            if (_windowResizedEventHandler != null)
            {
                _windowResizedEventHandler(this, e);
            }
        }
Esempio n. 3
0
        private void OnResized(IntPtr adaptor)
        {
            ResizedEventArgs e = new ResizedEventArgs();

            if (adaptor != null)
            {
                e.Adaptor = Adaptor.GetAdaptorFromPtr(adaptor);
            }

            if (_resizedEventHandler != null)
            {
                //here we send all data to user event handlers
                _resizedEventHandler(this, e);
            }
        }
Esempio n. 4
0
        private void ConsoleInput_Resized(ResizedEventArgs keyEventArgs)
        {
            vs.BeginUpdate();
            vs.Top    = 0;
            vs.Left   = Width - vs.Width;
            vs.Height = Height - 1;
            vs.EndUpdate();

            textBox.Visible = false;
            hs.BeginUpdate();
            hs.Left  = 0;
            hs.Top   = Height - 1;
            hs.Width = Width - 2;
            hs.EndUpdate();
            Draw();
        }
Esempio n. 5
0
        private void OnResized(IntPtr windowSize)
        {
            if (windowResizedEventHandler != null)
            {
                ResizedEventArgs e = new ResizedEventArgs();
                // var val = new Uint16Pair(windowSize, false);
                // e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
                // val.Dispose();

                // Workaround : windowSize should be valid pointer from dali,
                // but currently it is fixed and is not Uint16Pair class.
                // will be fixed later.
                e.WindowSize = this.WindowSize;
                windowResizedEventHandler(this, e);
            }
        }
Esempio n. 6
0
        private void OnResized(IntPtr window, IntPtr windowSize)
        {
            if (window == IntPtr.Zero)
            {
                NUILog.Error("OnResized() Window is null! Do nothing!");
                return;
            }

            ResizedEventArgs e = new ResizedEventArgs();

            // var val = new Uint16Pair(windowSize, false);
            // e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
            // val.Dispose();

            // Workaround : windowSize should be valid pointer from dali,
            // but currenlty it is fixed and is not Uint16Pair class.
            // will be fixed later.
            e.WindowSize = this.WindowSize;

            if (_windowResizeEventHandler != null)
            {
                _windowResizeEventHandler(this, e);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Enable the border window with IBorderInterface.
        /// This adds a border area to the Window.
        /// The border's UI is configured using IBorderInterface.
        /// Users can reisze and move by touching the border area.
        /// </summary>
        /// <param name="borderInterface">The IBorderInterface.</param>
        /// <param name="borderCloseDelegate">The BorderCloseDelegate. When close, this delegate is called.</param>
        /// <returns>Whether the border window is enabled</returns>
        internal bool EnableBorder(IBorderInterface borderInterface, BorderCloseDelegate borderCloseDelegate = null)
        {
            if (isBorderWindow == true)
            {
                Tizen.Log.Error("NUI", $"Already EnableBorderWindow\n");
                return(false);
            }

            try
            {
                Information.TryGetValue <int>("http://tizen.org/feature/screen.width", out screenWidth);
                Information.TryGetValue <int>("http://tizen.org/feature/screen.height", out screenHeight);
            }
            catch (DllNotFoundException e)
            {
                Tizen.Log.Fatal("NUI", $"{e}\n");
            }

            if (borderInterface == null)
            {
                borderInterface = new DefaultBorder();
            }
            this.borderInterface     = borderInterface;
            this.borderCloseDelegate = borderCloseDelegate;

            GetDefaultLayer().Name = "OriginalRootLayer";

            SetTransparency(true);
            BackgroundColor = Color.Transparent;
            borderInterface.BorderWindow = this;

            if (CreateBorder() == true)
            {
                using var realWindowSize = new Size2D(WindowSize.Width, WindowSize.Height);

                isBorderWindow = true;

                Resized += OnBorderWindowResized;

                borderInterface.OnCreated(borderView);

                // Increase the window size as much as the border area.
                borderHeight = 0;
                if (isTop)
                {
                    borderHeight += topView.SizeHeight;
                }
                if (isBottom)
                {
                    borderHeight += bottomView.SizeHeight;
                }

                // When running the app for the first time, if it runs in full size, do Maximize(true).
                if (screenWidth != 0 && screenHeight != 0 &&
                    realWindowSize.Width >= screenWidth && realWindowSize.Height >= screenHeight &&
                    IsMaximized() == false)
                {
                    Maximize(true);
                    borderInterface.OnMaximize(true);
                    ResizedEventArgs e = new ResizedEventArgs();
                    e.WindowSize = WindowSize;
                    OnBorderWindowResized(this, e);
                }
                else
                {
                    WindowSize += new Size2D((int)borderInterface.BorderLineThickness * 2, (int)(borderHeight + borderInterface.BorderLineThickness * 2));
                }

                // If it is BorderResizePolicyType.KeepRatio type, it will be resized according to the ratio.
                if (borderInterface.ResizePolicy == BorderResizePolicyType.KeepRatio)
                {
                    AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "1");
                }

                // Add a view to the border layer.
                GetBorderWindowBottomLayer().Add(rootView);

                InterceptTouchEvent += (s, e) =>
                {
                    if (e.Touch.GetState(0) == PointStateType.Down && IsMaximized() == false)
                    {
                        Raise();
                    }
                    return(false);
                };

                return(true);
            }
            else
            {
                this.borderInterface.Dispose();
                return(false);
            }
        }
Esempio n. 8
0
 public virtual void OnResized(ResizedEventArgs e)
 {
     Resized?.Invoke(this, e);
 }