Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Widgets.Dialogs.DialogBox Class Referenceabstract

Provides a draggable container with panel, title-bar, close, keyboard, and result semantics. More...

Inheritance diagram for Gondwana.Widgets.Dialogs.DialogBox:
Gondwana.Widgets.DraggableContainerWidget Gondwana.Widgets.ContainerWidget Gondwana.Widgets.WidgetBase Gondwana.Drawing.Direct.DirectComposite Gondwana.Drawing.Direct.IDirectCompositeChild Gondwana.Drawing.Direct.IDirectCompositeContainer Gondwana.Drawing.Direct.IDirectDrawable Gondwana.Physics.Movement.IMovable Gondwana.Drawing.IDrawable Gondwana.Widgets.Dialogs.AboutBox

Public Member Functions

void Close (DialogResult result=DialogResult.Close)
 Closes the dialog with the specified result.
override void Dispose ()
 Disposes the composite and every child it owns.
Public Member Functions inherited from Gondwana.Widgets.ContainerWidget
override DirectComposite Add (IDirectCompositeChild child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null)
 Adds a composite-compatible direct drawable as a child.
Parameters
childThe child to add.
keepCurrentOffsettrue to preserve the child's current offset from the composite anchor.
explicitLocalOffsetPxThe offset to use when keepCurrentOffset is false.
Returns
The current composite.
Exceptions
ArgumentExceptionThrown when the child uses another render surface, mode, view, or scene layer.
InvalidOperationExceptionThrown when the child already has another parent or would create a cycle.

override DirectComposite Remove (IDirectCompositeChild child)
 Removes a child without disposing it.
Parameters
childThe child to detach.
Returns
The current composite.

override DirectComposite Clear ()
 Removes every child without disposing them.
Returns
The current composite.

Public Member Functions inherited from Gondwana.Widgets.WidgetBase
virtual bool HitTest (View view, Point screenPositionPx)
 Determines whether the widget can be hit at the specified screen position within the specified view.
virtual bool HitTest (Point screenPositionPx)
 Determines whether the widget can be hit at the specified screen position.
WidgetBase Show ()
 Shows the widget and registers it for input routing.
WidgetBase Hide ()
 Hides the widget and releases any routed input state.
WidgetBase Activate ()
 Activates the widget and brings it to the front of the input order.
WidgetBase Cancel ()
 Cancels the widget.
