coastline 0.0.4
Loading...
Searching...
No Matches
MenuWidget Class Reference

Front-end panel widget with text, sprites, animations, and input callbacks. More...

#include <frontend.h>

Public Member Functions

 MenuWidget ()
 Initialise inactive callbacks, default flags and position, and empty animation/link storage.
virtual ~MenuWidget ()
 Destroy embedded fonts and list storage without releasing borrowed screens or rectangles.
virtual int UpdateBlinkTimer ()
 Advance enabled image animation using elapsed milliseconds and mark widgets for redraw.
virtual bool Update ()
 Run a frame of the item.
virtual int BlitSurfaceById (int nImage, int x, int y)
 Blit a menu sprite's stored source rectangle at the supplied destination.
virtual void SetText (const char *pszText, unsigned dwTextFlags, unsigned char bStyle, const RECT *pRect)
 Copy text into font slot zero, measure it, and update widget bounds and text dimensions.
virtual void Initialize (MenuScreen *pOwner, float x, float y, unsigned dwItemFlags, unsigned dwSecondary, unsigned dwTertiary, int nMode, short nImage)
 Assign the parent screen and position, combine flag groups, and set the first sprite.
MenuScreen * GetScreen () const
MenuFont & GetFont (int index)
MenuItemList & GetItemList ()
unsigned GetFlags () const
void SetFlags (unsigned value)
 Replace primary widget flags without updating layout.
float GetX () const
float GetY () const
void SetX (float value)
 Store a horizontal position without updating bounds or font coordinates.
void SetY (float value)
 Store a vertical position without updating bounds or font coordinates.
void SetSpriteId (short value)
 Store the current sprite identifier without updating geometry.
short GetSpriteId () const
void SetAnimationSpriteId (int index, short value)
 Store a sprite identifier in one animation slot.
void SetImageMode (int value)
 Store the image-animation mode without resetting timers.
void SetImageRects (const RECT *rects)
 Replace the borrowed source-rectangle array used for custom animation frames.
void SetCustomFrameDurations (bool value)
 Select custom frame timings and per-frame source rectangles without initialising either.
void SetFrameDuration (int index, int value)
 Store a custom frame duration without changing animation progress.
short GetLinkedWidgetCount () const
short GetLinkedWidgetIndex (int index) const
void SetLinkedWidgetCount (short value)
 Store link count without initialising the corresponding link indices.
void SetLinkedWidgetIndex (int index, short value)
 Assign one linked widget index without changing link count.
LONG GetBoundsLeft () const
LONG GetBoundsTop () const
void SetBoundsLeft (LONG value)
 Store the left bound without updating other layout fields.
void SetBoundsTop (LONG value)
 Store the top bound without updating other layout fields.
void SetBoundsRight (LONG value)
 Store the right bound without updating other layout fields.
void SetBoundsBottom (LONG value)
 Store the bottom bound without updating other layout fields.
void SetUpdateCallback (int(*callback)(MenuWidget *))
 Install a widget-update callback without invoking it.
auto GetUpdateCallback () const
void SetActionCallback (int(*callback)(MenuActionWidget *))
 Install an activation callback without invoking it.
auto GetActionCallback () const
void SetIdleActionCallback (int(*callback)(MenuWidget *))
 Install an idle callback without invoking it.
void SetTextEditCompleteCallback (int(*callback)(MenuWidget *))
 Install a text-edit completion callback without invoking it.
auto GetTextEditCompleteCallback () const
void SetBeforeUpdateCallback (int(*callback)(MenuWidget *))
 Install a callback run by the panel before the widget update.
auto GetBeforeUpdateCallback () const
void SetAfterUpdateCallback (int(*callback)(MenuWidget *))
 Install a callback run by the panel after the widget update.
auto GetAfterUpdateCallback () const

Detailed Description

Front-end panel widget with text, sprites, animations, and input callbacks.

Direct setters do not validate values or rebuild related layout state. Referenced screens, rectangle arrays, and callbacks must remain valid while used by the widget.

Constructor & Destructor Documentation

◆ MenuWidget()

MenuWidget::MenuWidget ( )

Initialise inactive callbacks, default flags and position, and empty animation/link storage.

Image rectangles and text bounds require separate initialisation before their use.

Ghidra address:
BRD3D: 0x100476c0
Ghidra address:
BRGlide: 0x10040b10

◆ ~MenuWidget()

virtual MenuWidget::~MenuWidget ( )
virtual

Destroy embedded fonts and list storage without releasing borrowed screens or rectangles.

Ghidra address:
BRD3D: 0x100478c0
Ghidra address:
BRGlide: 0x10040d10

Member Function Documentation

◆ UpdateBlinkTimer()

virtual int MenuWidget::UpdateBlinkTimer ( )
virtual

Advance enabled image animation using elapsed milliseconds and mark widgets for redraw.

Custom frame durations control frame advancement; other animations request redraw after more than 60 ms.

