Ejemplo n.º 1
0
 /// <summary>
 /// Widget for scrolling parent's layout with a sidebar.
 /// </summary>
 /// <param name="side">Side where to adjoin sidebar</param>
 public ScrollBar(Direction side = Direction.Right, int width = 1, ScrollBarStyle style = null)
     : base(0, 0, 0, 0, new UIConfiguration(), style ?? new ScrollBarStyle())
 {
     Layer    = Int32.MaxValue - 1;
     Vertical = side == Direction.Left || side == Direction.Right;
     _Width   = width;
     if (Vertical)
     {
         Width = width;
         SetFullSize(FullSize.Vertical);
         if (side == Direction.Left)
         {
             SetAlignmentInParent(Alignment.Left);
         }
         else
         {
             SetAlignmentInParent(Alignment.Right);
         }
         SetupLayout(Alignment.Up, Direction.Up, Side.Center, null, 0);
     }
     else
     {
         Height = width;
         SetFullSize(FullSize.Horizontal);
         if (side == Direction.Up)
         {
             SetAlignmentInParent(Alignment.Up);
         }
         else
         {
             SetAlignmentInParent(Alignment.Down);
         }
         SetupLayout(Alignment.Left, Direction.Left, Side.Center, null, 0);
     }
     Empty1 = AddToLayout(new Separator(0)) as Separator;
     Empty1.Configuration.UseBegin = false;
     // Adding ScrollBackground with 0 layer.
     Slider = AddToLayout(new ScrollBackground(false, true, true, ScrollAction), 0) as ScrollBackground;
     Empty2 = AddToLayout(new Separator(0)) as Separator;
     Empty2.Configuration.UseBegin = false;
     Slider.SetFullSize(FullSize.None);
     Slider.Style.WallColor = ScrollBarStyle.SliderColor;
     if (Style.WallColor == null)
     {
         Style.WallColor = 0;
     }
 }
Ejemplo n.º 2
0
 public ScrollBarStyle(ScrollBarStyle style) : base(style)
 {
     SliderColor = style.SliderColor;
 }