Public Member Functions inherited from Gondwana.Drawing.Direct.DirectComposite
 DirectComposite (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the DirectComposite class.
Vector2 GetPosition ()
 Gets the current composite anchor.
void SetPosition (Vector2 position)
 Sets the composite anchor and repositions all children from their stored offsets.
DirectComposite SetPosition (float x, float y)
 Sets the composite anchor and repositions all children from their stored offsets.
DirectComposite SetLocalOffset (IDirectCompositeChild child, Vector2 newLocalOffsetPx)
 Changes one child's local offset and reapplies its position.
DirectComposite SetZOrder (int zOrder)
 Applies one Z-order to every descendant.
DirectComposite SetOpacity (float opacity)
 Applies one opacity to every descendant.
DirectComposite SetIsVisible (bool visible)
 Applies one visibility value to every descendant.
DirectComposite FadeTo (float targetOpacity, float durationSec)
 Fades every descendant to the requested opacity.
DirectComposite FadeIn (float durationSec)
 Fades every descendant to full opacity.
DirectComposite FadeOut (float durationSec)
 Fades every descendant to zero opacity.
RectangleF GetDrawLocationScreen (View view)
 Gets the union of all visible descendants as projected through a view.
void Draw (BackbufferBase backbuffer, RectangleF destRectScreen)
 Performs no direct rendering because descendants render independently.
virtual void Update (long tick)
 Advances composite movement.

Protected Member Functions

 DialogBox (RenderSurfaceHostBase renderSurfaceHost, View view, Rectangle bounds, string title, bool showCloseButton=true, string? nickname=null)
 Initializes a view-level dialog.
 DialogBox (RenderSurfaceHostBase renderSurfaceHost, SceneLayer sceneLayer, Rectangle bounds, string title, bool showCloseButton=true, string? nickname=null)
 Initializes a scene-layer dialog.
virtual void OnClosed (DialogResult result)
 Called after the dialog closes.
virtual void OnAcceptRequested ()
 Called when the accept key is pressed.
override void ProcessActivated ()
 Performs processing when the widget is activated before notification callbacks are invoked.
override bool CanStartDrag (WidgetPointerEventArgs args)
 Determines whether a pointer-down event may begin drag tracking.
Parameters
argsThe event data.
Returns
true if the pointer event can begin a drag; otherwise, false.

override void OnKeyboardInput (WidgetKeyboardEventArgs args)
 Called when keyboard input is routed to the widget.
Parameters
argsThe keyboard event data.

override void OnCancelled ()
 Called when the widget is cancelled.
Protected Member Functions inherited from Gondwana.Widgets.DraggableContainerWidget
 DraggableContainerWidget (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the DraggableContainerWidget class.
override void ProcessHidden ()
 Performs processing when the widget is hidden before notification callbacks are invoked.
override void ProcessCancelled ()
 Performs processing when the widget is cancelled before notification callbacks are invoked.
override void ProcessPointerDown (WidgetPointerEventArgs args)
 Performs processing when a pointer press begins on the widget before notification callbacks are invoked.
Parameters
argsThe pointer event data.

override void ProcessPointerMove (WidgetPointerEventArgs args)
 Performs processing when pointer movement is routed to the widget before notification callbacks are invoked.
Parameters
argsThe pointer event data.

override void ProcessPointerUp (WidgetPointerEventArgs args)
 Performs processing when a pointer press is released for the widget before notification callbacks are invoked.
Parameters
argsThe pointer event data.

override bool ShouldDispatchPointerClick (WidgetPointerEventArgs args)
 Determines whether a pointer-click event should be dispatched for the specified pointer event data.
Parameters
argsThe pointer event data.
Returns
true if the pointer-click event should be dispatched; otherwise, false.

virtual Vector2 ConvertScreenDeltaToPositionDelta (Vector2 totalScreenDeltaPx, View view)
 Converts total screen movement into this widget's coordinate space.
virtual Vector2 ConstrainDragPosition (Vector2 proposedPositionPx)
 Constrains a proposed anchor position before it is applied.
virtual void OnDragStarted (WidgetDragEventArgs args)
 Called when dragging begins.
virtual void OnDragged (WidgetDragEventArgs args)
 Called after the container moves during dragging.
virtual void OnDragEnded (WidgetDragEventArgs args)
 Called when dragging ends.
Protected Member Functions inherited from Gondwana.Widgets.ContainerWidget
 ContainerWidget (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the ContainerWidget class.
TWidget Add< TWidget > (TWidget widget, Vector2 localOffsetPx)
 Adds a child widget at a local offset from this container's anchor.
bool RemoveChild (WidgetBase widget, bool dispose=false)
 Removes a child widget from the container.
override void OnChildAdded (IDirectCompositeChild child)
 Called after a child has been successfully added.
Parameters
childThe child that was added.
Overrides should perform only non-throwing bookkeeping. Derived types that need additional validation should override Add, perform that validation before calling the base implementation, and then allow this callback to perform the resulting bookkeeping.
override void OnChildRemoved (IDirectCompositeChild child)
 Called after a child has been removed from the composite.
Parameters
childThe child that was removed.

override void ProcessShown ()
 Performs processing when the widget is shown before notification callbacks are invoked.
Protected Member Functions inherited from Gondwana.Widgets.WidgetBase
 WidgetBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the WidgetBase class.
virtual void ProcessPointerEnter (WidgetPointerEventArgs args)
 Performs processing when a pointer enters the widget before notification callbacks are invoked.
virtual void ProcessPointerLeave (WidgetPointerEventArgs args)
 Performs processing when a pointer leaves the widget before notification callbacks are invoked.
virtual void ProcessFocusGained ()
 Performs processing when the widget gains focus before notification callbacks are invoked.
virtual void ProcessFocusLost ()
 Performs processing when the widget loses focus before notification callbacks are invoked.
virtual void ProcessKeyboardInput (WidgetKeyboardEventArgs args)
 Performs processing when keyboard input is routed to the widget before notification callbacks are invoked.
virtual void OnShown ()
 Called when the widget is shown.
virtual void OnHidden ()
 Called when the widget is hidden.
virtual void OnActivated ()
 Called when the widget is activated.
virtual void OnPointerEnter (WidgetPointerEventArgs args)
 Called when a pointer enters the widget bounds.
virtual void OnPointerLeave (WidgetPointerEventArgs args)
 Called when a pointer leaves the widget bounds.
virtual void OnPointerDown (WidgetPointerEventArgs args)
 Called when a pointer press begins on the widget.
virtual void OnPointerMove (WidgetPointerEventArgs args)
 Called when pointer movement is routed to the widget.
virtual void OnPointerUp (WidgetPointerEventArgs args)
 Called when a pointer press is released for the widget.
virtual void OnMouseWheel (WidgetMouseWheelEventArgs args)
 Called when mouse-wheel input is routed to the widget.
virtual void OnPointerClick (WidgetPointerEventArgs args)
 Called when a pointer click is dispatched to the widget.
virtual void OnFocusGained ()
 Called when the widget gains focus.
virtual void OnFocusLost ()
 Called when the widget loses focus.

Static Protected Attributes

const int DefaultTitleBarHeight = 36
 The default title bar height.
const int DefaultCloseButtonSize = 28
 The default close button size.
static readonly Color DefaultPanelColor = Color.FromArgb(245, 36, 36, 44)
 The default panel color.
static readonly Color DefaultPanelBorderColor = Color.FromArgb(255, 140, 140, 155)
 The default panel border color.
static readonly Color DefaultTitleBarColor = Color.FromArgb(255, 57, 57, 72)
 The default title bar color.

Properties

DirectRectangle Panel [get]
 Gets the dialog panel.
DirectRectangle TitleBar [get]
 Gets the title-bar rectangle.
TextBlock TitleText [get]
 Gets the title text block.
ButtonWidget? CloseButton [get]
 Gets the optional close button.
Size DialogSize [get]
 Gets the dialog size.
bool IsClosed [get]
 Gets whether the dialog has closed.
DialogResult Result [get]
 Gets the result selected when the dialog closed.
bool DisposeOnClose = true [get, set]
 Gets or sets whether closing the dialog disposes it.
int AcceptKey = 13 [get, set]
 Gets or sets the key value used to accept the dialog.
int CancelKey = 27 [get, set]
 Gets or sets the key value used to cancel the dialog.
Properties inherited from Gondwana.Widgets.DraggableContainerWidget
bool IsDragEnabled [get, set]
 Gets or sets whether new drag operations may begin.
bool IsDragging [get]
 Gets whether a drag operation is active.
float DragThresholdPx [get, set]
 Gets or sets the minimum pointer movement required to begin dragging.
Properties inherited from Gondwana.Widgets.ContainerWidget
IReadOnlyList< WidgetBase > ChildWidgets [get]
 Gets a snapshot of the child widgets directly owned by this container.
Properties inherited from Gondwana.Widgets.WidgetBase
bool IsInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can participate in input routing.
bool IsPointerInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can receive pointer input.
bool IsKeyboardInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can receive keyboard input.
bool CanReceiveFocus [get, set]
 Gets or sets a value indicating whether the widget can receive keyboard focus.
bool IsFocused [get, set]
 Gets a value indicating whether the widget currently has keyboard focus.
Properties inherited from Gondwana.Drawing.Direct.DirectComposite
Guid Id = Guid.NewGuid() [get]
 Gets the unique identifier of the composite.
string? Nickname [get]
 Gets the optional diagnostic nickname of the composite.
RenderSurfaceHostBase RenderSurfaceHost [get]
 Gets the render surface host shared by the composite and its children.
DirectDrawingMode Mode [get]
 Gets the coordinate mode shared by the composite and its children.
SceneLayer? SceneLayer [get]
 Gets the scene layer shared by all children in scene-layer mode.
View? View [get]
 Gets the view shared by all children in view mode.
ReadOnlyCollection< IDirectCompositeChild > Children [get]
 Gets the children owned by the composite.
MovementController Movement [get]
 Gets the movement controller used to move the composite anchor.
MovementSpace PositionSpace [get]
 Gets the coordinate space used by the movement controller.
bool Visible [get, set]
 Gets or sets the visibility of all descendants.
int ZOrder [get]
 Gets the composite Z-order.
Rectangle ScreenBounds [get]
 Gets the union of all visible descendants' screen-space bounds.
Rectangle WorldBounds [get]
 Gets the union of all visible descendants' world-space bounds.

Events

Action< DialogResult >? Closed
 Occurs when the dialog closes.
Events inherited from Gondwana.Widgets.DraggableContainerWidget
Action< WidgetDragEventArgs >? DragStarted
 Raised when pointer movement first crosses DragThresholdPx.
Action< WidgetDragEventArgs >? Dragged
 Raised after the container is repositioned during an active drag.
Action< WidgetDragEventArgs >? DragEnded
 Raised when an active drag ends.
Events inherited from Gondwana.Widgets.WidgetBase
Action? Shown
 Occurs when the widget is shown.
Action? Hidden
 Occurs when the widget is hidden.
Action? Activated
 Occurs when the widget is activated.
Action? Cancelled
 Occurs when the widget is cancelled.
Action< WidgetPointerEventArgs >? PointerEnter
 Occurs when a pointer enters the widget bounds.
Action< WidgetPointerEventArgs >? PointerLeave
 Occurs when a pointer leaves the widget bounds.
Action< WidgetPointerEventArgs >? PointerDown
 Occurs when a pointer button or touch press begins on the widget.
Action< WidgetPointerEventArgs >? PointerMove
 Occurs when a pointer moves while routed to the widget.
Action< WidgetPointerEventArgs >? PointerUp
 Occurs when a pointer button or touch press is released for the widget.
Action< WidgetPointerEventArgs >? PointerClick
 Occurs when a pointer press and release completes as a click on the widget.
Action< WidgetMouseWheelEventArgs >? MouseWheel
 Occurs when mouse-wheel input is routed to the widget while the pointer is over it.
Action? FocusGained
 Occurs when the widget gains keyboard focus.
Action? FocusLost
 Occurs when the widget loses keyboard focus.
Action< WidgetKeyboardEventArgs >? KeyboardInput
 Occurs when keyboard input is routed to the widget.
Events inherited from Gondwana.Drawing.Direct.DirectComposite
EventHandler< IDirectDrawable >? Disposing
 Occurs when the composite is being disposed.
Events inherited from Gondwana.Drawing.Direct.IDirectDrawable
EventHandler< IDirectDrawable >? Disposing
 Occurs when the object is being disposed.

Detailed Description

Provides a draggable container with panel, title-bar, close, keyboard, and result semantics.

Definition at line 17 of file DialogBox.cs.

Constructor & Destructor Documentation

◆ DialogBox() [1/2]

Gondwana.Widgets.Dialogs.DialogBox.DialogBox ( RenderSurfaceHostBase renderSurfaceHost,
View view,
Rectangle bounds,
string title,
bool showCloseButton = true,
string? nickname = null )
protected

Initializes a view-level dialog.

Parameters
renderSurfaceHostThe render-surface host that owns the drawing.
viewThe view used for presentation and coordinate conversion.
boundsThe widget bounds in view-local pixels.
titleThe title.
showCloseButtonWhether the dialog displays a close button.
nicknameAn optional name used to identify the object.

Definition at line 65 of file DialogBox.cs.

◆ DialogBox() [2/2]

Gondwana.Widgets.Dialogs.DialogBox.DialogBox ( RenderSurfaceHostBase renderSurfaceHost,
SceneLayer sceneLayer,
Rectangle bounds,
string title,
bool showCloseButton = true,
string? nickname = null )
protected

Initializes a scene-layer dialog.

Parameters
renderSurfaceHostThe render-surface host that owns the drawing.
sceneLayerThe scene layer that owns the content.
boundsThe widget bounds in world pixels.
titleThe title.
showCloseButtonWhether the dialog displays a close button.
nicknameAn optional name used to identify the object.

Definition at line 105 of file DialogBox.cs.

Member Function Documentation

◆ CanStartDrag()

override bool Gondwana.Widgets.Dialogs.DialogBox.CanStartDrag ( WidgetPointerEventArgs args)
protectedvirtual

Determines whether a pointer-down event may begin drag tracking.

Parameters
argsThe event data.
Returns
true if the pointer event can begin a drag; otherwise, false.

Reimplemented from Gondwana.Widgets.DraggableContainerWidget.

Definition at line 282 of file DialogBox.cs.

◆ Close()

void Gondwana.Widgets.Dialogs.DialogBox.Close ( DialogResult result = DialogResult::Close)

Closes the dialog with the specified result.

Parameters
resultThe result.

Definition at line 204 of file DialogBox.cs.

◆ Dispose()

override void Gondwana.Widgets.Dialogs.DialogBox.Dispose ( )
virtual

Disposes the composite and every child it owns.

Reimplemented from Gondwana.Drawing.Direct.DirectComposite.

Definition at line 323 of file DialogBox.cs.

◆ OnAcceptRequested()

virtual void Gondwana.Widgets.Dialogs.DialogBox.OnAcceptRequested ( )
protectedvirtual

Called when the accept key is pressed.

Reimplemented in Gondwana.Widgets.Dialogs.AboutBox.

Definition at line 232 of file DialogBox.cs.

◆ OnCancelled()

override void Gondwana.Widgets.Dialogs.DialogBox.OnCancelled ( )
protectedvirtual

Called when the widget is cancelled.

Reimplemented from Gondwana.Widgets.WidgetBase.

Definition at line 316 of file DialogBox.cs.

◆ OnClosed()

virtual void Gondwana.Widgets.Dialogs.DialogBox.OnClosed ( DialogResult result)
protectedvirtual

Called after the dialog closes.

Parameters
resultThe result.

Definition at line 225 of file DialogBox.cs.

◆ OnKeyboardInput()

override void Gondwana.Widgets.Dialogs.DialogBox.OnKeyboardInput ( WidgetKeyboardEventArgs args)
protectedvirtual

Called when keyboard input is routed to the widget.

Parameters
argsThe keyboard event data.

Reimplemented from Gondwana.Widgets.WidgetBase.

Definition at line 294 of file DialogBox.cs.

◆ ProcessActivated()

override void Gondwana.Widgets.Dialogs.DialogBox.ProcessActivated ( )
protectedvirtual

Performs processing when the widget is activated before notification callbacks are invoked.

Reimplemented from Gondwana.Widgets.ContainerWidget.

Definition at line 238 of file DialogBox.cs.

Member Data Documentation

◆ DefaultCloseButtonSize

const int Gondwana.Widgets.Dialogs.DialogBox.DefaultCloseButtonSize = 28
staticprotected

The default close button size.

Definition at line 26 of file DialogBox.cs.

◆ DefaultPanelBorderColor

readonly Color Gondwana.Widgets.Dialogs.DialogBox.DefaultPanelBorderColor = Color.FromArgb(255, 140, 140, 155)
staticprotected

The default panel border color.

Definition at line 35 of file DialogBox.cs.

◆ DefaultPanelColor

readonly Color Gondwana.Widgets.Dialogs.DialogBox.DefaultPanelColor = Color.FromArgb(245, 36, 36, 44)
staticprotected

The default panel color.

Definition at line 31 of file DialogBox.cs.

◆ DefaultTitleBarColor

readonly Color Gondwana.Widgets.Dialogs.DialogBox.DefaultTitleBarColor = Color.FromArgb(255, 57, 57, 72)
staticprotected

The default title bar color.

Definition at line 39 of file DialogBox.cs.

◆ DefaultTitleBarHeight

const int Gondwana.Widgets.Dialogs.DialogBox.DefaultTitleBarHeight = 36
staticprotected

The default title bar height.

Definition at line 22 of file DialogBox.cs.

Property Documentation

◆ AcceptKey

int Gondwana.Widgets.Dialogs.DialogBox.AcceptKey = 13
getset

Gets or sets the key value used to accept the dialog.

The default value is the conventional Enter virtual-key value, 13.

Definition at line 186 of file DialogBox.cs.

◆ CancelKey

int Gondwana.Widgets.Dialogs.DialogBox.CancelKey = 27
getset

Gets or sets the key value used to cancel the dialog.

The default value is the conventional Escape virtual-key value, 27.

Definition at line 194 of file DialogBox.cs.

◆ CloseButton

ButtonWidget? Gondwana.Widgets.Dialogs.DialogBox.CloseButton
get

Gets the optional close button.

Definition at line 158 of file DialogBox.cs.

◆ DialogSize

Size Gondwana.Widgets.Dialogs.DialogBox.DialogSize
get

Gets the dialog size.

Definition at line 163 of file DialogBox.cs.

◆ DisposeOnClose

bool Gondwana.Widgets.Dialogs.DialogBox.DisposeOnClose = true
getset

Gets or sets whether closing the dialog disposes it.

Definition at line 178 of file DialogBox.cs.

◆ IsClosed

bool Gondwana.Widgets.Dialogs.DialogBox.IsClosed
get

Gets whether the dialog has closed.

Definition at line 168 of file DialogBox.cs.

◆ Panel

DirectRectangle Gondwana.Widgets.Dialogs.DialogBox.Panel
get

Gets the dialog panel.

Definition at line 143 of file DialogBox.cs.

◆ Result

DialogResult Gondwana.Widgets.Dialogs.DialogBox.Result
get

Gets the result selected when the dialog closed.

Definition at line 173 of file DialogBox.cs.

◆ TitleBar

DirectRectangle Gondwana.Widgets.Dialogs.DialogBox.TitleBar
get

Gets the title-bar rectangle.

Definition at line 148 of file DialogBox.cs.

◆ TitleText

TextBlock Gondwana.Widgets.Dialogs.DialogBox.TitleText
get

Gets the title text block.

Definition at line 153 of file DialogBox.cs.

Event Documentation

◆ Closed

Action<DialogResult>? Gondwana.Widgets.Dialogs.DialogBox.Closed

Occurs when the dialog closes.

Definition at line 52 of file DialogBox.cs.