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.

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.

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

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
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.

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
MouseCursor
class MouseCursor

Represents a mouse cursor (aka the mouse pointer, the image seen on screen that indicates where the mouse is pointing). See GenericCursor

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
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
GenericCursorType
enum GenericCursorType
GenericIcons
enum GenericIcons
ScrollBarShowPolicy
enum ScrollBarShowPolicy

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

Functions

getOpenFileName
void getOpenFileName(void delegate(string) onOK, string prefilledName = null, string[] filters = null)
getSaveFileName
void getSaveFileName(void delegate(string) onOK, string prefilledName = null, string[] filters = null)

Structs

EventListener
struct EventListener
GenericCursor
struct GenericCursor

You get one by GenericCursor.SomeTime. See GenericCursorType for a list of types.

accelerator
struct accelerator

Program-wide keyboard shortcut to trigger the action

icon
struct icon
menu
struct menu

tells which menu the action will be on

seperator
struct seperator

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

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:

1 import arsd.minigui_xml;
2 import arsd.script;
3 
4 var globals = var.emptyObject;
5 globals.makeWidgetFromString = &makeWidgetFromString;
6 
7 // this now works
8 interpret(`var window = makeWidgetFromString("<MainWindow />");`, globals);

More to come.

Suggestion Box / Bug Report