Widget base class and the geometry primitives it works with.
A Widget owns a single native window handle (HWND) and the common
operations over it: visibility, bounds, enablement, focus and deterministic
teardown. Window (top-level windows) and Control (common controls) both
derive from it.
Handle lifetime: a widget owns its HWND. Because D's garbage collector is
non-deterministic, call dispose() for prompt, predictable cleanup — it
destroys the native window and unregisters the widget. While a widget's HWND
is alive the widget is pinned as a GC root so it cannot be collected out from
under the message loop.
Widget base class and the geometry primitives it works with.
A Widget owns a single native window handle (HWND) and the common operations over it: visibility, bounds, enablement, focus and deterministic teardown. Window (top-level windows) and Control (common controls) both derive from it.
Handle lifetime: a widget owns its HWND. Because D's garbage collector is non-deterministic, call dispose() for prompt, predictable cleanup — it destroys the native window and unregisters the widget. While a widget's HWND is alive the widget is pinned as a GC root so it cannot be collected out from under the message loop.