class GUITimeline

Base class that can be implemented by GUI elements needing to elements along draw a horizontal timeline.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

Returns type name of the GUI element used for finding GUI element styles.

SetRange

void SetRange(float range)

Determines the range of values to display on the timeline, in seconds.

GetRange

float GetRange() const

SetOffset

void SetOffset(float offset)

Determines the offset at which the displayed timeline values start at, in seconds.

GetOffset

float GetOffset() const

SetFps

void SetFps(u32 FPS)

Number of frames per second, used for frame selection and marking.

GetFps

u32 GetFps() const

SetMarkedFrame

void SetMarkedFrame(u32 index)

Frame to display the frame marker on.

Set to -1 to clear the frame marker.

SetMarkedFrame

u32 SetMarkedFrame() const

GetFrame

u32 GetFrame(const GUILogicalPoint &pixelCoords) const

Uses the assigned FPS, range and physical size to calculate the frame that is under the provided coordinates.

pixelCoords
Coordinates relative to this GUI element.

Returns: Frame that was clicked on, or -1 if the coordinates are outside of valid bounds.

GetTime

float GetTime(GUILogicalUnit pixel) const

Returns the time at the specified pixel value along the timeline.

pixel
X coordinate to sample at, relative to this GUI element in pixels.

Returns: Time along the curve at the specified coordinate.

GetOffset

GUILogicalUnit GetOffset(float time) const

Finds the pixel offset relative to the GUI element's origin for the specified time.

time
Time value to return the offset for.

Returns: Offset in pixels relative to GUI element's origin

GetTimeForFrame

float GetTimeForFrame(i32 index) const

Returns time for a frame with the specified index.

Depends on set range and FPS.

index
Index of the frame (not a key-frame) to get the time for.

Returns: Time of the frame with the provided index.

SetPadding

void SetPadding(GUILogicalUnit padding)

Sets the size of padding to apply to the left and right sides of the curve drawing, in pixels.

GetPadding2

GUILogicalUnit GetPadding2() const

Internal

Methods

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

Calculates the optimal size for the GUI element, ignoring size constraints.

Protected

Constructors

GUITimeline

GUITimeline(const String &styleName, const GUISizeConstraints &dimensions)

Methods

~GUITimeline

~GUITimeline() noexcept override = default

GetDrawableWidth

GUILogicalUnit GetDrawableWidth() const

Returns the width of the GUI element that can be drawn to (width minus padding).

GetRangeWithPadding

float GetRangeWithPadding() const

Similar to getRange() but expands the range so it's expanded to encompas the right-most padding area.

DrawFrameMarker

void DrawFrameMarker(float t)

Draws a vertical frame marker at the specified time.

DrawFrameMarker

void DrawFrameMarker()

Draws a frame marker at the currently selected frame.

UpdateLayoutForChildren

void UpdateLayoutForChildren() override

Calculates sizes and relative positions for all child elements.

Should be preceded with a call to UpdateOptimalLayoutSizes().

NotifyStyleChanged

void NotifyStyleChanged() override

Method that gets triggered whenever element style changes.

Fields

mCanvas

GUICanvas * mCanvas

mBackground

GUITexture * mBackground

mRange

float mRange

mOffset

float mOffset

mFPS

u32 mFPS

mMarkedFrame

u32 mMarkedFrame

mPadding

GUILogicalUnit mPadding