コード例 #1
0
 public void Add(FluidControl c)
 {
     if (!panel.Controls.Contains(c))
     {
         panel.Controls.Add(c);
     }
 }
コード例 #2
0
 public void Insert(int index, FluidControl c)
 {
     if (!panel.Controls.Contains(c))
     {
         panel.Controls.Insert(index, c);
     }
 }
コード例 #3
0
ファイル: Layouter.cs プロジェクト: north0808/haina
        private static void Adjust(FluidControl c, Size oldContainerSize, Size newContainerSize, SizeF scaleFactor)
        {
            Rectangle bounds = c.Bounds;
            int left = bounds.Left;
            int right = bounds.Right;
            int top = bounds.Top;
            int bottom = bounds.Bottom;

            AnchorStyles a = c.Anchor;
            if ((a & AnchorStyles.Right) != 0)
            {
                int dw = newContainerSize.Width - oldContainerSize.Width;
                right += dw;
                if ((a & AnchorStyles.Left) == 0)
                {
                    left += dw;
                }
            }

            if ((a & AnchorStyles.Bottom) != 0)
            {
                int dh = newContainerSize.Height - oldContainerSize.Height;
                bottom += dh;
                if ((a & AnchorStyles.Top) == 0)
                {
                    top += dh;
                }
            }
            Rectangle b = new Rectangle(left, top, right - left, bottom - top);
            if (c.Bounds.Size != b.Size)
            {
                c.Scale(scaleFactor);
            }
            c.Bounds = b;
        }
コード例 #4
0
        /// <summary>
        /// Leaves the control if focused and sets the focus to the next parent control that is Selectable<see cref="Selectable"/>.
        /// </summary>
        public void OnLostFocus()
        {
            if (!IsAttached)
            {
                return;
            }
            IHost host = Container.Host;

            if (host.FocusedControl == this)
            {
                FluidControl parent = Parent;
                while (parent != null)
                {
                    if (parent.Selectable)
                    {
                        host.FocusedControl = parent;
                        return;
                    }
                    parent = parent.Parent;
                }
                host.FocusedControl = null;
                if (LostFocus != null)
                {
                    LostFocus(this, EventArgs.Empty);
                }
            }
        }
コード例 #5
0
        private void PaintControlDoubleBuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
        {
            Bitmap buffer;

            if (imageBuffer.Contains(control))
            {
                buffer = imageBuffer[control] as Bitmap;
            }
            else
            {
                buffer = new Bitmap(bounds.Width, bounds.Height);
                imageBuffer.Add(control, buffer);
                using (Graphics bg = Graphics.FromImage(buffer))
                {
                    this.transparentBrush.Color = transparentColor;
                    bg.FillRectangle(transparentBrush, 0, 0, buffer.Width, buffer.Height);
                    Rectangle paintRect = control.ClientRectangle;
                    //bg.Clear(transparentColor);

                    FluidPaintEventArgs e = paintEventArgs;
                    e.Graphics      = bg;
                    e.ControlBounds = paintRect;
                    e.Region        = bg.Clip;
                    e.ScaleFactor   = pe.ScaleFactor;
                    control.OnPaint(e);
                }
            }
            ia.SetColorKey(transparentColor, transparentColor);
            pe.Graphics.DrawImage(buffer, bounds, 0, 0, bounds.Width, bounds.Height, GraphicsUnit.Pixel, ia);
        }
コード例 #6
0
 private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p)
 {
     p.X -= c.Bounds.X;
     p.Y -= c.Bounds.Y;
     //PointEventArgs e = new PointEventArgs(p.Gesture, p.X - c.Bounds.X, p.Y - c.Bounds.Y);
     return(p);
 }
