示例#1
0
 public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (base.CanvasBounds.Contains(e.CanvasLocation))
     {
         foreach (GH_Attr_Widget control in _controls)
         {
             if (control.Contains(e.CanvasLocation) && control.Enabled)
             {
                 GH_ObjectResponse val = control.RespondToMouseDown(sender, e);
                 if ((int)val != 0)
                 {
                     _activeControl = control;
                     return(val);
                 }
             }
         }
     }
     else if (_activeControl != null)
     {
         _activeControl.RespondToMouseDown(sender, e);
         _activeControl = null;
         return(GH_ObjectResponse.Handled);
     }
     return(0);
 }
示例#2
0
        public override void Layout()
        {
            //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
            //IL_012a: Unknown result type (might be due to invalid IL or missing references)
            float num  = base.CanvasPivot.Y + TopMargin + TopInnerMargin + (float)PanelRadius;
            float y    = base.CanvasPivot.Y;
            int   num2 = 0;

            foreach (GH_Attr_Widget control in _controls)
            {
                if (num2++ > 0)
                {
                    num += (float)Space;
                }
                PointF transform = new PointF(base.CanvasPivot.X + LeftMargin + LeftInnerMargin + (float)PanelRadius, num);
                control.UpdateBounds(transform, EffectiveWidth);
                control.Style   = base.Style;
                control.Palette = base.Palette;
                control.Layout();
                float height = control.Height;
                num += height;
            }
            num        += (float)PanelRadius + BottomMargin + BottomInnerMargin;
            base.Height = num - y;
            RectangleF rectangleF = GH_Attr_Widget.Shrink(base.CanvasBounds, LeftMargin, RightMargin, TopMargin, BottomMargin);

            _menu = GH_Capsule.CreateTextCapsule(rectangleF, rectangleF, base.Palette, "", new Font(new FontFamily("Arial"), 8f, FontStyle.Bold), 0, PanelRadius, 8);
        }
示例#3
0
        public bool GetActiveTooltip(PointF pt)
        {
            GH_Attr_Widget gH_Attr_Widget = composedCollection.IsTtipPoint(pt);

            if (gH_Attr_Widget != null)
            {
                _activeToolTip = gH_Attr_Widget;
                return(true);
            }
            return(false);
        }
示例#4
0
        public override void Render(WidgetRenderArgs args)
        {
            GH_Canvas canvas = args.Canvas;

            if (args.Channel == WidgetChannel.Overlay)
            {
                if (expanded)
                {
                    _window.Render(args);
                }
            }
            else if (args.Channel == WidgetChannel.Object)
            {
                Graphics graphics = canvas.Graphics;
                float    zoom     = canvas.Viewport.Zoom;
                int      num      = 255;
                if (zoom < 1f)
                {
                    float num2 = (zoom - 0.5f) * 2f;
                    num = (int)((float)num * num2);
                }
                if (num < 0)
                {
                    num = 0;
                }
                num = GH_Canvas.ZoomFadeLow;
                SolidBrush   brush        = new SolidBrush(Color.FromArgb(num, 90, 90, 90));
                SolidBrush   brush2       = new SolidBrush(Color.FromArgb(num, 150, 150, 150));
                SolidBrush   brush3       = new SolidBrush(Color.FromArgb(num, 0, 0, 0));
                SolidBrush   brush4       = new SolidBrush(Color.FromArgb(num, 255, 255, 255));
                Pen          pen          = new Pen(brush3);
                StringFormat stringFormat = new StringFormat();
                stringFormat.Alignment = StringAlignment.Center;
                if (Empty)
                {
                    PointF point = new PointF(base.CanvasPivot.X + base.Width / 2f, base.CanvasBounds.Y + 2f);
                    graphics.DrawRectangle(pen, GH_Attr_Widget.Convert(base.CanvasBounds));
                    graphics.FillRectangle(brush2, base.CanvasBounds);
                    graphics.DrawString(_emptyText, WidgetServer.Instance.DropdownFont, brush, point, stringFormat);
                }
                else
                {
                    PointF point2 = new PointF(base.CanvasPivot.X + (base.Width - 10f) / 2f, base.CanvasBounds.Y + 2f);
                    graphics.DrawRectangle(pen, GH_Attr_Widget.Convert(base.CanvasBounds));
                    graphics.FillRectangle(brush4, base.CanvasBounds);
                    graphics.DrawString(_items[current_value].content, WidgetServer.Instance.DropdownFont, brush3, point2, stringFormat);
                    Rectangle rect = new Rectangle((int)(base.CanvasPivot.X + base.Width - 10f), (int)base.CanvasPivot.Y, 10, (int)base.Height);
                    graphics.FillRectangle(brush4, rect);
                    graphics.DrawRectangle(pen, rect);
                }
            }
        }
