minigui is a smallish GUI widget library, aiming to be on par with at least HTML4 forms and a few other expected gui components. It uses native controls on Windows and does its own thing on Linux (Mac is not currently supported but may be later, and should use native controls) to keep size down. The Linux appearance is similar to Windows 95 and avoids using images to maintain network efficiency on remote X connections, though you can customize that.
Its #1 goal is to be useful without being large and complicated like GTK and Qt. It isn't hugely concerned with appearance - on Windows, it just uses the native controls and native theme, and on Linux, it keeps it simple and I may change that at any time.
I love Qt, if you want something full featured, use it! But if you want something you can just drop into a small project and expect the basics to work without outside dependencies, hopefully minigui will work for you.
Methods marked with this are available from scripts if added to the arsd.script engine.
Indicates that a character has been typed by the user. Normally dispatched to the currently focused widget.
A combination of free entry with a list below it.
A button with a consistent size, suitable for user commands like OK and Cancel.
The data controller widget is created by reflecting over the given data type. You can use ControlledBy as a UDA on a struct or just let it create things automatically.
A dialog is a transient window that intends to get information from the user before being dismissed.
A drop-down list where the user must select one of the given options. Like <select> in HTML.
Contains the implementation of text editing
Represents an event that is currently being processed.
FixedPosition is like StaticPosition, but its coordinates are always relative to the viewport, meaning they do not scroll with the parent content.
A text box with a drop down arrow listing selections. The user can choose from the list, or type their own.
Stacks the widgets horizontally, taking all the available height for each child.
Draws a line
Adds empty space to a layout.
Displays an in-progress indicator without known values
Makes all children minimum width and height, placing them down left to right, top to bottom.
Indicates that the user has pressed a key on the keyboard, or if they've been holding it long enough to repeat (key down events are sent both on the initial press then repeated by the OS on its own time.) For available properties, see KeyEventBase.
Indicates that the user has released a key on the keyboard. For available properties, see KeyEventBase.
A labeled password edit.
Contains shared properties for various mouse events;
A mouse tracking widget is one that follows the mouse when dragged inside it.
Nests an opengl capable window inside this window as a widget.
A page widget is basically a tab widget with hidden tabs.
A LineEdit that displays * in place of the actual characters.
A progress bar with a known endpoint and completion amount
A widget that takes your widget, puts scroll bars around it, and sends messages to it when the user scrolls. Unlike ScrollableWidget, it makes no effort to automatically scroll or clip its child widgets - it just sends the messages.
FIXME ScrollBarShowPolicy FIXME: use the ScrollMessageWidget in here now that it exists
A slider, also known as a trackbar control, is commonly used in applications like volume controls where you want the user to select a value between a min and a max without needing a specific value or otherwise precise input.
Bypasses automatic layout for its children, using manual positioning and sizing only. While you need to manually position them, you must ensure they are inside the StaticLayout's bounding box to avoid undefined behavior.
Bypasses automatic positioning when being laid out. It is your responsibility to make room for this widget in the parent layout.
Status bars appear at the bottom of a MainWindow. They are made out of Parts, with a width and content.
A tab widget is a set of clickable tab buttons followed by a content area.
Toolbars are lists of buttons (typically icons) that appear under the menu. Each button ought to correspond to a menu item.
Stacks the widgets vertically, taking all the available width for each child.
Draws a line
Adds empty space to a layout.
The way this module works is it builds on top of a SimpleWindow from simpledisplay to provide simple controls and such.
The purpose of this enum was to give a compile-time checked version of various standard event strings.
Identifies the button the user pressed on a message box.
For ScrollableWidget, determines when to show the scroll bar to the user.
Intended for UFCS action like window.addDataControllerWidget(new MyObject());
Creates a dialog based on a data structure.
Displays a modal message box, blocking until the user dismisses it.
Observes and allows inspection of an object via automatic gui
This lets you statically verify you send the events you claim you send and gives you a hook to document them.
Program-wide keyboard shortcut to trigger the action
tells which menu the action will be on
This item in the menu will be preceded by a separator line
Describes which toolbar section the action appears on
FOR BEST RESULTS: be sure to link with the appropriate subsystem command -L/SUBSYSTEM:WINDOWS:5.0, for example, because otherwise you'll get a console and other visual bugs.
|HTML Code||Minigui Class|
Stretchiness: The default is 4. You can use larger numbers for things that should consume a lot of space, and lower numbers for ones that are better at smaller sizes.
COMING EVENTUALLY: minigui will include a little bit of I/O functionality that just works with the event loop. If you want to get fancy, I suggest spinning up another thread and posting events back and forth.
If you use arsd.minigui_xml, you can create widget trees from XML at runtime.
minigui is compatible with arsd.script. If you see @scriptable on a method in this documentation, it means you can call it from the script language.
import arsd.minigui_xml; import arsd.script; var globals = var.emptyObject; globals.makeWidgetFromString = &makeWidgetFromString; // this now works interpret(`var window = makeWidgetFromString("<MainWindow />");`, globals);
More to come.