Exemple #1
0
 private void HandleFocusFigureBoundsChanged(object sender, BoundsChangedEventArgs e)
 {
     if (_isFocused)
     {
         RelocateAllHandles();
     }
 }
Exemple #2
0
 protected virtual void OnFigureBoundsChanged(BoundsChangedEventArgs e)
 {
     using (Figure.DirtManager.BeginDirty()) {
         RelocateAllHandles();
         RelocateFocus();
     }
 }
 protected void HandleChildrenBoundsChanged(object sender, BoundsChangedEventArgs e)
 {
     /// 自分自身の移動によって引き起こされた子の移動であれば
     /// 無限ループになってしまうのでDirtyしない.
     if (!_isInMoving)
     {
         DirtyBoundsCache(null);
     }
 }
Exemple #4
0
 // --- event ---
 protected virtual void OnConnectableBoundsChanged(BoundsChangedEventArgs e)
 {
     if (_router != null && IsValidEdge)
     {
         if (e.MovingFigures == null || !e.MovingFigures.Contains(this))
         {
             using (DirtManager.BeginDirty()) {
                 _router.Route(this);
             }
         }
     }
 }
Exemple #5
0
        //protected override bool OnDraw(Gdk.EventExpose evnt)
        //{
        //    int winWidth, winHeight;
        //    this.GetSize(out winWidth, out winHeight);
        //    Gtk.Style.PaintFlatBox(Style, this.GdkWindow, StateType.Normal, ShadowType.Out, evnt.Area, this, "tooltip", 0, 0, winWidth, winHeight);
        //    foreach (var child in this.Children)
        //        this.PropagateExpose(child, evnt);
        //    return false;
        //}

        protected override void OnBoundsChanged(BoundsChangedEventArgs a)
        {
            base.OnBoundsChanged(a);
            if (NudgeHorizontal || NudgeVertical)
            {
                var       loc     = Location;
                var       old     = loc;
                const int edgeGap = 2;

                //				int w = Bounds.Width;
                //
                //				if (fitWidthToScreen && (x + w >= screenW - edgeGap)) {
                //					int fittedWidth = screenW - x - edgeGap;
                //					if (fittedWidth < minFittedWidth) {
                //						x -= (minFittedWidth - fittedWidth);
                //						fittedWidth = minFittedWidth;
                //					}
                //					LimitWidth (fittedWidth);
                //				}

                Rectangle geometry = Screen.VisibleBounds;
                if (NudgeHorizontal)
                {
                    if (ScreenBounds.Width <= geometry.Width && loc.X + ScreenBounds.Width >= geometry.Left + geometry.Width - edgeGap)
                    {
                        loc.X = geometry.Left + (geometry.Width - ScreenBounds.Width - edgeGap);
                    }
                    if (loc.X <= geometry.Left + edgeGap)
                    {
                        loc.X = geometry.Left + edgeGap;
                    }
                }

                if (NudgeVertical)
                {
                    if (ScreenBounds.Height <= geometry.Height && loc.Y + ScreenBounds.Height >= geometry.Top + geometry.Height - edgeGap)
                    {
                        loc.Y = geometry.Top + (geometry.Height - ScreenBounds.Height - edgeGap);
                    }
                    if (loc.Y <= geometry.Top + edgeGap)
                    {
                        loc.Y = geometry.Top + edgeGap;
                    }
                }

                if (loc != old)
                {
                    Location = loc;
                }
            }
        }
Exemple #6
0
 protected override void OnBoundsChanged(BoundsChangedEventArgs a)
 {
     base.OnBoundsChanged(a);
     if (!Visible || repositioning)
     {
         return;
     }
     if (cachedBounds.Size != Size)
     {
         repositioning = true;
         RepositionWindow();
     }
     cachedBounds  = a.Bounds;
     repositioning = false;
 }