示例#5
0
        public void MakeAllInActive()
        {
            int count = _controls.Count;

            for (int i = 0; i < count; i++)
            {
                if (_controls[i] is MenuPanel)
                {
                    ((MenuPanel)_controls[i])._activeControl = null;
                }
            }
            _activeControl = null;
        }
        public override GH_Attr_Widget IsTtipPoint(PointF pt)
        {
            int count = _buttons.Count;

            for (int i = 0; i < count; i++)
            {
                GH_Attr_Widget gH_Attr_Widget = _buttons[i].IsTtipPoint(pt);
                if (gH_Attr_Widget != null)
                {
                    return(gH_Attr_Widget);
                }
            }
            return(null);
        }
示例#7
0
 public override GH_ObjectResponse RespondToMouseUp(GH_Canvas sender, GH_CanvasMouseEvent e)
 {
     if (_activeControl != null)
     {
         GH_ObjectResponse val = _activeControl.RespondToMouseUp(sender, e);
         if ((int)val == 2)
         {
             _activeControl = null;
             return(val);
         }
         if ((int)val != 0)
         {
             return(val);
         }
         _activeControl = null;
     }
     return(0);
 }
示例#8
0
        public GH_Attr_Widget IsTtipPoint(PointF pt)
        {
            if (_activeWidget != null)
            {
                return(null);
            }
            int count = _menus.Count;

            for (int i = 0; i < count; i++)
            {
                GH_Attr_Widget gH_Attr_Widget = _menus[i].IsTtipPoint(pt);
                if (gH_Attr_Widget != null)
                {
                    return(gH_Attr_Widget);
                }
            }
            return(null);
        }
示例#9
0
        public override GH_ObjectResponse RespondToMouseDown(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            if (_headBounds.Contains(e.CanvasLocation))
            {
                if (Expanded)
                {
                    _activeControl = null;
                }
                _expanded = !_expanded;

                Layout();  //daq =)

                return(GH_ObjectResponse.Handled);
            }
            if (_expanded)
            {
                if (_contentBounds.Contains(e.CanvasLocation))
                {
                    for (int i = 0; i < inputs.Count; i++)
                    {
                        if (inputs[i].Parameter.Attributes.Bounds.Contains(e.CanvasLocation))
                        {
                            return(inputs[i].Parameter.Attributes.RespondToMouseDown(sender, e));
                        }
                    }
                    for (int j = 0; j < _controls.Count; j++)
                    {
                        if (_controls[j].Contains(e.CanvasLocation))
                        {
                            _activeControl = _controls[j];
                            return(_controls[j].RespondToMouseDown(sender, e));
                        }
                    }
                }
                else if (_activeControl != null)
                {
                    _activeControl.RespondToMouseDown(sender, e);
                    _activeControl = null;
                    return(GH_ObjectResponse.Handled);
                }
            }
            return(0);
        }
示例#10
0
        public override bool IsTooltipRegion(PointF pt)
        {
            _activeToolTip = null;
            bool flag = base.IsTooltipRegion(pt);

            if (flag)
            {
                return(flag);
            }
            if (base.m_innerBounds.Contains(pt))
            {
                GH_Attr_Widget gH_Attr_Widget = collection.IsTtipPoint(pt);
                if (gH_Attr_Widget != null)
                {
                    _activeToolTip = gH_Attr_Widget;
                    return(true);
                }
            }
            return(false);
        }
示例#11
0
 public override GH_Attr_Widget IsTtipPoint(PointF pt)
 {
     if (base.CanvasBounds.Contains(pt))
     {
         int count = _controls.Count;
         for (int i = 0; i < count; i++)
         {
             GH_Attr_Widget gH_Attr_Widget = _controls[i].IsTtipPoint(pt);
             if (gH_Attr_Widget != null)
             {
                 return(gH_Attr_Widget);
             }
         }
         if (_showToolTip)
         {
             return(this);
         }
     }
     return(null);
 }
示例#12
0
 public override GH_Attr_Widget IsTtipPoint(PointF pt)
 {
     if (_headBounds.Contains(pt))
     {
         return(this);
     }
     if (_expanded && _contentBounds.Contains(pt))
     {
         int count = _controls.Count;
         for (int i = 0; i < count; i++)
         {
             if (_controls[i].Contains(pt))
             {
                 GH_Attr_Widget gH_Attr_Widget = _controls[i].IsTtipPoint(pt);
                 if (gH_Attr_Widget != null)
                 {
                     return(gH_Attr_Widget);
                 }
             }
         }
     }
     return(null);
 }
示例#13
0
 public void AddControl(GH_Attr_Widget control)
 {
     control.Parent = this;
     _controls.Add(control);
 }
示例#14
0
 public override void Layout()
 {
     _content = GH_Attr_Widget.Convert(base.CanvasBounds);
     _drag    = new Rectangle((int)transformation.X, (int)transformation.Y + (int)_currentHight, (int)base.Width, (int)((double)base.Height * _ratio));
 }
示例#15
0
 public void AddControl(GH_Attr_Widget _control)
 {
     _controls.Add(_control);
     _control.Parent = this;
 }