fltk.app
FLTK Application and Event Loop Helpers
This module provides functions for running the FLTK event loop and managing timeouts and idle callbacks.
The event loop is the core of any FLTK application. It processes user input, window events, and triggers callbacks.
Example:
import fltk;
void main() {
auto window = new Window(300, 200, "My App");
window.show();
run(); // Blocks until all windows are closed
}
License
BSD-3-Clause
Copyright
Copyright © 2025 DDN (D Developer Network) Members
fn _addFdHandler _fdCallbackDispatcher _removeFdHandler addFd addIdle addTimeout awake check copy dnd eventLength eventText fltkAbiVersion fltkApiVersion fltkVersion flush getDamage getOption getSystemColors hasIdle hasTimeout lock ownColormap ready redrawAll removeFd removeIdle removeTimeout requestVisual run scheme screenBounds screenCount screenDpi screenWorkArea scrollbarSize setBackground setBackground2 setDisplay setForeground setOption setScheme setScrollbarSize unlock wait
Types 9
aliasTimeoutCallback = void delegate()
Callback type for timeouts and idle handlers.
enumScheme
Available UI schemes.
noneDefault FLTK look
gtkGTK+ inspired look
gleamGleam scheme (modern look)
plasticPlastic scheme (shiny buttons)
oxyOxygen scheme
enumClipboardType
Clipboard destination/source.
selection = 0X11 selection buffer (middle-click paste)
clipboard = 1System clipboard (Ctrl+V paste)
enumFdEvent
File descriptor event types.
read = 1Data available to read
write = 4Ready for writing
except = 8Exception/error condition
aliasFdHandler = void delegate(int fd) nothrow @nogc
File descriptor callback delegate type.
structScreenInfo
Screen/monitor information.
Fields
int xint yint widthint heightstructScreenDpi
Screen DPI information.
Fields
float horizontalfloat verticalenumVisualMode
Visual mode flags for requesting specific display capabilities.
RGB = 0RGB color (default)
INDEX = 1Indexed color
DOUBLE = 2Double buffering
ACCUM = 4Accumulation buffer
ALPHA = 8Alpha blending
DEPTH = 16Depth buffer
STENCIL = 32Stencil buffer
RGB8 = 648-bit RGB
MULTISAMPLE = 128Anti-aliasing
STEREO = 256Stereo display
FAKE_SINGLE = 512Fake single buffering
enumOption
FLTK option indices.
ARROW_FOCUS = 0Arrow keys move focus between widgets
VISIBLE_FOCUS = 1Show visible focus rectangle
DND_TEXT = 2Enable drag-and-drop for text
SHOW_TOOLTIPS = 3Show tooltips
FNFC_USES_GTK = 4Native file chooser uses GTK
PRINTER_USES_GTK = 5Printer dialog uses GTK
SHOW_SCALING = 6Show scaling factor in title
Functions 47
fn
void copy(string text, ClipboardType destination = ClipboardType.clipboard)Copies text to the clipboard.fn
void addFd(int fd, FdEvent events, FdHandler handler) nothrow @nogcAdds a file descriptor callback.fn
void addFd(int fd, FdHandler handler) nothrow @nogcAdds a file descriptor callback for read events.fn
void removeFd(int fd, FdEvent events = cast(FdEvent) 0)nothrow nothrow @nogcRemoves a file descriptor callback.fn
ScreenInfo screenWorkArea(int screen = 0) nothrow @nogcGets the work area of a screen (excluding taskbars, docks, etc.).fn
void setForeground(ubyte r, ubyte g, ubyte b) nothrow @nogc @trustedSets the default foreground (label) color.fn
void setBackground(ubyte r, ubyte g, ubyte b) nothrow @nogc @trustedSets the default background color for widgets.fn
void setBackground2(ubyte r, ubyte g, ubyte b) nothrow @nogc @trustedSets the default background color for text input widgets.fn
void setScrollbarSize(int width) nothrow @nogc @trustedSets the default scrollbar width in pixels.Variables 6
private enumvar
MAX_FD_HANDLERS = 64private var
int[MAX_FD_HANDLERS] _fdKeysprivate var
int _fdCount = 0