Exemple #1
0
        public override Visual ToVisual(SizeF panelSize)
        {
            if (_mouseRegions != null)
            {
                _mouseRegions.Clear();
            }
            var cvisuals = Controls.Select(c =>
            {
                var v = c.Item1.ToVisual(panelSize);
                if (c.Item1 == _selected)
                {
                    v = Visual.Styled(v, new VisualStyle(
                                          brush: new SolidBrush(Color.FromArgb(50, 150, 150, 255))));
                }
                if (c.Item2 != null)
                {
                    v = Visual.Clickable(v, _mouseRegions.Add(c));
                }
                return(v);
            });
            var flowSize = new SizeF(panelSize.Width - 8f, panelSize.Height - 8f);
            var visual   = Visual.Margin(
                Direction == VisualDirection.Horizontal ?
                (WrapAround ?
                 Visual.HFlow(VertAlign, flowSize, cvisuals.Select(v => Visual.Margin(v, 2f))) :
                 Visual.HStack(VertAlign, cvisuals.Select(v => Visual.Margin(v, left: 2f, right: 2f)))) :
                (WrapAround ?
                 Visual.VFlow(HorizAlign, flowSize, cvisuals.Select(v => Visual.Margin(v, 2f))) :
                 Visual.VStack(HorizAlign, cvisuals.Select(v => Visual.Margin(v, top: 2f, bottom: 2f)))),
                2f);

            return(Framed ? Visual.Frame(visual, FrameKind.RoundRectangle, true) : visual);
        }
Exemple #2
0
 public override Visual ToVisual(SizeF panelSize)
 {
     _mouseRegions.Clear();
     return(_active ?
            Visual.VStack(HAlign.Left, Items.Select((str, i) =>
     {
         var visual = Visual.Clickable(Visual.Label(str), _mouseRegions.Add(i));
         return i != _value ?
         visual :
         Visual.Styled(Visual.Frame(
                           Visual.Margin(visual, 2f),
                           FrameKind.RoundRectangle, true), SelectedStyle);
     })) :
            Visual.Clickable(
                Visual.Frame(
                    Visual.Margin(Visual.Label(Items [_value]), 2f),
                    FrameKind.Rectangle, false),
                _mouseRegions.Add(_value)));
 }
Exemple #3
0
 public override Visual ToVisual(SizeF panelSize)
 {
     _mouseRegions.Clear();
     return(Visual.VStack(HAlign.Left,
                          Items.Select(i =>
     {
         var visual = Visual.Clickable(i.ToVisual(), _mouseRegions.Add(i));
         return i != _highlighted ?
         visual :
         Visual.Styled(Visual.Frame(visual, FrameKind.RoundRectangle, true), SelectedStyle);
     }
                                       )));
 }
Exemple #4
0
        public override Visual ToVisual(SizeF panelSize)
        {
            _mouseRegions.Clear();
            var knobSize = new SizeF(BarSize.Width, BarSize.Width / 2f);

            return(Visual.Margin(
                       Visual.HStack(VAlign.Top,
                                     Visual.Clickable(
                                         Visual.Custom(BarSize, PaintBar),
                                         _mouseRegions.Add(ColorMap)),
                                     Visual.VPile(HAlign.Left, VAlign.Center,
                                                  ColorMap.Select(sp =>
                                                                  Tuple.Create(NormalizeKey(sp.Key),
                                                                               Visual.Clickable(
                                                                                   sp.Key == _selected ?
                                                                                   Visual.Styled(KnobVisual(sp.Value, knobSize), SelectedStyle) :
                                                                                   KnobVisual(sp.Value, knobSize),
                                                                                   _mouseRegions.Add(sp.Key))
                                                                               )
                                                                  )
                                                  )
                                     ),
                       top: knobSize.Height, bottom: knobSize.Height));
        }