コード例 #7
0
 /// <summary>
 /// Ensures that the selected control is removed (OnLeave) if it is a descendant of this control.
 /// </summary>
 /// <returns>True, if the focused control was nested in this control, otherwise false.</returns>
 public bool LeaveNestedFocusedControl()
 {
     if (IsAttached)
     {
         IContainer container = this as IContainer;
         if (container != null)
         {
             if (Container == null || Container.Host == null)
             {
                 return(false);
             }
             FluidControl selected = IsAttached ? Container.Host.FocusedControl : null;
             if (selected != null)
             {
                 if (container != null && selected.IsDescendantOf(container))
                 {
                     if (IsAttached)
                     {
                         Container.Host.FocusedControl = this.Selectable ? this : null;
                     }
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #8
0
ファイル: CommandEventArgs.cs プロジェクト: windygu/haina
 public CommandEventArgs(string command, FluidControl control, object data)
     : base()
 {
     this.Command        = command;
     this.OriginalSource = control;
     this.Data           = data;
 }
コード例 #9
0
ファイル: Layouter.cs プロジェクト: north0808/haina
        /// <summary>
        /// Layouts a control when it has changed it's size depending on it's anchor style.
        /// </summary>
        /// <param name="c"></param>
        /// <param name="oldContainerSize"></param>
        /// <param name="newContainerSize"></param>
        /// <param name="scaleFactor"></param>
        public static void AdjustSize(FluidControl c, Size oldContainerSize, Size newContainerSize, SizeF scaleFactor)
        {
            Rectangle bounds = c.Bounds;
            int left = bounds.Left;
            int right = bounds.Right;
            int top = bounds.Top;
            int bottom = bounds.Bottom;

            AnchorStyles a = c.Anchor;
            if ((a & AnchorStyles.Right) != 0 && (a & AnchorStyles.Left) == 0)
            {
                int dw = newContainerSize.Width - oldContainerSize.Width;
                right -= dw;
                left -= dw;
            }

            if ((a & AnchorStyles.Bottom) != 0 && (a & AnchorStyles.Top) == 0)
            {
                int dh = newContainerSize.Height - oldContainerSize.Height;
                bottom -= dh;
                top -= dh;
            }
            Rectangle b = new Rectangle(left, top, right - left, bottom - top);
            c.bounds = b;
        }
コード例 #10
0
        /// <summary>
        /// Layouts a control when it has changed it's size depending on it's anchor style.
        /// </summary>
        /// <param name="c"></param>
        /// <param name="oldContainerSize"></param>
        /// <param name="newContainerSize"></param>
        /// <param name="scaleFactor"></param>
        public static void AdjustSize(FluidControl c, Size oldContainerSize, Size newContainerSize, SizeF scaleFactor)
        {
            Rectangle bounds = c.Bounds;
            int       left   = bounds.Left;
            int       right  = bounds.Right;
            int       top    = bounds.Top;
            int       bottom = bounds.Bottom;

            AnchorStyles a = c.Anchor;

            if ((a & AnchorStyles.Right) != 0 && (a & AnchorStyles.Left) == 0)
            {
                int dw = newContainerSize.Width - oldContainerSize.Width;
                right -= dw;
                left  -= dw;
            }

            if ((a & AnchorStyles.Bottom) != 0 && (a & AnchorStyles.Top) == 0)
            {
                int dh = newContainerSize.Height - oldContainerSize.Height;
                bottom -= dh;
                top    -= dh;
            }
            Rectangle b = new Rectangle(left, top, right - left, bottom - top);

            c.bounds = b;
        }
コード例 #11
0
ファイル: CommandEventArgs.cs プロジェクト: north0808/haina
 public CommandEventArgs(string command, FluidControl control, object data)
     : base()
 {
     this.Command = command;
     this.OriginalSource = control;
     this.Data = data;
 }
コード例 #12
0
 public override void OnUp(PointEventArgs p)
 {
     if (downControl != null)
     {
         downControl.OnUp(TranslatePoint(downControl, p));
     }
     downControl = null;
 }
コード例 #13
0
        public void Hide(FluidControl control)
        {
            Rectangle bounds = control.Bounds;

            panel.Controls.Remove(control);
            panel.Invalidate(bounds);
            control.Visible = false;
        }
コード例 #14
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
 void animation_Completed(object sender, EventArgs e)
 {
     transitionControl.Bounds = ClientRectangle;
     SelectedControl          = transitionControl;
     transitionControl        = null;
     currentTransition        = Transition.None;
     dBufferRequired          = false;
     OnTransitionCompleted(sender as Animation);
 }
コード例 #15
0
 public void ShowMaximized(FluidControl control)
 {
     panel.BeginInit();
     panel.Controls.Add(control);
     control.Bounds = panel.ClientRectangle;
     panel.EndInit();
     control.Anchor = FluidControl.AnchorAll;
     panel.Invalidate(control.Bounds);
 }
コード例 #16
0
        protected void PaintControlUnbuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
        {
            FluidPaintEventArgs e = paintEventArgs;

            e.Graphics      = pe.Graphics;
            e.ControlBounds = bounds;
            e.Region        = pe.Region;
            e.ScaleFactor   = pe.ScaleFactor;
            control.OnPaint(e);
        }
コード例 #17
0
        /// <summary>
        /// Ensure that the specified control is visible, and make it become visible if not.
        /// </summary>
        /// <param name="c">The control that needs to be visible.</param>
        /// <returns>True, if the control was already visible, otherwise false.</returns>
        public bool EnsureVisible(FluidControl c)
        {
            bool      result = true;
            Rectangle bounds = c.Bounds;

            bounds.Y -= TopOffset;
            if (!Bounds.Contains(bounds))
            {
                EnsureVisible(bounds);
            }
            return(result);
        }
コード例 #18
0
ファイル: TransitionPanel.cs プロジェクト: windygu/haina
        private void PaintControl(FluidPaintEventArgs pe, FluidControl c)
        {
            Rectangle controlBounds = pe.ControlBounds;
            Region    clip          = pe.Region;
            Rectangle bounds        = c.Bounds;

            bounds.Offset(controlBounds.X, controlBounds.Y);
            if (clip.IsVisible(bounds))
            {
                PaintControlUnbuffered(pe, c, bounds);
            }
        }
コード例 #19
0
        /// <summary>
        /// Removes the focus of the selected control, if this control is a parent of the selected control.
        /// </summary>
        private void LeaveDescendant()
        {
            FluidControl selected = Container.Host.FocusedControl;

            if (selected != null)
            {
                if (selected.IsDescendantOf(this))
                {
                    Container.Host.FocusedControl = this;
                }
            }
        }
コード例 #20
0
        private void PaintControlUnbuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
        {
            //bounds.Offset(Left, Top);
            //Region clp = pe.IntersectClip(bounds);
            FluidPaintEventArgs e = paintEventArgs2;

            e.Graphics      = pe.Graphics;
            e.ControlBounds = bounds;
            e.Region        = pe.Region;
            e.ScaleFactor   = pe.ScaleFactor;
            control.OnPaint(e);
            //pe.ResetClip(clp);
        }
コード例 #21
0
        public override void PerformClick()
        {
            base.PerformClick();
            FluidControl control = selectedControl;

            if (control != null)
            {
                if (control.Selectable)
                {
                    Host.FocusedControl = control;
                }
            }
        }
コード例 #22
0
        private bool isAncestorDoubleBuffered()
        {
            FluidControl parent = this.Parent;

            while (parent != null)
            {
                if (parent.IsDoubleBuffered)
                {
                    return(true);
                }
                parent = parent.Parent;
            }
            return(false);
        }
コード例 #23
0
        /// <summary>
        /// Gets whether this control is a descendant of the specified container.
        /// </summary>
        /// <param name="container">The container which might be an ancestor.</param>
        /// <returns>True, if this control is a descendant of the container (or the container is an ancestor of the control), otherwhise false.</returns>
        public bool IsDescendantOf(IContainer container)
        {
            FluidControl parent = Parent;

            while (parent != null)
            {
                if (parent == container)
                {
                    return(true);
                }
                parent = parent.Parent;
            }
            return(false);
        }
コード例 #24
0
ファイル: NavigationPanel.cs プロジェクト: windygu/haina
        protected virtual void OnSelectedIndexChanging(ChangedEventArgs <int> e)
        {
            if (Initializing)
            {
                return;
            }
            int index = e.NewValue;

            if (e.NewValue >= 0)
            {
                FluidControl c = Pages[index].Control;
                c.Invalidate();
                c.Focus();
            }
        }
コード例 #25
0
 /// <summary>
 /// Give back the focus to the control that had the focus before this panel appeared and grabbed the focus,
 /// but only if the current focused control belong to a control nested inside this panel.
 /// </summary>
 private void RestorePreviousFocusedControl()
 {
     if (LeaveNestedFocusedControl())
     {
         // check if the previous control is still focusable and alive:
         if (previousFocusedControl != null && (!previousFocusedControl.Enabled || !previousFocusedControl.IsAvailable))
         {
             previousFocusedControl = null;
         }
         if (Host != null)
         {
             Host.FocusedControl = previousFocusedControl;
         }
     }
     previousFocusedControl = null;
 }
コード例 #26
0
        public void Paint(FluidPaintEventArgs e, FluidControl control, PaintFunc paintFunc, int alpha)
        {
            Rectangle dst = e.ControlBounds;

            //            Rectangle dst = control.Bounds;
            EnsureDBuffer(dst.Width, dst.Height);
            PaintBuffer(paintFunc, e.ScaleFactor);
            if (alpha >= 255)
            {
                e.Graphics.DrawImage(dbuffer, dst.X, dst.Y);
            }
            else
            {
                GdiExt.AlphaBlendImage(e.Graphics, dbuffer, dst.X, dst.Y, alpha, false);
            }
        }
コード例 #27
0
        /// <summary>
        /// Paints all  controls.
        /// The controls are painted in an optimized way:
        /// The controls are rendered from the last to the first, and after painting each control, the bounds of the control are excluded from the region, so this region is not painted twice.
        /// If a there is a transparent control, the remaining controls are painted from the first to this control, while the region is not excluded.
        /// </summary>
        /// <param name="pe">The PaintEventArgs.</param>
        protected virtual void PaintControls(FluidPaintEventArgs pe)
        {
#if true
            Region region = null;


            Region   clip  = pe.Region;
            Graphics g     = pe.Graphics;
            int      index = 0;


            for (int i = controls.Count - 1; i >= 0; i--)
            {
                FluidControl c = controls[i];
                if (c.Visible && c.IsTransparent)
                {
                    region = pe.Graphics.Clip;
                    index  = i + 1;
                    break;
                }
                Rectangle bounds = PaintControl(pe, c);
                if (!bounds.IsEmpty)
                {
                    clip.Exclude(bounds);
                    g.Clip = clip;
                }
            }
            for (int i = 0; i < index; i++)
            {
                FluidControl c = controls[i];
                if (c.IsTransparent)
                {
                    pe.Graphics.Clip = region;
                }
                PaintControl(pe, c);
            }
            if (region != null)
            {
                region.Dispose();
            }
#else
            foreach (FluidControl c in controls)
            {
                PaintControl(pe, c);
            }
#endif
        }
コード例 #28
0
 /// <summary>
 /// Leaves the focus from this control.
 /// </summary>
 public virtual void Leave()
 {
     if (Selectable && IsAttached)
     {
         FluidControl parent = Parent;
         while (parent != null)
         {
             if (parent.Selectable)
             {
                 parent.Focus();
                 return;
             }
             parent = parent.Parent;
         }
         OnLeave(Container.Host);
     }
 }
コード例 #29
0
ファイル: TransitionPanel.cs プロジェクト: windygu/haina
 public void Switch(int index, Transition transition, int duration)
 {
     alpha = 255;
     if (index != selectedIndex)
     {
         StopTransition();
         currentTransition = transition;
         dBufferRequired   = RequiresDBuffer(transition);
         transitionFunc    = GetTransitionFunc(transition);
         transitionControl = Controls[index];
         Animation animation = EnsureAnimation();
         animation.BeginValue = 0;
         animation.EndValue   = Width;
         animation.Duration   = duration;
         OnBeginTransition(index);
         animation.Start();
     }
 }
コード例 #30
0
 /// <summary>
 /// Gets the first control that is under the specified point.
 /// </summary>
 /// <param name="x">The x value of the point.</param>
 /// <param name="y">The y value of the point.</param>
 /// <returns>An ITouchControl, otherwise null.</returns>
 /// <remarks>
 /// The enumeration starts from the last to the first control, because the controls appear in this
 /// order in case they are overlapping.
 /// </remarks>
 public virtual FluidControl ControlFromPoint(int x, int y)
 {
     p.X = x;
     p.Y = y;
     for (int i = controls.Count - 1; i >= 0; i--)
     {
         FluidControl c = controls[i];
         if (!c.Visible)
         {
             continue;
         }
         Rectangle r = c.Bounds;
         if (r.Contains(p))
         {
             return(c);
         }
     }
     return(null);
 }
コード例 #31
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
        protected override void PaintControls(FluidPaintEventArgs pe)
        {
            FluidControl c  = SelectedControl;
            FluidControl tc = transitionControl;

            if (tc == null && (c is PageControl))
            {
                /// build a short cut for performance issues:
                c = ((PageControl)c).Control;
            }
            if (c != null)
            {
                PaintControl(pe, c);
            }

            if (tc != null)
            {
                PaintControl(pe, tc);
            }
        }
コード例 #32
0
        public override void OnDown(PointEventArgs p)
        {
            base.OnDown(p);
            FluidControl control = ControlFromPoint(p.X, p.Y);

            downControl = control;
            if (control != null)
            {
                PointEventArgs p2 = TranslatePoint(control, p);
                control.OnDown(p2);
            }
            if (control != null && control.Selectable)
            {
                selectedControl = control;
            }
            else if (control == null)
            {
                selectedControl = null;
            }
        }
コード例 #33
0
        /// <summary>
        /// Gets the first control that is under the specified point.
        /// </summary>
        /// <param name="x">The x value of the point.</param>
        /// <param name="y">The y value of the point.</param>
        /// <returns>An ITouchControl, otherwise null.</returns>
        /// <remarks>
        /// The enumeration starts from the last to the first control, because the controls appear in this
        /// order in case they are overlapping.
        /// </remarks>
        public FluidControl ControlFromPoint(int x, int y)
        {
            Point p = checkPoint;

            p.X = x;
            p.Y = y + TopOffset;
            for (int i = controls.Count - 1; i >= 0; i--)
            {
                FluidControl c = controls[i];
                if (!c.Visible)
                {
                    continue;
                }
                Rectangle r = c.Bounds;
                if (r.Contains(p))
                {
                    return(c);
                }
            }
            return(null);
        }
コード例 #34
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 protected override void BeginMoving()
 {
     base.BeginMoving();
     selectedControl = null;
 }
コード例 #35
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 public override void OnUp(PointEventArgs p)
 {
     if (downControl != null) downControl.OnUp(TranslatePoint(downControl, p));
     downControl = null;
 }
コード例 #36
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 public override void OnDown(PointEventArgs p)
 {
     base.OnDown(p);
     FluidControl control = ControlFromPoint(p.X, p.Y);
     downControl = control;
     if (control != null)
     {
         PointEventArgs p2 = TranslatePoint(control, p);
         control.OnDown(p2);
     }
     if (control != null && control.Selectable)
     {
         selectedControl = control;
     }
     else if (control == null)
     {
         selectedControl = null;
     }
 }
コード例 #37
0
ファイル: Panel.cs プロジェクト: Radytz/DroppedBoxx
 /// <summary>
 /// Give back the focus to the control that had the focus before this panel appeared and grabbed the focus,
 /// but only if the current focused control belong to a control nested inside this panel.
 /// </summary>
 private void RestorePreviousFocusedControl()
 {
     if (LeaveNestedFocusedControl())
     {
         // check if the previous control is still focusable and alive:
         if (previousFocusedControl != null && (!previousFocusedControl.Enabled || !previousFocusedControl.IsAvailable)) previousFocusedControl = null;
         if (Host != null) Host.FocusedControl = previousFocusedControl;
     }
     previousFocusedControl = null;
 }
コード例 #38
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
 void animation_Completed(object sender, EventArgs e)
 {
     transitionControl.Bounds = ClientRectangle;
     SelectedControl = transitionControl;
     transitionControl = null;
     currentTransition = Transition.None;
     dBufferRequired = false;
     OnTransitionCompleted(sender as Animation);
 }
コード例 #39
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
        public void Switch(int index, Transition transition, int duration)
        {
            StopTransition();
            if (index != selectedIndex)
            {
                alpha = 255;
                currentTransition = transition;
                dBufferRequired = RequiresDBuffer(transition);
                transitionFunc = GetTransitionFunc(transition);
                transitionControl = Controls[index];
                Animation animation = EnsureAnimation();

                animation.BeginValue = 0;
                animation.EndValue = Width;
                animation.Duration = duration;
                OnBeginTransition(index);
                animation.Start();
            }
        }
コード例 #40
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p)
 {
     p.X -= c.Bounds.X;
     p.Y -= c.Bounds.Y;
     //PointEventArgs e = new PointEventArgs(p.Gesture, p.X - c.Bounds.X, p.Y - c.Bounds.Y);
     return p;
 }
コード例 #41
0
 private PointEventArgs TranslatePoint(FluidControl c, PointEventArgs p)
 {
     p.X -= c.Bounds.X;
     p.Y -= c.Bounds.Y;
     return p;
 }
コード例 #42
0
ファイル: DoubleBuffer.cs プロジェクト: north0808/haina
 public void Paint(FluidPaintEventArgs e, FluidControl control, PaintFunc paintFunc, int alpha)
 {
     Rectangle dst = e.ControlBounds;
     //            Rectangle dst = control.Bounds;
     EnsureDBuffer(dst.Width, dst.Height);
     PaintBuffer(paintFunc, e.ScaleFactor);
     if (alpha >= 255)
     {
         e.Graphics.DrawImage(dbuffer, dst.X, dst.Y);
     }
     else
     {
         GdiExt.AlphaBlendImage(e.Graphics, dbuffer, dst.X, dst.Y, alpha, false);
     }
 }
コード例 #43
0
ファイル: DoubleBuffer.cs プロジェクト: north0808/haina
 public void Paint(FluidPaintEventArgs e, FluidControl control, PaintFunc paintFunc)
 {
     Paint(e, control, paintFunc, 255);
 }
コード例 #44
0
ファイル: TransitionPanel.cs プロジェクト: north0808/haina
 private void PaintControl(FluidPaintEventArgs pe, FluidControl c)
 {
     Rectangle controlBounds = pe.ControlBounds;
     Region clip = pe.Region;
     Rectangle bounds = c.Bounds;
     bounds.Offset(controlBounds.X, controlBounds.Y);
     if (clip.IsVisible(bounds))
     {
         PaintControlUnbuffered(pe, c, bounds);
     }
 }
コード例 #45
0
ファイル: ControlEventArgs.cs プロジェクト: north0808/haina
 public ControlEventArgs(FluidControl c)
 {
     Control = c;
 }
コード例 #46
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
        private void PaintControlDoubleBuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
        {
            Bitmap buffer;
            if (imageBuffer.Contains(control))
            {
                buffer = imageBuffer[control] as Bitmap;
            }
            else
            {
                buffer = new Bitmap(bounds.Width, bounds.Height);
                imageBuffer.Add(control, buffer);
                using (Graphics bg = Graphics.FromImage(buffer))
                {
                    this.transparentBrush.Color = transparentColor;
                    bg.FillRectangle(transparentBrush, 0, 0, buffer.Width, buffer.Height);
                    Rectangle paintRect = control.ClientRectangle;
                    //bg.Clear(transparentColor);

                    FluidPaintEventArgs e = paintEventArgs;
                    e.Graphics = bg;
                    e.ControlBounds = paintRect;
                    e.Region = bg.Clip;
                    e.ScaleFactor = pe.ScaleFactor;
                    control.OnPaint(e);
                }

            }
            ia.SetColorKey(transparentColor, transparentColor);
            pe.Graphics.DrawImage(buffer, bounds, 0, 0, bounds.Width, bounds.Height, GraphicsUnit.Pixel, ia);
        }
コード例 #47
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 private void PaintControlUnbuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
 {
     //bounds.Offset(Left, Top);
     //Region clp = pe.IntersectClip(bounds);
     FluidPaintEventArgs e = paintEventArgs2;
     e.Graphics = pe.Graphics;
     e.ControlBounds = bounds;
     e.Region = pe.Region;
     e.ScaleFactor = pe.ScaleFactor;
     control.OnPaint(e);
     //pe.ResetClip(clp);
 }
コード例 #48
0
 protected void PaintControlUnbuffered(FluidPaintEventArgs pe, FluidControl control, Rectangle bounds)
 {
     FluidPaintEventArgs e = paintEventArgs;
     e.Graphics = pe.Graphics;
     e.ControlBounds = bounds;
     e.Region = pe.Region;
     e.ScaleFactor = pe.ScaleFactor;
     control.OnPaint(e);
 }
コード例 #49
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
 public void ControlAdded(FluidControl control)
 {
     control.Visible = SelectedControl == control;
     control.Bounds = this.ClientRectangle;
 }
コード例 #50
0
 public override void OnDown(PointEventArgs p)
 {
     if (!Enabled) return;
     base.OnDown(p);
     FluidControl control = ControlFromPoint(p.X, p.Y);
     if (control != null && !control.Active) control = null;
     downControl = control;
     selectedControl = control;
     if (control != null)
     {
         PointEventArgs pointEventArgs = TranslatePoint(control, p);
         if (control.Active) control.OnDown(pointEventArgs);
     }
 }
コード例 #51
0
ファイル: TransitionPanel.cs プロジェクト: Radytz/DroppedBoxx
 protected override Rectangle PaintControl(FluidPaintEventArgs pe, FluidControl c)
 {
     Rectangle controlBounds = pe.ControlBounds;
     Region clip = pe.Region;
     Rectangle bounds = c.Bounds;
     bounds.Offset(controlBounds.X, controlBounds.Y);
     if (clip.IsVisible(bounds))
     {
         PaintControlUnbuffered(pe, c, bounds);
     }
     return bounds;
 }
コード例 #52
0
ファイル: ScrollPanel.cs プロジェクト: north0808/haina
 /// <summary>
 /// Ensure that the specified control is visible, and make it become visible if not.
 /// </summary>
 /// <param name="c">The control that needs to be visible.</param>
 /// <returns>True, if the control was already visible, otherwise false.</returns>
 public bool EnsureVisible(FluidControl c)
 {
     bool result = true;
     Rectangle bounds = c.Bounds;
     bounds.Y -= TopOffset;
     if (!Bounds.Contains(bounds))
     {
         EnsureVisible(bounds);
     }
     return result;
 }
コード例 #53
0
        /// <summary>
        /// Paints the control. If the control was painted, the bounds of the rectangle in the canvas are returned, otherwise Rectangle.Empty is returned.
        /// </summary>
        /// <param name="pe">The PaintEventArgs</param>
        /// <param name="control">The control</param>
        /// <returns>If the control was painted, the bounds of the rectangle in the canvas are returned, otherwise Rectangle.Empty is returned.</returns>
        protected virtual Rectangle PaintControl(FluidPaintEventArgs pe, FluidControl control)
        {
            if (!control.Visible) return Rectangle.Empty;
            Rectangle bounds = control.Bounds;
            if (bounds.Width <= 0 || bounds.Height <= 0) return Rectangle.Empty;

            Rectangle controlBounds = pe.ControlBounds;
            Region clip = pe.Region;
            bounds.Offset(controlBounds.X, controlBounds.Y);
            if (clip.IsVisible(bounds))
            {
                PaintControlUnbuffered(pe, control, bounds);
                return bounds;
            }
            return Rectangle.Empty;
        }
コード例 #54
0
ファイル: Panel.cs プロジェクト: Radytz/DroppedBoxx
        /// <summary>
        /// Opens the panel with the specified transition.
        /// </summary>
        /// <param name="transition">The transition to perform while the panel is shown.</param>
        public virtual void Show(ShowTransition transition)
        {
            previousFocusedControl = Host != null ? Host.FocusedControl : null;
            showTransition = transition;
            FluidTextBox.InputPanel.Enabled = false;
            Visible = false;
            FluidHost host = FluidHost.Instance;
            Rectangle client = host.ClientBounds;
            int h = client.Height;
            int w = client.Width;

            host.Add(this);
            bool modal = false;

            Bounds = GetShowStartBounds(transition);
            Visible = true;

            switch (transition)
            {
                case ShowTransition.None:
                    Show();
                    break;

                case ShowTransition.FromBottom:
                    AnimateTop(h - Bounds.Height, Animation.DefaultDuration, modal);
                    break;

                case ShowTransition.FromTop:
                    AnimateTop(Bounds.Height, Animation.DefaultDuration, modal);
                    break;

                default:
                    throw new NotImplementedException();
            }
            Focus();
            OnShowing();
        }