public static ColorSlider Saturation(VisualDirection direction, float knobWidth, float minVisualLength, Color color, Reaction<float> changed) { return new ColorSlider (direction, knobWidth, minVisualLength, 0f, 1f, color.GetSaturation (), new [] { Color.White, VisualHelpers.ColorFromHSB (color.GetHue (), 1f, color.GetBrightness ()) }, changed); }
public static ColorSlider Brightness(VisualDirection direction, float knobWidth, float minVisualLength, Color color, Reaction <float> changed) { return(new ColorSlider(direction, knobWidth, minVisualLength, 0f, 1f, color.GetBrightness(), new[] { Color.Black, VisualHelpers.ColorFromHSB(color.GetHue(), color.GetSaturation(), 1f) }, changed)); }
public Connector(Control source, Connected target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind, VisualStyle style) : base(source, horizAlign, vertAlign) { Target = target; Kind = kind; ConnectorStyle = style; }
public _Connector(Visual visual, _Anchor target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind) : base(visual, horizAlign, vertAlign) { Target = target; Direction = direction; Kind = kind; }
public Connector(Control source, Connected target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind, VisualStyle style) : base(source, horizAlign, vertAlign) { Target = target; Kind = kind; ConnectorStyle = style; }
/// <summary> /// Draws a connector between visuals. The target visual must be wrapped by an /// anchor in order to draw a connector to it. /// </summary> public static Visual Connector(Visual visual, Visual target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind = ConnectorKind.Line) { if (!(target is _Anchor)) { throw new ArgumentException("Target visual must be surronded by an anchor", "target"); } return(new _Connector(visual, target as _Anchor, direction, horizAlign, vertAlign, kind)); }
/// <summary> /// Initializes a new pile. /// </summary> public _Pile(IEnumerable <Tuple <float, Visual> > items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign) : base(direction, horizAlign, vertAlign) { if (items.Any(t => t.Item1 < 0f || t.Item1 > 1f)) { throw new ArgumentException("The position value must be in range [0, 1]."); } Items = items.ToArray(); }
public static ColorSlider Hue(VisualDirection direction, float knobWidth, float minVisualLength, Color color, Reaction<float> changed) { return new ColorSlider (direction, knobWidth, minVisualLength, 0f, 1f, color.GetHue (), new [] { Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Violet, Color.Red }, changed); }
public static ColorSlider Hue(VisualDirection direction, float knobWidth, float minVisualLength, Color color, Reaction <float> changed) { return(new ColorSlider(direction, knobWidth, minVisualLength, 0f, 1f, color.GetHue(), new [] { Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Violet, Color.Red }, changed)); }
public Slider(VisualDirection direction, float knobWidth, float minVisualLength, float minValue, float maxValue, float value, Reaction<float> changed) { Direction = direction; KnobWidth = knobWidth; MinVisualLength = minVisualLength; MinValue = minValue; Range = maxValue - minValue; Value = value; Changed = changed; }
public Slider(VisualDirection direction, float knobWidth, float minVisualLength, float minValue, float maxValue, float value, Reaction <float> changed) { Direction = direction; KnobWidth = knobWidth; MinVisualLength = minVisualLength; MinValue = minValue; Range = maxValue - minValue; Value = value; Changed = changed; }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, IEnumerable<Tuple<Control, Reaction<Control>>> controls) { Direction = direction; HorizAlign = horizAlign; VertAlign = vertAlign; Framed = framed; WrapAround = wrapAround; Controls = new List<Tuple<Control, Reaction<Control>>> (controls); if (Controls.Select (TupleExt.Second).Any (r => r != null)) _mouseRegions = new MouseRegions<Tuple<Control, Reaction<Control>>> (); }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, IEnumerable <Tuple <Control, Reaction <Control> > > controls) { Direction = direction; HorizAlign = horizAlign; VertAlign = vertAlign; Framed = framed; WrapAround = wrapAround; Controls = new List <Tuple <Control, Reaction <Control> > > (controls); if (Controls.Select(TupleExt.Second).Any(r => r != null)) { _mouseRegions = new MouseRegions <Tuple <Control, Reaction <Control> > > (); } }
public ColorPicker(VisualDirection direction, float knobWidth, float minVisualLength, Color color, bool preview, Reaction<Color> changed) : base(preview ? direction : direction.Opposite (), HAlign.Left, VAlign.Top, true, false, Enumerable.Empty<Control> ()) { Changed = changed; _hue = ColorSlider.Hue (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeHue)); _saturation = ColorSlider.Saturation (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeSaturation)); _brightness = ColorSlider.Brightness (direction, knobWidth, minVisualLength, color, React.By<float> (ChangeBrightness)); var controls = EnumerableExt.Enumerate<Control> (_hue, _saturation, _brightness); var contents = preview ? EnumerableExt.Enumerate ( new Container (direction, HAlign.Center, VAlign.Center, false, false, new Container (direction.Opposite (), HAlign.Left, VAlign.Top, false, false, controls), Label.ColorPreview (() => _value, new SizeF (3.5f * knobWidth, 3.5f * knobWidth)))) : controls; Controls.AddRange (contents.Select (c => new Tuple<Control, Reaction<Control>> (c, null))); }
public ColorPicker(VisualDirection direction, float knobWidth, float minVisualLength, Color color, bool preview, Reaction <Color> changed) : base(preview ? direction : direction.Opposite(), HAlign.Left, VAlign.Top, true, false, Enumerable.Empty <Control> ()) { Changed = changed; _hue = ColorSlider.Hue(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeHue)); _saturation = ColorSlider.Saturation(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeSaturation)); _brightness = ColorSlider.Brightness(direction, knobWidth, minVisualLength, color, React.By <float> (ChangeBrightness)); var controls = EnumerableExt.Enumerate <Control> (_hue, _saturation, _brightness); var contents = preview ? EnumerableExt.Enumerate( new Container(direction, HAlign.Center, VAlign.Center, false, false, new Container(direction.Opposite(), HAlign.Left, VAlign.Top, false, false, controls), Label.ColorPreview(() => _value, new SizeF(3.5f * knobWidth, 3.5f * knobWidth)))) : controls; Controls.AddRange(contents.Select(c => new Tuple <Control, Reaction <Control> > (c, null))); }
public _Connector(Visual visual, _Anchor target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind) : base(visual, horizAlign, vertAlign) { Target = target; Direction = direction; Kind = kind; }
/// <summary> /// Initializes a new stack. /// </summary> public _Stack(IEnumerable<Visual> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign) : base(direction, horizAlign, vertAlign) { Items = items.ToArray (); }
public ColorSlider(VisualDirection direction, float knobWidth, float minVisualLength, float minValue, float maxValue, float value, Color[] colors, Reaction<float> changed) : base(direction, knobWidth, minVisualLength, minValue, maxValue, value, changed) { Colors = direction == VisualDirection.Horizontal ? colors : colors.Reverse ().ToArray (); }
public _Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign) { Direction = direction; HorizAlign = horizAlign; VertAlign = vertAlign; }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, params Control[] controls) : this(direction, horizAlign, vertAlign, framed, wrapAround, (IEnumerable<Control>)controls) { }
public _Flow(IEnumerable<Visual> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, SizeF containerSize) : base(direction, horizAlign, vertAlign) { Items = items.ToArray (); ContainerSize = containerSize; }
/// <summary> /// Draws a connector between visuals. The target visual must be wrapped by an /// anchor in order to draw a connector to it. /// </summary> public static Visual Connector(Visual visual, Visual target, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, ConnectorKind kind = ConnectorKind.Line) { if (!(target is _Anchor)) throw new ArgumentException ("Target visual must be surronded by an anchor", "target"); return new _Connector(visual, target as _Anchor, direction, horizAlign, vertAlign, kind); }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, params Control[] controls) : this(direction, horizAlign, vertAlign, framed, wrapAround, (IEnumerable <Control>)controls) { }
public _Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign) { Direction = direction; HorizAlign = horizAlign; VertAlign = vertAlign; }
/// <summary> /// Initializes a new stack. /// </summary> public _Stack(IEnumerable <Visual> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign) : base(direction, horizAlign, vertAlign) { Items = items.ToArray(); }
/// <summary> /// Initializes a new pile. /// </summary> public _Pile(IEnumerable<Tuple<float, Visual>> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign) : base(direction, horizAlign, vertAlign) { if (items.Any (t => t.Item1 < 0f || t.Item1 > 1f)) throw new ArgumentException ("The position value must be in range [0, 1]."); Items = items.ToArray (); }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, IEnumerable<Control> controls) : this(direction, horizAlign, vertAlign, framed, wrapAround, controls.Select (c => new Tuple<Control, Reaction<Control>> (c, null))) { }
/// <summary> /// Initializes a new stack. /// </summary> public _Stack(ISequence<Visual> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign) { Items = items; Direction = direction; HorizAlign = horizAlign; VertAlign = vertAlign; }
public _Ruler(VisualDirection direction) { Direction = direction; }
public _Flow(IEnumerable <Visual> items, VisualDirection direction, HAlign horizAlign, VAlign vertAlign, SizeF containerSize) : base(direction, horizAlign, vertAlign) { Items = items.ToArray(); ContainerSize = containerSize; }
public Container(VisualDirection direction, HAlign horizAlign, VAlign vertAlign, bool framed, bool wrapAround, IEnumerable <Control> controls) : this(direction, horizAlign, vertAlign, framed, wrapAround, controls.Select(c => new Tuple <Control, Reaction <Control> > (c, null))) { }
public _Ruler(VisualDirection direction) { Direction = direction; }
public static VisualDirection Opposite(this VisualDirection direction) { return(direction == VisualDirection.Horizontal ? VisualDirection.Vertical : VisualDirection.Horizontal); }
public ColorSlider(VisualDirection direction, float knobWidth, float minVisualLength, float minValue, float maxValue, float value, Color[] colors, Reaction <float> changed) : base(direction, knobWidth, minVisualLength, minValue, maxValue, value, changed) { Colors = direction == VisualDirection.Horizontal ? colors : colors.Reverse().ToArray(); }