arsd.minigui

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.

minigui's only required dependencies are arsd.simpledisplay and arsd.color.

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.

The event model is similar to what you use in the browser with Javascript and the layout engine tries to automatically fit things in, similar to a css flexbox.

Public Imports

arsd.simpledisplay
public import arsd.simpledisplay;
Undocumented in source.

Members

Aliases

EventHandler
alias EventHandler = void delegate(Widget handlerAttachedTo, Event event)
scriptable
alias scriptable = arsd_jsvar_compatible

Methods marked with this are available from scripts if added to the arsd.script engine.

Classes

Action
class Action
ArrowButton
class ArrowButton
Button
class Button
Checkbox
class Checkbox
ComboBox
class ComboBox

A combination of free entry with a list below it.

ComboboxBase
class ComboboxBase
CommandButton
class CommandButton

A button with a consistent size, suitable for user commands like OK and Cancel.

Dialog
class Dialog

A dialog is a transient window that intends to get information from the user before being dismissed.

DropDownSelection
class DropDownSelection

A drop-down list where the user must select one of the given options. Like <select> in HTML.

EditableTextWidget
class EditableTextWidget

Contains the implementation of text editing

Event
class Event
Fieldset
class Fieldset
FixedPosition
class FixedPosition

FixedPosition is like StaticPosition, but its coordinates are always relative to the viewport, meaning they do not scroll with the parent content.

FreeEntrySelection
class FreeEntrySelection

A text box with a drop down arrow listing selections. The user can choose from the list, or type their own.

HorizontalLayout
class HorizontalLayout

Stacks the widgets horizontally, taking all the available height for each child.

HorizontalRule
class HorizontalRule

Draws a line

HorizontalSpacer
class HorizontalSpacer

Adds empty space to a layout.

ImageBox
class ImageBox
IndefiniteProgressBar
class IndefiniteProgressBar

Displays an in-progress indicator without known values

InlineBlockLayout
class InlineBlockLayout

Makes all children minimum width and height, placing them down left to right, top to bottom.

LabeledLineEdit
class LabeledLineEdit
Layout
class Layout
LineEdit
class LineEdit
ListWidget
class ListWidget
MainWindow
class MainWindow
Menu
class Menu
MenuBar
class MenuBar
MenuItem
class MenuItem
MessageBox
class MessageBox
MouseActivatedWidget
class MouseActivatedWidget
MouseActivatedWidget
class MouseActivatedWidget
MouseTrackingWidget
class MouseTrackingWidget

A mouse tracking widget is one that follows the mouse when dragged inside it.

OpenGlWidget
class OpenGlWidget

Nests an opengl capable window inside this window as a widget.

PageWidget
class PageWidget

A page widget is basically a tab widget with hidden tabs.

ProgressBar
class ProgressBar

A progress bar with a known endpoint and completion amount

Radiobox
class Radiobox
RichTextDisplay
class RichTextDisplay
ScrollableWidget
class ScrollableWidget

FIXME ScrollBarShowPolicy

ScrollbarBase
class ScrollbarBase
StaticLayout
class StaticLayout

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.

StaticPosition
class StaticPosition

Bypasses automatic positioning when being laid out. It is your responsibility to make room for this widget in the parent layout.

StatusBar
class StatusBar

Status bars appear at the bottom of a MainWindow. They are made out of Parts, with a width and content.

TabWidget
class TabWidget

A tab widget is a set of clickable tab buttons followed by a content area.

TabWidgetPage
class TabWidgetPage
TextEdit
class TextEdit
TextLabel
class TextLabel
ToolBar
class ToolBar

Toolbars are lists of buttons (typically icons) that appear under the menu. Each button ought to correspond to a menu item.

ToolButton
class ToolButton
VerticalLayout
class VerticalLayout

Stacks the widgets vertically, taking all the available width for each child.

VerticalRule
class VerticalRule

Draws a line

VerticalSpacer
class VerticalSpacer

Adds empty space to a layout.

Widget
class Widget

The way this module works is it builds on top of a SimpleWindow from simpledisplay to provide simple controls and such.

Window
class Window

Enums

ArrowDirection
enum ArrowDirection
EventType
enum EventType
GenericIcons
enum GenericIcons
MessageBoxButton
enum MessageBoxButton

Identifies the button the user pressed on a message box.

MessageBoxIcon
enum MessageBoxIcon
MessageBoxStyle
enum MessageBoxStyle
ScrollBarShowPolicy
enum ScrollBarShowPolicy

For ScrollableWidget, determines when to show the scroll bar to the user.

Functions

dialog
void dialog(void delegate(T) onOK, void delegate() onCancel)

Creates a dialog based on a data structure.

getOpenFileName
void getOpenFileName(void delegate(string) onOK, string prefilledName, string[] filters)
getSaveFileName
void getSaveFileName(void delegate(string) onOK, string prefilledName, string[] filters)
messageBox
MessageBoxButton messageBox(string title, string message, MessageBoxStyle style, MessageBoxIcon icon)
int messageBox(string message, MessageBoxStyle style, MessageBoxIcon icon)

Displays a modal message box, blocking until the user dismisses it.

objectInspectionWindow
ObjectInspectionWindow objectInspectionWindow(T t)

Observes and allows inspection of an object via automatic gui

Structs

EventListener
struct EventListener
WidgetPainter
struct WidgetPainter
accelerator
struct accelerator

Program-wide keyboard shortcut to trigger the action

hotkey
struct hotkey

Group: generating_from_code

icon
struct icon

Group: generating_from_code

label
struct label

Group: generating_from_code

menu
struct menu

tells which menu the action will be on

separator
struct separator

This item in the menu will be preceded by a separator line

tip
struct tip

Group: generating_from_code

toolbar
struct toolbar

Describes which toolbar section the action appears on

Detailed Description

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 To Classes

<input type="text"> = LineEdit <textarea> = TextEdit <select> = DropDownSelection <input type="checkbox"> = Checkbox <input type="radio"> = Radiobox <button> = Button

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.

Overlapped input

COMING SOON: 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.

Add ons

XML definitions

If you use arsd.minigui_xml, you can create widget trees from XML at runtime.

Scriptability

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.

Tip: to allow easy creation of widget trees from script, import arsd.minigui_xml and make arsd.minigui_xml.makeWidgetFromString available to your script:

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.

Meta