Class GuiElementScrollbar
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
public class GuiElementScrollbar : GuiElementControl, IDisposable
- Inheritance
-
GuiElementScrollbar
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GuiElementScrollbar(ICoreClientAPI, Action<float>, ElementBounds)
Creates a new Scrollbar.
public GuiElementScrollbar(ICoreClientAPI capi, Action<float> onNewScrollbarValue, ElementBounds bounds)
Parameters
capi
ICoreClientAPIThe client API.
onNewScrollbarValue
Action<float>The event that fires when the scrollbar is changed.
bounds
ElementBoundsThe bounds of the scrollbar.
Fields
DeafultScrollbarPadding
public static int DeafultScrollbarPadding
Field Value
DefaultScrollbarWidth
public static int DefaultScrollbarWidth
Field Value
currentHandleHeight
protected float currentHandleHeight
Field Value
currentHandlePosition
protected float currentHandlePosition
Field Value
handleTexture
protected LoadedTexture handleTexture
Field Value
mouseDownOnScrollbarHandle
public bool mouseDownOnScrollbarHandle
Field Value
mouseDownStartY
public int mouseDownStartY
Field Value
onNewScrollbarValue
protected Action<float> onNewScrollbarValue
Field Value
totalHeight
protected float totalHeight
Field Value
visibleHeight
protected float visibleHeight
Field Value
zOffset
public float zOffset
Field Value
Properties
CurrentYPosition
The current Y position of the inner element
public float CurrentYPosition { get; set; }
Property Value
Focusable
Whether or not the element can be focused.
public override bool Focusable { get; }
Property Value
ScrollConversionFactor
Moving 1 pixel of the scrollbar moves the content by ScrollConversionFactor of pixels
public float ScrollConversionFactor { get; }
Property Value
Methods
ComposeElements(Context, ImageSurface)
Composes the elements.
public override void ComposeElements(Context ctxStatic, ImageSurface surface)
Parameters
ctxStatic
ContextThe context of the components.
surface
ImageSurfaceThe surface of the GUI.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
EnsureVisible(double, double)
public void EnsureVisible(double posX, double posY)
Parameters
OnKeyDown(ICoreClientAPI, KeyEvent)
The event fired when a key is held down.
public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)
Parameters
api
ICoreClientAPIThe client API
args
KeyEventThe key event arguments.
OnMouseDownOnElement(ICoreClientAPI, MouseEvent)
The event fired when the mouse is pressed while on the element. Called after OnMouseDown and tells the engine that the event is handled.
public override void OnMouseDownOnElement(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API
args
MouseEventThe mouse event args.
OnMouseMove(ICoreClientAPI, MouseEvent)
The event fired when the mouse is moved.
public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API.
args
MouseEventThe mouse event arguments.
OnMouseUp(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released.
public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API.
args
MouseEventThe arguments for the mouse event.
OnMouseWheel(ICoreClientAPI, MouseWheelEventArgs)
The event fired when the mouse wheel is scrolled.
public override void OnMouseWheel(ICoreClientAPI api, MouseWheelEventArgs args)
Parameters
api
ICoreClientAPIThe Client API
args
MouseWheelEventArgsThe mouse wheel arguments.
RecomposeHandle()
public virtual void RecomposeHandle()
RenderInteractiveElements(float)
Renders the element as an interactive element.
public override void RenderInteractiveElements(float deltaTime)
Parameters
deltaTime
floatThe change in time.
ScrollToBottom()
Puts the scrollblock to the very bottom of the scrollbar.
public void ScrollToBottom()
SetHeights(float, float)
Sets the height of the scrollbar.
public void SetHeights(float visibleHeight, float totalHeight)
Parameters
visibleHeight
floatThe visible height of the scrollbar
totalHeight
floatThe total height of the scrollbar.
SetNewTotalHeight(float)
Sets the total height, recalculating things for the new height.
public void SetNewTotalHeight(float totalHeight)
Parameters
totalHeight
floatThe total height of the scrollbar.
SetScrollbarPosition(int)
public void SetScrollbarPosition(int pos)
Parameters
pos
int
TriggerChanged()
Triggers the change to the new value of the scrollbar.
public void TriggerChanged()