Returns
One.
Ghidra address:
BRD3D: 0x100480a0
Ghidra address:
BRGlide: 0x100414f0

◆ Update()

virtual bool MenuWidget::Update ( )
virtual

Run a frame of the item.

Returns
Whether the item still runs.
Ghidra address:
BRD3D: 0x10048180
Ghidra address:
BRGlide: 0x100415d0

◆ BlitSurfaceById()

virtual int MenuWidget::BlitSurfaceById ( int nImage,
int x,
int y )
virtual

Blit a menu sprite's stored source rectangle at the supplied destination.

Parameters
nImageA valid menu sprite and image identifier.
xThe horizontal destination in menu pixels.
yThe vertical destination in menu pixels.
Returns
One, without propagating the underlying blit result.
Ghidra address:
BRD3D: 0x100479d0
Ghidra address:
BRGlide: 0x10040e20

◆ SetText()

virtual void MenuWidget::SetText ( const char * pszText,
unsigned dwTextFlags,
unsigned char bStyle,
const RECT * pRect )
virtual

Copy text into font slot zero, measure it, and update widget bounds and text dimensions.

Parameters
pszTextA non-null terminated label fitting MenuFont text storage, copied during the call.
dwTextFlagsFont flags combined with existing flags; bit zero centres measured text.
bStyleThe font style, with 3 selecting alternate-font measurement.
pRectNon-null borrowed bounds supplying horizontal menu-pixel limits.
Ghidra address:
BRD3D: 0x10047eb0
Ghidra address:
BRGlide: 0x10041300

◆ Initialize()

virtual void MenuWidget::Initialize ( MenuScreen * pOwner,
float x,
float y,
unsigned dwItemFlags,
unsigned dwSecondary,
unsigned dwTertiary,
int nMode,
short nImage )
virtual

Assign the parent screen and position, combine flag groups, and set the first sprite.

Parameters
pOwnerThe borrowed parent screen, valid while the widget uses screen operations.
xThe horizontal position in menu pixels.
yThe vertical position in menu pixels.
dwItemFlagsThe primary flag bits combined with existing flags.
dwSecondaryThe secondary flag bits combined with existing flags.
dwTertiaryThe tertiary flag bits combined with existing flags.
nModeThe image-animation mode, with zero disabling timed image updates.
nImageThe initial sprite identifier, also assigned to animation slot zero.
Ghidra address:
BRD3D: 0x10047fb0
Ghidra address:
BRGlide: 0x10041400

◆ GetScreen()

MenuScreen * MenuWidget::GetScreen ( ) const
inline
Returns
The borrowed parent screen, or null before assignment.

◆ GetFont()

MenuFont & MenuWidget::GetFont ( int index)
inline
Parameters
indexThe font slot index, 0..2.
Returns
A mutable reference to embedded font storage, valid until widget destruction.

◆ GetItemList()

MenuItemList & MenuWidget::GetItemList ( )
inline
Returns
A mutable reference to the embedded item list, valid until widget destruction.

◆ GetFlags()

unsigned MenuWidget::GetFlags ( ) const
inline
Returns
The stored primary widget flag bits.

◆ SetFlags()

void MenuWidget::SetFlags ( unsigned value)
inline

Replace primary widget flags without updating layout.

Parameters
valueThe primary widget flag bits.

◆ GetX()

float MenuWidget::GetX ( ) const
inline
Returns
The horizontal position in menu pixels.

◆ GetY()

float MenuWidget::GetY ( ) const
inline
Returns
The vertical position in menu pixels.

◆ SetX()

void MenuWidget::SetX ( float value)
inline

Store a horizontal position without updating bounds or font coordinates.

Parameters
valueThe horizontal position in menu pixels.

◆ SetY()

void MenuWidget::SetY ( float value)
inline

Store a vertical position without updating bounds or font coordinates.

Parameters
valueThe vertical position in menu pixels.

◆ SetSpriteId()

void MenuWidget::SetSpriteId ( short value)
inline

Store the current sprite identifier without updating geometry.

Parameters
valueThe sprite identifier required by the selected drawing mode.

◆ GetSpriteId()

short MenuWidget::GetSpriteId ( ) const
inline
Returns
The stored current sprite identifier.

◆ SetAnimationSpriteId()

void MenuWidget::SetAnimationSpriteId ( int index,
short value )
inline

Store a sprite identifier in one animation slot.

Parameters
indexThe animation slot index, 0..49.
valueThe sprite identifier used when the frame is selected.

◆ SetImageMode()

void MenuWidget::SetImageMode ( int value)
inline

Store the image-animation mode without resetting timers.

Parameters
valueThe mode, with zero disabling timed image updates.

◆ SetImageRects()

void MenuWidget::SetImageRects ( const RECT * rects)
inline

Replace the borrowed source-rectangle array used for custom animation frames.

Parameters
rectsAn array with a valid rectangle for every selected frame, valid while attached.

◆ SetCustomFrameDurations()

void MenuWidget::SetCustomFrameDurations ( bool value)
inline

