internal ScrollBar(ScrollableWidget parent, Color backgroundColor, Color thumbViewColor, Orientation orientation = Orientation.Vertical) { parentScrollWidget = parent; this.background = new GuiWidget() { BackgroundColor = backgroundColor }; thumb = new ThumDragWidget(orientation) { BackgroundColor = thumbViewColor }; thumb.SizeChanged += (s, e) => { thumb.BackgroundRadius = new RadiusCorners(thumb.Width / 2); }; AddChild(background); AddChild(thumb); this.Margin = ScrollBar.DefaultMargin; parentScrollWidget.BoundsChanged += Bounds_Changed; parentScrollWidget.ScrollArea.BoundsChanged += Bounds_Changed; parentScrollWidget.ScrollPositionChanged += Bounds_Changed; parentScrollWidget.ScrollArea.MarginChanged += Bounds_Changed; UpdateScrollBar(); }
internal ScrollBar(ScrollableWidget parent, GuiWidget background, GuiWidget thumbView, Orientation orientation = Orientation.Vertical) { ParentScrollWidget = parent; this.background = background; thumb = new ThumDragWidget(orientation); thumb.AddChild(thumbView); AddChild(background); AddChild(thumb); this.Margin = ScrollBar.DefaultMargin; ParentScrollWidget.BoundsChanged += Bounds_Changed; ParentScrollWidget.ScrollArea.BoundsChanged += Bounds_Changed; ParentScrollWidget.ScrollPositionChanged += Bounds_Changed; ParentScrollWidget.ScrollArea.MarginChanged += Bounds_Changed; UpdateScrollBar(); }
internal ScrollBar(ScrollableWidget parent, GuiWidget background, GuiWidget thumbView, Orientation orientation = Orientation.Vertical) { ParentScrollWidget = parent; this.background = background; thumb = new ThumDragWidget(orientation); thumb.AddChild(thumbView); background.BackgroundColor = RGBA_Bytes.LightGray; AddChild(background); AddChild(thumb); BackgroundColor = RGBA_Bytes.Blue; ParentScrollWidget.BoundsChanged += new EventHandler(Parent_BoundsChanged); ParentScrollWidget.ScrollArea.BoundsChanged += new EventHandler(ScrollArea_BoundsChanged); ParentScrollWidget.ScrollPositionChanged += new EventHandler(scrollWidgeContainingThis_ScrollPositionChanged); ParentScrollWidget.ScrollArea.MarginChanged += new EventHandler(ScrollArea_MarginChanged); UpdateScrollBar(); }