13 private bool _isInputEnabled =
true;
14 private bool _isPointerInputEnabled =
true;
15 private bool _isKeyboardInputEnabled;
16 private bool _canReceiveFocus;
61 public event Action<WidgetPointerEventArgs>?
PointerUp;
71 public event Action<WidgetMouseWheelEventArgs>?
MouseWheel;
97 PointF anchor =
default,
98 string? nickname =
null)
99 : base(renderSurfaceHost, mode, anchor, nickname)
111 get => _isInputEnabled;
114 if (_isInputEnabled == value)
117 _isInputEnabled = value;
120 WidgetInputRouterRegistry.NotifyInputDisabled(
this);
132 get => _isPointerInputEnabled;
135 if (_isPointerInputEnabled == value)
138 _isPointerInputEnabled = value;
141 WidgetInputRouterRegistry.NotifyPointerInputDisabled(
this);
153 get => _isKeyboardInputEnabled;
156 if (_isKeyboardInputEnabled == value)
159 _isKeyboardInputEnabled = value;
162 WidgetInputRouterRegistry.NotifyKeyboardFocusDisabled(
this);
174 get => _canReceiveFocus;
177 if (_canReceiveFocus == value)
180 _canReceiveFocus = value;
183 WidgetInputRouterRegistry.NotifyKeyboardFocusDisabled(
this);
204 Point screenPositionPx)
206 ArgumentNullException.ThrowIfNull(view);
216 && !ReferenceEquals(
View, view))
222 (layer.WrapHorizontally || layer.WrapVertically))
223 return GetWrappedHitOffset(view, screenPositionPx).HasValue;
227 return !screenBounds.IsEmpty
228 && screenBounds.Contains(screenPositionPx.X, screenPositionPx.Y);
231 internal PointF? GetWrappedHitOffset(
View view, Point screenPositionPx)
236 foreach (var offset
in layer.GetWrappedOffsets(
WorldBounds,
new RectangleF(world.X, world.Y, 0.01f, 0.01f)))
239 bounds.Offset(offset);
240 if (bounds.Contains(world))
return offset;
252 public virtual bool HitTest(Point screenPositionPx)
256 for (
int index = views.Count - 1; index >= 0; index--)
258 View view = views[index];
265 return HitTest(view, screenPositionPx);
277 WidgetInputRouterRegistry.TryRegister(
this);
294 WidgetInputRouterRegistry.NotifyHidden(
this);
311 WidgetInputRouterRegistry.TryBringToFront(
this);
339 ArgumentNullException.ThrowIfNull(args);
350 protected internal void DispatchPointerLeave(WidgetPointerEventArgs args)
352 ArgumentNullException.ThrowIfNull(args);
363 protected internal void DispatchPointerDown(WidgetPointerEventArgs args)
365 ArgumentNullException.ThrowIfNull(args);
376 protected internal void DispatchPointerMove(WidgetPointerEventArgs args)
378 ArgumentNullException.ThrowIfNull(args);
389 protected internal void DispatchPointerUp(WidgetPointerEventArgs args)
391 ArgumentNullException.ThrowIfNull(args);
402 protected internal void DispatchPointerClick(WidgetPointerEventArgs args)
404 ArgumentNullException.ThrowIfNull(args);
417 protected internal void DispatchMouseWheel(WidgetMouseWheelEventArgs args)
419 ArgumentNullException.ThrowIfNull(args);
428 protected internal void DispatchFocusGained()
440 protected internal void DispatchFocusLost()
453 protected internal void DispatchKeyboardInput(WidgetKeyboardEventArgs args)
455 ArgumentNullException.ThrowIfNull(args);
bool Visible
Gets or sets the visibility of all descendants.
RenderSurfaceHostBase RenderSurfaceHost
Gets the render surface host shared by the composite and its children.
SceneLayer? SceneLayer
Gets the scene layer shared by all children in scene-layer mode.
RectangleF GetDrawLocationScreen(View view)
Gets the union of all visible descendants as projected through a view.
DirectComposite SetIsVisible(bool visible)
Applies one visibility value to every descendant.
Rectangle WorldBounds
Gets the union of all visible descendants' world-space bounds.
View? View
Gets the view shared by all children in view mode.
DirectComposite(RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
Initializes a new instance of the DirectComposite class.
DirectDrawingMode Mode
Gets the coordinate mode shared by the composite and its children.
Represents a base class for hosting a render surface, providing functionality for managing rendering ...
Represents a rendered view of a scene, combining a camera position with a viewport configuration to c...
PointF ScreenPxToWorldPx(SceneLayer layer, PointF screenPx)
Converts a screen-space pixel position into world-space coordinates for the specified scene layer,...
Viewport Viewport
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters...
Rectangle TargetRectPx
Screen-space rectangle (in SCREEN / RenderSurface pixels) where this view is drawn....
DirectDrawingMode
Specifies where direct drawing operations are applied within the rendering pipeline.
@ SceneLayer
Performs direct drawing within a scene layer using world-space coordinates.