Esempio n. 1
0
 public override void SetValue(string valueIn, bool record = true)
 {
     if (record)
     {
         Target.RecordUndoEvent("Set the String");
     }
     ParamControlHelper.SetData <TGoo, string>(this, valueIn);
 }
        public override void Layout(RectangleF innerRect, RectangleF outerRect)
        {
            float      small = -2;
            RectangleF rect  = CanvasRenderEngine.MaxSquare(ParamControlHelper.ParamLayoutBase(this.Target.Attributes, Width, outerRect));

            rect.Inflate(small, small);
            this.Bounds = rect;
        }
Esempio n. 3
0
 public override void SetValue(bool valueIn, bool record = true)
 {
     if (record)
     {
         Target.RecordUndoEvent("Set the boolean");
     }
     ParamControlHelper.SetData <TGoo, bool>(this, valueIn);
 }
 public override void SetValue(double valueIn, bool record = true)
 {
     if (record)
     {
         Target.RecordUndoEvent("Set the Number");
     }
     ParamControlHelper.SetData <TGoo, double>(this, valueIn);
 }
 public override void SetValue(Color valueIn, bool record = true)
 {
     if (record)
     {
         Target.RecordUndoEvent("Set the Colour");
     }
     ParamControlHelper.SetData <TGoo, Color>(this, valueIn);
 }
Esempio n. 6
0
 public override void SetValue(int valueIn, bool record = true)
 {
     if (record)
     {
         Target.RecordUndoEvent("Set the Integer");
     }
     ParamControlHelper.SetData <TGoo, int>(this, valueIn);
 }
Esempio n. 7
0
 public static void IconRender <TGoo>(IAddObjectParam <TGoo> paramcontrol, GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) where TGoo : class, IGH_Goo
 {
     if (channel == GH_CanvasChannel.Objects)
     {
         if (paramcontrol.MyProxies.Length > 1)
         {
             ParamControlHelper.RenderParamButtonIcon(graphics, paramcontrol.Target.Icon_24x24, paramcontrol.IconButtonBound);
         }
         else if (paramcontrol.MyProxies.Length == 1)
         {
             ParamControlHelper.RenderParamButtonIcon(graphics, paramcontrol.MyProxies[0].Icon.GetIcon(!paramcontrol.Target.Locked, true), paramcontrol.IconButtonBound);
         }
     }
 }
Esempio n. 8
0
        public override bool GetValue(out bool isNull)
        {
            bool result;

            if (ParamControlHelper.GetData <TGoo, bool>(this, out _, out result))
            {
                isNull = false;
                return(result);
            }
            else
            {
                isNull = true;
                return(false);
            }
        }
        public override double GetValue(out bool isNull)
        {
            GH_ParamAccess access = GH_ParamAccess.item;
            double         result;

            if (ParamControlHelper.GetData(this, out access, out result))
            {
                this.Access = access;
                isNull      = false;
                return(result);
            }
            else
            {
                this.Access = access;
                isNull      = true;
                return(double.NaN);
            }
        }
Esempio n. 10
0
        public override string GetValue(out bool isNull)
        {
            GH_ParamAccess access = GH_ParamAccess.item;
            string         result;

            if (ParamControlHelper.GetData(this, out access, out result))
            {
                this.Access = access;
                isNull      = false;
                return(result);
            }
            else
            {
                this.Access = access;
                isNull      = true;
                return(LanguagableComponent.GetTransLation(new string[] { "Click Me To Set!", "点我以设置!" }));
            }
        }
        public override Color GetValue(out bool isNull)
        {
            GH_ParamAccess access = GH_ParamAccess.item;
            Color          result;

            if (ParamControlHelper.GetData(this, out access, out result))
            {
                this.Access = access;
                isNull      = false;
                return(result);
            }
            else
            {
                this.Access = access;
                isNull      = true;
                return(Color.Transparent);
            }
        }
Esempio n. 12
0
        public static void ParamMouseDown <TGoo>(IAddObjectParam <TGoo> paramcontrol, Action <GH_Canvas, GH_CanvasMouseEvent> mouseEvent, object sender, MouseEventArgs e, bool isInputSide, float leftMove = 100, string init = null)
            where TGoo : class, IGH_Goo
        {
            GH_Viewport vp = Grasshopper.Instances.ActiveCanvas.Viewport;

            if (vp.Zoom >= 0.5f)
            {
                PointF mouseLoc = vp.UnprojectPoint(e.Location);
                if (paramcontrol.Bounds.Contains(mouseLoc))
                {
                    mouseEvent.Invoke(Grasshopper.Instances.ActiveCanvas, new GH_CanvasMouseEvent(vp, e));
                }
                else
                {
                    ParamControlHelper.AddObjectMouseDown(vp, paramcontrol, sender, e, isInputSide, leftMove, init);
                }
            }
        }
 protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
 {
     ParamControlHelper.IconRender(this, canvas, graphics, channel);
     base.Render(canvas, graphics, channel);
 }
 protected override bool IsRender(GH_Canvas canvas, Graphics graphics, bool renderLittleZoom = false)
 {
     return(ParamControlHelper.IsRender(this, canvas, graphics, renderLittleZoom) && base.IsRender(canvas, graphics, renderLittleZoom));
 }
Esempio n. 15
0
 public override void Layout(RectangleF innerRect, RectangleF outerRect)
 {
     this.Bounds = ParamControlHelper.UpDownSmallRect(ParamControlHelper.ParamLayoutBase(this.Target.Attributes, Width, outerRect, inflate: false));
 }
 public void RespondToMouseDown(object sender, MouseEventArgs e)
 {
     ParamControlHelper.ParamMouseDown(this, this.RespondToMouseUp, sender, e, true, init: initStr);
 }
Esempio n. 17
0
 public void RespondToMouseDown(object sender, MouseEventArgs e)
 {
     ParamControlHelper.AddObjectMouseDown(this, sender, e, false, init: initStr);
 }