public VendorBuyGump(AEntity vendorBackpack, VendorBuyListPacket packet) : base(0, 0) { // sanity checking: don't show buy gumps for empty containers. if (!(vendorBackpack is Container) || ((vendorBackpack as Container).Contents.Count <= 0) || (packet.Items.Count <= 0)) { Dispose(); return; } IsMoveable = true; // note: original gumplings start at index 0x0870. AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false)); AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>Shop Inventory")); m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this)); AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar)); BuildShopContents(vendorBackpack, packet); AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty)); UpdateCost(); Button okButton = (Button)AddControl(new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0)); okButton.GumpOverID = 0x909; okButton.MouseClickEvent += okButton_MouseClickEvent; }
public ScrollArea(int x, int y, int w, int h, bool normalScrollbar) { X = x; Y = y; Width = w; Height = h; if (normalScrollbar) { _scrollBar = new ScrollBar(this, Width - 14, 0, Height); } else { _scrollBar = new ScrollFlag(this) { X = Width - 14, Height = h }; } _scrollBar.MinValue = 0; _scrollBar.MaxValue = Height; AcceptMouseInput = false; WantUpdateSize = false; }
/// <summary> /// Initialize scrollbar properties from header and footer size and total size of lines in body. /// </summary> public override void UpdateScrollBar() { IScrollBar sb = ScrollBar; //sb.BeginUpdate(); // Adjust Scroll Position when header row or column is resized. SetHeaderLineCount(HeaderLineCount); SetFooterLineCount(FooterLineCount); double delta = HeaderExtent - sb.Minimum; double oldValue = sb.Value; sb.Minimum = HeaderExtent; sb.Maximum = Distances.TotalDistance - FooterExtent; sb.SmallChange = Distances.DefaultDistance; double proposeLargeChange = ScrollPageSize; sb.LargeChange = proposeLargeChange; // SH - Added check for delta != 0 to avoid value being reset when // you resize grid such that only header columns are visible and then // resize back to larger size. // SH 6/22 - Commented out change to sb.Value and also modified ScrollInfo.Value to // return Math.Max(minimum, Math.Min(maximum - largeChange, value)); // instead. //if (proposeLargeChange >= 0) // sb.Value = Math.Max(sb.Minimum, Math.Min(sb.Maximum - sb.LargeChange, sb.Value + delta)); if (proposeLargeChange >= 0 && delta != 0) { sb.Value = oldValue + delta; } //sb.EndUpdate(); }
public ScrollArea(int x, int y, int w, int h, bool normalScrollbar, int scrollbarHeight = -1) { X = x; Y = y; Width = w; Height = h; _isNormalScroll = normalScrollbar; _scrollbarHeight = scrollbarHeight; if (normalScrollbar) { _scrollBar = new ScrollBar(Width - 14, 0, Height); } else { _scrollBar = new ScrollFlag() { X = Width - 19, Height = h }; Width = Width + 15; } if (scrollbarHeight < 0) { scrollbarHeight = Height; } _scrollBar.MinValue = 0; _scrollBar.MaxValue = scrollbarHeight; Add((Control)_scrollBar); AcceptMouseInput = true; WantUpdateSize = false; CanMove = true; }
public JournalGump() : base(0, 0) { IsMoveable = true; AddControl(m_Background = new ExpandableScroll(this, 0, 0, 300)); m_Background.TitleGumpID = 0x82A; m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this)); AddControl(m_JournalEntries = new RenderedTextList(this, 30, 36, 242, 200, m_ScrollBar)); }
/// <summary> /// Creates a RenderedTextList. /// Note that the scrollBarControl must be created and added to the parent gump before passing it as a param. /// </summary> public RenderedTextList(AControl parent, int x, int y, int width, int height, IScrollBar scrollBarControl) : base(parent) { _scrollBar = scrollBarControl; _scrollBar.IsVisible = false; HandlesMouseInput = true; Position = new Vector2Int(x, y); Width = width; Height = height; _entries = new List <RenderedText>(); }
public RenderedTextList(int x, int y, int width, int height, IScrollBar scrollBarControl) { _scrollBar = scrollBarControl; _scrollBar.IsVisible = false; AcceptMouseInput = false; X = x; Y = y; Width = width; Height = height; _entries = new List <RenderedText>(); }
public void Run() { IWindow window = factory.CreateWidget <IWindow>(); IScrollBar scrollBar = factory.CreateWidget <IScrollBar>(); window.SetScrollbars(scrollBar, scrollBar); window.Open(); window.VerticalScrollBar.ScrollDown(10); window.Close(); }
/// <summary> /// Initializes a new instance of the <see cref="LineScrollAxis"/> class. /// </summary> /// <param name="sb">The state of the scrollbar.</param> /// <param name="scrollLinesHost">The scroll lines host.</param> public LineScrollAxis(IScrollBar sb, ILineSizeHost scrollLinesHost) : base(sb, scrollLinesHost) { var distancesHost = scrollLinesHost as IDistancesHost; distances = distancesHost != null ? distancesHost.Distances : new DistanceRangeCounterCollection(); if (scrollLinesHost != null) { scrollLinesHost.InitializeScrollAxis(this); } distances.DefaultDistance = 1.0; }
public MyMemoEditScrollBarViewInfo(IScrollBar SB) : base(SB) { if (ScrollBarType == ScrollBarType.Horizontal) { fWidth = SystemInformation.HorizontalScrollBarArrowWidth; } else { fWidth = SystemInformation.VerticalScrollBarArrowHeight; } }
/// <summary> /// Creates a RenderedTextList. /// Note that the scrollBarControl must be created and added to the parent gump before passing it as a param. /// </summary> public RenderedTextList(AControl parent, int x, int y, int width, int height, IScrollBar scrollBarControl) : base(parent) { m_ScrollBar = scrollBarControl; m_ScrollBar.IsVisible = false; HandlesMouseInput = true; Position = new Point(x, y); Width = width; Height = height; m_Entries = new List<RenderedText>(); }
/// <summary> /// Initializes a new instance of the <see cref="PixelScrollAxis"/> class which /// is nested as a single line in a parent scroll axis. /// </summary> /// <param name="parentScrollAxis">The parent scroll axis.</param> /// <param name="sb">The scrollbar state.</param> /// <param name="scrollLinesHost">The scroll lines host.</param> /// <param name="distancesHost">The distances host.</param> public PixelScrollAxis(ScrollAxisBase parentScrollAxis, IScrollBar sb, ILineSizeHost scrollLinesHost, IDistancesHost distancesHost) : base(sb, scrollLinesHost) { // GridCellGridRenderer passes in Distances. LineSizeCollection holds them. // This allows faster construction of grids when they were scrolled out of view // and unloaded. this.parentScrollAxis = parentScrollAxis; this.distancesHost = distancesHost; if (Distances == null) { throw new ArgumentNullException("Distances"); } }
public RenderedTextList(int x, int y, int width, int height, IScrollBar scrollBarControl) { _scrollBar = scrollBarControl; _scrollBar.IsVisible = false; AcceptMouseInput = true; CanMove = true; X = x; Y = y; Width = width; Height = height; _entries = new Deque <RenderedText>(); _hours = new Deque <RenderedText>(); WantUpdateSize = false; }
private void Init() { background.Alpha = 0f; scrollBar = CreateChild <UguiScrollBar>("scrollbar", 1); { scrollBar.Anchor = AnchorType.RightStretch; scrollBar.Pivot = PivotType.Right; scrollBar.SetOffsetVertical(0f); scrollBar.X = 0f; scrollBar.Width = 2f; scrollBar.Direction = Scrollbar.Direction.BottomToTop; } VerticalScrollbar = scrollBar; }
/// <summary> /// Initialize scrollbar properties from line count in header, footer and body. /// </summary> public override void UpdateScrollBar() { SetHeaderLineCount(HeaderLineCount); SetFooterLineCount(FooterLineCount); IScrollBar sb = ScrollBar; bool isMinimum = sb.Minimum == sb.Value; sb.Minimum = HeaderLineCount; var maximum = distances.TotalDistance - FooterLineCount - 1; sb.Maximum = Math.Max(maximum, 0); sb.SmallChange = 1; sb.LargeChange = DetermineLargeChange(); sb.Value = isMinimum ? sb.Minimum : Math.Max(sb.Minimum, Math.Min(sb.Maximum, sb.Value)); }
public VendorSellGump(VendorSellListPacket packet) : base(0, 0) { IsMoveable = true; // note: original gumplings start at index 0x0870. AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false)); AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>My Inventory")); m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this)); AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar)); BuildShopContents(packet); AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty)); UpdateEntryAndCost(); AddControl(m_OKButton = new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0)); m_OKButton.GumpOverID = 0x909; m_OKButton.MouseClickEvent += okButton_MouseClickEvent; }
public VendorSellGump(VendorSellListPacket packet) : base(0, 0) { IsMoveable = true; // note: original gumplings start at index 0x0870. AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false)); AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>My Inventory")); m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this)); AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar)); BuildShopContents(packet); AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty)); UpdateCost(); Button okButton = (Button)AddControl(new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0)); okButton.GumpOverID = 0x909; okButton.MouseClickEvent += okButton_MouseClickEvent; }
/// <summary> /// Initializes a new instance of the <see cref="PixelScrollAxis"/> class. /// </summary> /// <param name="sb">The scrollbar state.</param> /// <param name="scrollLinesHost">The scroll lines host.</param> /// <param name="distancesHost">The distances host.</param> public PixelScrollAxis(IScrollBar sb, ILineSizeHost scrollLinesHost, IDistancesHost distancesHost) : base(sb, scrollLinesHost) { if (distancesHost != null) { this.distancesHost = distancesHost; } else if (scrollLinesHost != null) { this.distances = new DistanceRangeCounterCollection { DefaultDistance = scrollLinesHost.GetDefaultLineSize() }; scrollLinesHost.InitializeScrollAxis(this); } if (Distances == null) { throw new ArgumentNullException("Distances"); } }
void BuildGumpling(int x, int y, int width, int height, int background, int scrollbar, string text) { Position = new Point(x, y); base.Width = width; Size = new Point(width, height); HasBackground = (background == 1) ? true : false; HasScrollbar = (scrollbar != 0) ? true : false; UseFlagScrollbar = (HasScrollbar && scrollbar == 2) ? true : false; m_RenderedText = new RenderedText(text, width - (HasScrollbar ? 15 : 0) - (HasBackground ? 8 : 0)); if (HasBackground) { this.AddControl(new ResizePic(this, 0, 0, 0x2486, Width - (HasScrollbar ? 15 : 0), Height)); LastControl.HandlesMouseInput = false; } if (HasScrollbar) { if (UseFlagScrollbar) { AddControl(new ScrollFlag(this)); m_Scrollbar = LastControl as IScrollBar; m_Scrollbar.Position = new Point(Width - 14, 0); } else { AddControl(new ScrollBar(this)); m_Scrollbar = LastControl as IScrollBar; m_Scrollbar.Position = new Point(Width - 14, 0); } m_Scrollbar.Height = Height; m_Scrollbar.MinValue = 0; m_Scrollbar.MaxValue = m_RenderedText.Height - Height + (HasBackground ? 8 : 0); ScrollY = m_Scrollbar.Value; } if (Width != m_RenderedText.Width) { Width = m_RenderedText.Width; } }
public ScrollArea(int x, int y, int w, int h, bool normalScrollbar) { X = x; Y = y; Width = w; Height = h; if (normalScrollbar) { _scrollBar = new ScrollBar(this, Width - 14, 0, Height); } else { _scrollBar = new ScrollFlag(this) { X = Width - 14, Height = h } }; _scrollBar.MinValue = 0; _scrollBar.MaxValue = Height; IgnoreParentFill = true; AcceptMouseInput = false; }
void buildGumpling(int x, int y, int width, int height, int background, int scrollbar, string text) { Position = new Point(x, y); base.Width = width; Size = new Point(width, height); HasBackground = (background == 1) ? true : false; HasScrollbar = (scrollbar != 0) ? true : false; UseFlagScrollbar = (HasScrollbar && scrollbar == 2) ? true : false; m_RenderedText = new RenderedText(text, width - (HasScrollbar ? 15 : 0) - (HasBackground ? 8 : 0)); if (HasBackground) { this.AddControl(new ResizePic(this, 0, 0, 0x2486, Width - (HasScrollbar ? 15 : 0), Height)); LastControl.HandlesMouseInput = false; } if (HasScrollbar) { if (UseFlagScrollbar) { AddControl(new ScrollFlag(this)); m_Scrollbar = LastControl as IScrollBar; m_Scrollbar.Position = new Point(Width - 14, 0); } else { AddControl(new ScrollBar(this)); m_Scrollbar = LastControl as IScrollBar; m_Scrollbar.Position = new Point(Width - 14, 0); } m_Scrollbar.Height = Height; m_Scrollbar.MinValue = 0; m_Scrollbar.MaxValue = m_RenderedText.Height - Height + (HasBackground ? 8 : 0); ScrollY = m_Scrollbar.Value; } if (Width != m_RenderedText.Width) Width = m_RenderedText.Width; }
public Widget(IWidgetFactory widgetFactory) { _button = widgetFactory.CreateButton(); _scrollBar = widgetFactory.CreateScrollBar(); }
public void SetScrollbars(IScrollBar vertical, IScrollBar horizontal) { VerticalScrollBar = vertical; HorizontalScrollBar = horizontal; }
public InvertedScrollBarViewInfo(IScrollBar scrollBar) : base(scrollBar) { }
public void UpdateFunctionality(WorldEntity BehaviourOwner) { IScrollBar SB = (IScrollBar)BehaviourOwner; if (!SB.HideBar) { MouseState M = Mouse.GetState(); if (SB.Enabled) { Vector2 COffsetV = new Vector2(); Vector2 CZoomFactor = new Vector2(1, 1); if (!((WorldEntity)SB).CameraImmune) { if (((WorldEntity)SB).CustomCamera != null) { COffsetV = ((WorldEntity)SB).CustomCamera.OffsetVector; CZoomFactor = ((WorldEntity)SB).CustomCamera.ZoomFactor; } else if (Shell.AutoCamera != null) { COffsetV = Shell.AutoCamera.OffsetVector; CZoomFactor = Shell.AutoCamera.ZoomFactor; } } Vector2 FullyAdjustedMouseCoords = new Vector2(); if (BehaviourOwner.UsePseudoMouse) { FullyAdjustedMouseCoords = BehaviourOwner.PseudoMouse - COffsetV; } else { FullyAdjustedMouseCoords = ((Shell.CoordNormalize(VNFUtils.ConvertPoint(M.Position) / CZoomFactor) - COffsetV)); } int MY = (int)FullyAdjustedMouseCoords.Y; if (M.ScrollWheelValue != LastMouseScroll && SB.DetectScrollRectangle.Contains(FullyAdjustedMouseCoords) && !SB.Engaged) { if (((WorldEntity)SB).DrawCoords.Y >= SB.MinHeight && ((WorldEntity)SB).DrawCoords.Y <= SB.MaxHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, ((WorldEntity)SB).DrawCoords.Y + -(int)(((float)(M.ScrollWheelValue - LastMouseScroll) * (float)(SB.ScrollFrameHeight)) / (2 * (float)SB.TotalScrollHeight)))); } if (((WorldEntity)SB).DrawCoords.Y < SB.MinHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, SB.MinHeight)); } else if (((WorldEntity)SB).DrawCoords.Y > SB.MaxHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, SB.MaxHeight)); } } LastMouseScroll = M.ScrollWheelValue; if (SB.Engaged) { ((WorldEntity)SB).SetAtlasFrame(new Point(2, ((WorldEntity)SB).AtlasCoordinates.Y)); if (MY < SB.MinHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, SB.MinHeight)); } else if (MY > SB.MaxHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, SB.MaxHeight)); } else if (MY >= SB.MinHeight && MY <= SB.MaxHeight) { ((WorldEntity)SB).QuickMoveTo(new Vector2(((WorldEntity)SB).DrawCoords.X, MY)); } if (M.LeftButton != ButtonState.Pressed) { SB.Engaged = false; } } else { if (((WorldEntity)SB).MouseInBounds()) { ((WorldEntity)SB).SetAtlasFrame(new Point(1, ((WorldEntity)SB).AtlasCoordinates.Y)); } else { ((WorldEntity)SB).SetAtlasFrame(new Point(0, ((WorldEntity)SB).AtlasCoordinates.Y)); } } } else { ((WorldEntity)SB).SetAtlasFrame(new Point(0, ((WorldEntity)SB).AtlasCoordinates.Y)); SB.Engaged = false; LastMouseScroll = M.ScrollWheelValue; } } }
/// <summary> /// is scrolled to maximal value /// </summary> /// <param name="scrollBar"></param> /// <returns></returns> public static bool IsMaximal(this IScrollBar scrollBar) { return(scrollBar.Value == scrollBar.MaximumValue || scrollBar.Value == -1); }
public MyScrollBarViewinfo(IScrollBar scrollBar) : base(scrollBar) { }
public void SetScrollBar(IScrollBar scrollBar) { ScrollBar = scrollBar; }