Exemple #7
0
        protected override void OnBoundsChanged(BoundsChangedEventArgs evt)
        {
            if (evt.Bounds.Width < 400)
            {
                Width = 400;
            }
            if (evt.Bounds.Height < 400)
            {
                Height = 400;
            }

            Prefs.SetPref("MainWindow.Width", evt.Bounds.Width);
            Prefs.SetPref("MainWindow.Height", evt.Bounds.Height);
            Prefs.SetPref("MainWindow.X", evt.Bounds.X);
            Prefs.SetPref("MainWindow.Y", evt.Bounds.Y);
            base.OnBoundsChanged(evt);
        }
        /// <summary>
        /// Ensure labels have the same width.
        /// </summary>
        protected override void OnBoundsChanged(BoundsChangedEventArgs a)
        {
            double width = 0;

            foreach (Label label in allLabels)
            {
                width = Math.Max(width, label.WindowBounds.Width);
            }

            foreach (Label label in allLabels)
            {
                if (label.WindowBounds.Width < width)
                {
                    label.WidthRequest = width;
                }
            }

            base.OnBoundsChanged(a);
        }
        protected virtual void OnBoundsChanged(
            Rectangle oldBounds, Rectangle newBounds, IEnumerable <IFigure> movingFigures
            )
        {
            /// EndDirty()時のAdjustRootFigureBounds()で無限ループになるのでBeginDirty()しない
            ///using (DirtManager.BeginDirty()) {
            var e = new BoundsChangedEventArgs(oldBounds, newBounds, movingFigures);

            if (_ChildrenFollowOnBoundsChanged && e.IsMove)
            {
                if (_structure.HasChildren)
                {
                    foreach (var child in Children)
                    {
                        child.Move(e.LocationDelta, movingFigures);
                    }
                }
            }

            InvalidatePaint(oldBounds);
            //InvalidatePaint(newBounds);
            InvalidatePaint(PaintBounds);

            if (
                Layout != null &&
                (e.IsResize || (e.IsMove && !_ChildrenFollowOnBoundsChanged))
                )
            {
                InvalidateLayout();
            }

            OnBoundsChangedAfter(oldBounds, newBounds, movingFigures);

            var handler = BoundsChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// Ensure labels have the same width.
        /// </summary>
        protected override void OnBoundsChanged(BoundsChangedEventArgs a)
        {
            double width = Math.Max(friendlyNameLabel.WindowBounds.Width, 0);

            width = Math.Max(applicationLabel.WindowBounds.Width, width);
            width = Math.Max(argumentsLabel.WindowBounds.Width, width);

            if (friendlyNameLabel.WindowBounds.Width < width)
            {
                friendlyNameLabel.WidthRequest = width;
            }

            if (applicationLabel.WindowBounds.Width < width)
            {
                applicationLabel.WidthRequest = width;
            }

            if (argumentsLabel.WindowBounds.Width < width)
            {
                argumentsLabel.WidthRequest = width;
            }

            base.OnBoundsChanged(a);
        }
Exemple #11
0
 // ------------------------------
 // private
 // ------------------------------
 private void HandleFigureBoundsChanged(object sender, BoundsChangedEventArgs e)
 {
     OnFigureBoundsChanged(e);
 }
Exemple #12
0
 /// <summary>
 /// When a child component has changed bounds.
 /// </summary>
 /// <param name="obj">The object that fired the event.</param>
 /// <param name="e">The event arguments.</param>
 protected virtual void OnItemBoundsChange(object obj, BoundsChangedEventArgs e)
 {
 }
Exemple #13
0
 protected override void OnBoundsChanged(BoundsChangedEventArgs a)
 {
     MovedRequested?.Invoke(this, EventArgs.Empty);
     base.OnBoundsChanged(a);
 }
Exemple #14
0
 /// <summary>
 /// If the item has changed its bounds.
 /// </summary>
 /// <param name="obj">The item that changed bounds.</param>
 /// <param name="e">The event arguments.</param>
 private void OnItemBoundsChange(object obj, BoundsChangedEventArgs e)
 {
     //Update the cell with the new data.
     Update();
 }
Exemple #15
0
 /// <summary>
 /// When a child component has changed bounds.
 /// </summary>
 /// <param name="obj">The object that fired the event.</param>
 /// <param name="e">The event arguments.</param>
 protected override void OnItemBoundsChange(object obj, BoundsChangedEventArgs e)
 {
     //Request a layout readjustment.
     _Layout.RequestUpdate();
 }
Exemple #16
0
 private void HandleConnectableBoundsChanged(object sender, BoundsChangedEventArgs e)
 {
     OnConnectableBoundsChanged(e);
 }