public MacSpinButton(ISpinButtonEventSink eventSink, ApplicationContext context) : base(eventSink, context)
        {
            this.eventSink            = eventSink;
            formater                  = new NSNumberFormatter();
            stepper                   = new VibrancyStepper();
            input                     = new NSTextField();
            input.Formatter           = formater;
            input.DoubleValue         = 0;
            input.Alignment           = NSTextAlignment.Right;
            formater.NumberStyle      = NSNumberFormatterStyle.Decimal;
            stepper.Activated        += HandleStepperChanged;
            input.Changed            += HandleTextChanged;
            input.DoCommandBySelector = DoCommandBySelector;

            AutoresizesSubviews = true;

            AddSubview(input);
            AddSubview(stepper);
        }
        public MacSpinButton(ISpinButtonEventSink eventSink)
        {
            formater             = new NSNumberFormatter();
            stepper              = new NSStepper();
            input                = new RelativeTextField(stepper);
            input.Formatter      = formater;
            input.Alignment      = NSTextAlignment.Right;
            formater.NumberStyle = NSNumberFormatterStyle.Decimal;
            stepper.Activated   += (sender, e) => input.DoubleValue = stepper.DoubleValue;

            SetFrameSize(new System.Drawing.SizeF(55, 22));
            stepper.Frame = new System.Drawing.RectangleF(new System.Drawing.PointF(36, 0), new System.Drawing.SizeF(19, 22));
            input.Frame   = new System.Drawing.RectangleF(new System.Drawing.PointF(4, 0), new System.Drawing.SizeF(26, 22));

            AutoresizesSubviews      = true;
            stepper.AutoresizingMask = NSViewResizingMask.MinXMargin | NSViewResizingMask.MinYMargin;
            input.AutoresizingMask   = NSViewResizingMask.WidthSizable | NSViewResizingMask.MaxXMargin | NSViewResizingMask.MaxYMargin;

            AddSubview(input);
            AddSubview(stepper);
        }
Exemple #3
0
        public MacSpinButton(ISpinButtonEventSink eventSink, ApplicationContext context) : base(eventSink, context)
        {
            this.eventSink            = eventSink;
            formater                  = new NSNumberFormatter();
            stepper                   = new NSStepper();
            input                     = new RelativeTextField(stepper);
            input.Formatter           = formater;
            input.DoubleValue         = 0;
            input.Alignment           = NSTextAlignment.Right;
            formater.NumberStyle      = NSNumberFormatterStyle.Decimal;
            stepper.Activated        += HandleStepperChanged;;
            input.Changed            += HandleTextChanged;
            input.DoCommandBySelector = DoCommandBySelector;

            AutoresizesSubviews      = true;
            stepper.AutoresizingMask = NSViewResizingMask.MinXMargin;
            input.AutoresizingMask   = NSViewResizingMask.WidthSizable | NSViewResizingMask.MaxXMargin;

            AddSubview(input);
            AddSubview(stepper);
        }