YOU ALMOST CERTAINLY SHOULD NOT USE THIS. This is really only for special purposes like pseudowindows or popup windows doing their own thing.
Creates a window from an existing SimpleWindow. This constructor attaches various event handlers to the SimpleWindow object which may overwrite your existing handlers.
Shows the window and runs the application event loop.
Sets the window icon which is often seen in title bars and taskbars.
Provides access to the underlying SimpleWindow. Note that changing properties on this window may disconnect minigui's event dispatchers.
Gives the height of a line according to the default font. You should try to use your computed font instead of this, but until May 8, 2021, this was the only real option.
Determines whether the control is marked enabled. Disabled controls are generally displayed as greyed out and clicking on them does nothing. It is also possible for a control to be disabled because its parent is disabled, in which case this will still return true, but setting enabled = true may have no effect. Check disabledBy to see which parent caused it to be disabled.
If the widget is not enabled this string may be presented to the user when they try to use it. The exact manner and time it gets displayed is up to the implementation of the control.
Returns the widget that disabled this. It might be this or one of its parents all the way up the chain, or null if the widget is not disabled by anything. You can check disabledReason on the return value (after the null check!) to get a hint to display to the user.
Implementations of ReflectableProperties interface. See the interface for details.
Scales the given value to the system-reported DPI for the monitor on which the widget resides.
Returns the current scaling factor as a logical dpi value for this widget. Generally speaking, this divided by 96 gives you the user scaling factor.
If encapsulatedChildren returns true, it changes the event handling mechanism to act as if events from the child widgets are actually targeted on this widget.
Virtual hook to update any caches or fonts you need on the event of a dpi scaling change.
Where stretchiness will grow from the flex basis, this shrinkiness will let it get smaller if needed to make room for other items.
The initial size of the widget for layout calculations. Default is 0.
Not stable.
Returns the style's tag name string this object uses.
API for the styleClassList
Returns a "class list" that can be used by the visual theme's style engine via VisualTheme.getPropertyString if it chooses to do something like CSS.
List of dynamic states made available to the style engine, for cases like CSS pseudo-classes and also used by default paint methods. It is stored in a 64 bit variable attached to the widget that you can update. The style cache is aware of the fact that these can frequently change.
Style properties are defined as an accessory class so they can be referenced and overridden independently, but they are nested so you can refer to them easily by name (e.g. generic Widget.Style vs Button.Style and such).
This mixin overrides the useStyleProperties method to direct it toward your own style class. The basic usage is simple:
You can override this by hand, or use the OverrideStyle helper which is a bit less verbose.
Removes this widget from its parent.
Notifies the subclass that a widget was removed. If you keep auxillary data about your children, you can override this to help keep that data in sync.
Removes all child widgets from this. You should not use the removed widgets again.
Calls getByName with the generic type of Widget. Meant for script interop where instantiating a template is impossible.
Finds the nearest descendant with the requested type and name. May return this.
The name is a string tag that is used to reference the widget from scripts, gui loaders, declarative ui templates, etc. Similar to a HTML id attribute. Names should be unique in a window.
Default event handlers. These are called on the appropriate event unless Event.preventDefault is called on the event at some point through the bubbling process.
Returns the coordinates of this widget on the screen, relative to the upper left corner of the whole screen.
Called when a WM_COMMAND is sent to the associated hwnd.
Called when a WM_NOTIFY is sent to the associated hwnd.
This tip is displayed in the status bar (if there is one in the containing window) when the mouse moves over this widget.
If true, this widget can be focused via keyboard control with the tab key.
The tab key cycles through widgets by the order of a.tabOrder < b.tabOrder. If they are equal, it does them in child order (which is typically the order they were added to the widget.)
The native handle, if there is one.
Child's position relative to the parent's origin. only the layout manager should be modifying this and even reading it is of limited utility. It may be made private at some point in the future without advance notice. Do NOT depend on it being available unless you are writing a layout manager.
Returns the window to which this widget is attached.
Called when the widget has been added to or remove from a parent window.
Returns the list of the widget's children.
Returns the widget's parent.
The widget's current size.
Only the layout manager should be calling these.
This function is called by the layout engine after it has updated the position (in variables x and y) and the size (in properties width and height) to give you a chance to update the actual position of the native child window (if there is one) or whatever.
Returns true if this is the current focused widget inside the parent window. Please note it may return true when the window itself is unfocused. In that case, it indicates this widget will receive focuse again when the window does.
Shows or hides the window. Meant to be assigned as a property. If recalculate is true (the default), it recalculates the layout of the parent widget to use the space this widget being hidden frees up or make space for this widget to appear again.
Convenience method for showing = true
Convenience method for showing = false
This is called when the widget is added to a window. It gives you a chance to set up event hooks.
Callback when the widget is added to another widget.
Adds a child to the given position. This is protected because you generally shouldn't be calling this directly. Instead, construct widgets with the parent directly.
Finds the child at the top of the z-order at the given coordinates (relative to the this widget's origin), or null if none are found.
If the widget is a scrollable container, this should add the current scroll position to the given coordinates so the mouse events can be dispatched correctly.
Responsible for actually painting the widget to the screen. The clip rectangle and coordinate translation in the WidgetPainter are pre-configured so you can draw independently.
Responsible for drawing the content as the theme engine is responsible for other elements.
I don't actually like the name of this this draws a background on it
This can be overridden by scroll things. It is responsible for actually calling paint. Do not override unless you've studied minigui.d's source code. There are no stability guarantees if you do override this; it can (and likely will) break without notice.
Allows a class to easily dispatch its own statically-declared event (see Emits). The main benefit of using this over constructing an event yourself is simply that you ensure you haven't sent something you haven't documented you can send.
Does the same as addEventListener's delegate overload, but adds an additional check to ensure the event you are subscribing to is actually emitted by the static type you are using. Since it works on static types, if you have a generic Widget, this can only subscribe to events declared as Emits inside Widget itself, not any child classes nor any child elements. If this is too restrictive, simply use addEventListener instead.
Gets the computed style properties from the visual theme.
Calculates the border box (that is, the full width/height of the widget, from border edge to border edge) for the given content box (the area between the padding)