Table of Contents

Class GuiElementScrollbar

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll
public class GuiElementScrollbar : GuiElementControl, IDisposable
Inheritance
GuiElementScrollbar
Implements
Derived
Inherited Members

Constructors

GuiElementScrollbar(ICoreClientAPI, Action<float>, ElementBounds)

Creates a new Scrollbar.

public GuiElementScrollbar(ICoreClientAPI capi, Action<float> onNewScrollbarValue, ElementBounds bounds)

Parameters

capi ICoreClientAPI

The client API.

onNewScrollbarValue Action<float>

The event that fires when the scrollbar is changed.

bounds ElementBounds

The bounds of the scrollbar.

Fields

DeafultScrollbarPadding

public static int DeafultScrollbarPadding

Field Value

int

DefaultScrollbarWidth

public static int DefaultScrollbarWidth

Field Value

int

currentHandleHeight

protected float currentHandleHeight

Field Value

float

currentHandlePosition

protected float currentHandlePosition

Field Value

float

handleTexture

protected LoadedTexture handleTexture

Field Value

LoadedTexture

mouseDownOnScrollbarHandle

public bool mouseDownOnScrollbarHandle

Field Value

bool

mouseDownStartY

public int mouseDownStartY

Field Value

int

onNewScrollbarValue

protected Action<float> onNewScrollbarValue

Field Value

Action<float>

totalHeight

protected float totalHeight

Field Value

float

visibleHeight

protected float visibleHeight

Field Value

float

zOffset

public float zOffset

Field Value

float

Properties

CurrentYPosition

The current Y position of the inner element

public float CurrentYPosition { get; set; }

Property Value

float

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

ScrollConversionFactor

Moving 1 pixel of the scrollbar moves the content by ScrollConversionFactor of pixels

public float ScrollConversionFactor { get; }

Property Value

float

Methods

ComposeElements(Context, ImageSurface)

Composes the elements.

public override void ComposeElements(Context ctxStatic, ImageSurface surface)

Parameters

ctxStatic Context

The context of the components.

surface ImageSurface

The 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

posX double
posY double

OnKeyDown(ICoreClientAPI, KeyEvent)

The event fired when a key is held down.

public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The client API

args KeyEvent

The 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 ICoreClientAPI

The Client API

args MouseEvent

The mouse event args.

OnMouseMove(ICoreClientAPI, MouseEvent)

The event fired when the mouse is moved.

public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The mouse event arguments.

OnMouseUp(ICoreClientAPI, MouseEvent)

The event fired when the mouse is released.

public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The 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 ICoreClientAPI

The Client API

args MouseWheelEventArgs

The 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 float

The 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 float

The visible height of the scrollbar

totalHeight float

The total height of the scrollbar.

SetNewTotalHeight(float)

Sets the total height, recalculating things for the new height.

public void SetNewTotalHeight(float totalHeight)

Parameters

totalHeight float

The 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()