Select custom frame timings and per-frame source rectangles without initialising either.

Positive frame durations must end with a zero or negative duration within the 50 slots.

Parameters
valueWhether valid frame durations, sprites, and source rectangles are configured.

◆ SetFrameDuration()

void MenuWidget::SetFrameDuration ( int index,
int value )
inline

Store a custom frame duration without changing animation progress.

Parameters
indexThe duration slot index, 0..49.
valueThe duration in milliseconds; a zero or negative next duration wraps to frame zero.

◆ GetLinkedWidgetCount()

short MenuWidget::GetLinkedWidgetCount ( ) const
inline
Returns
The stored linked-widget count, normally 0..25.

◆ GetLinkedWidgetIndex()

short MenuWidget::GetLinkedWidgetIndex ( int index) const
inline
Parameters
indexThe link slot index, 0..24.
Returns
The linked widget index in the parent screen's current panel.

◆ SetLinkedWidgetCount()

void MenuWidget::SetLinkedWidgetCount ( short value)
inline

Store link count without initialising the corresponding link indices.

Parameters
valueThe number of valid link slots, 0..25.

◆ SetLinkedWidgetIndex()

void MenuWidget::SetLinkedWidgetIndex ( int index,
short value )
inline

Assign one linked widget index without changing link count.

Parameters
indexThe link slot index, 0..24.
valueA valid widget index in the parent screen's current panel.

◆ GetBoundsLeft()

LONG MenuWidget::GetBoundsLeft ( ) const
inline
Returns
The stored left bound in menu pixels.

◆ GetBoundsTop()

LONG MenuWidget::GetBoundsTop ( ) const
inline
Returns
The stored top bound in menu pixels.

◆ SetBoundsLeft()

void MenuWidget::SetBoundsLeft ( LONG value)
inline

Store the left bound without updating other layout fields.

Parameters
valueThe left menu-pixel coordinate.

◆ SetBoundsTop()

void MenuWidget::SetBoundsTop ( LONG value)
inline

Store the top bound without updating other layout fields.

Parameters
valueThe top menu-pixel coordinate.

◆ SetBoundsRight()

void MenuWidget::SetBoundsRight ( LONG value)
inline

Store the right bound without updating other layout fields.

Parameters
valueThe right menu-pixel coordinate.

◆ SetBoundsBottom()

void MenuWidget::SetBoundsBottom ( LONG value)
inline

Store the bottom bound without updating other layout fields.

Parameters
valueThe bottom menu-pixel coordinate.

◆ SetUpdateCallback()

void MenuWidget::SetUpdateCallback ( int(* callback )(MenuWidget *))
inline

Install a widget-update callback without invoking it.

Parameters
callbackThe callback receiving this widget, or null. Return -2 to skip the remaining update while continuing, -1 to end the widget, or another value to continue normally.

◆ GetUpdateCallback()

auto MenuWidget::GetUpdateCallback ( ) const
inline
Returns
The installed widget-update callback, or null.

◆ SetActionCallback()

void MenuWidget::SetActionCallback ( int(* callback )(MenuActionWidget *))
inline

Install an activation callback without invoking it.

Parameters
callbackThe callback receiving this widget, or null; zero ends the widget update.

◆ GetActionCallback()

auto MenuWidget::GetActionCallback ( ) const
inline
Returns
The installed activation callback, or null.

◆ SetIdleActionCallback()

void MenuWidget::SetIdleActionCallback ( int(* callback )(MenuWidget *))
inline

Install an idle callback without invoking it.

Parameters
callbackThe callback receiving this widget, or null; the return value is discarded.

◆ SetTextEditCompleteCallback()

void MenuWidget::SetTextEditCompleteCallback ( int(* callback )(MenuWidget *))
inline

Install a text-edit completion callback without invoking it.

Parameters
callbackThe callback receiving this widget, or null; the return value is discarded.

◆ GetTextEditCompleteCallback()

auto MenuWidget::GetTextEditCompleteCallback ( ) const
inline
Returns
The installed text-edit completion callback, or null.

◆ SetBeforeUpdateCallback()

void MenuWidget::SetBeforeUpdateCallback ( int(* callback )(MenuWidget *))
inline

Install a callback run by the panel before the widget update.

Parameters
callbackThe callback receiving this widget, or null; zero aborts panel processing.

◆ GetBeforeUpdateCallback()

auto MenuWidget::GetBeforeUpdateCallback ( ) const
inline
Returns
The installed callback for panel processing before widget updates, or null.

◆ SetAfterUpdateCallback()

void MenuWidget::SetAfterUpdateCallback ( int(* callback )(MenuWidget *))
inline

Install a callback run by the panel after the widget update.

Parameters
callbackThe callback receiving this widget, or null; zero aborts panel processing.

◆ GetAfterUpdateCallback()

auto MenuWidget::GetAfterUpdateCallback ( ) const
inline
Returns
The installed callback for panel processing after widget updates, or null.

The documentation for this class was generated from the following file: