fltk.window
FLTK Window Class
This module provides the Window class that wraps FLTK's Fl_Window. Windows are top-level containers that can be displayed on screen.
The Window class provides:
- RAII-based resource management
- Size and position control
- Title management
- Resizable window support
- Child widget management (via Group base)
License
BSD-3-ClauseCopyright
Copyright © 2025 DDN (D Developer Network) Members
Types 4
Top-level window widget.
Windows are containers that can be displayed on the screen. They can contain child widgets and handle user input.
Example:
auto window = new Window(640, 480, "My Application");
window.sizeRange(320, 240); // Set minimum size
window.show();
run();WindowPtr _windowHandleThe underlying window handle (more specific than Widget's handle)string _titleStored title for referencevoid title(string newTitle)Sets the window title.void sizeRange(int minWidth, int minHeight, int maxWidth = 0, int maxHeight = 0) nothrow @nogcSets the window's size range (minimum and maximum size).this(int width, int height, string title = null)Creates a new window with the specified size.this(int x, int y, int width, int height, string title = null)Creates a new window with position and size.~thisDestroys the window and releases resources.Double-buffered window widget.
DoubleWindow provides flicker-free rendering by using double buffering. All drawing is done to an off-screen buffer, then copied to the screen in a single operation. This eliminates flicker during complex redraws.
Use DoubleWindow instead of Window when:
- The window contains animations
- Widgets are frequently updated
- You need smooth, flicker-free rendering
Example:
auto window = new DoubleWindow(640, 480, "Smooth Animation");
// Add widgets...
window.show();
run();DoubleWindowPtr _doubleWindowHandleThe underlying double window handlestring _titleStored title for referenceDoubleWindowPtr doubleWindowHandle() @safe nothrow @nogcReturns the underlying double window handle.void title(string newTitle)Sets the window title.this(int width, int height, string title = null)Creates a new double-buffered window with the specified size.~thisDestroys the window and releases resources.Single-buffered window widget.
SingleWindow forces single buffering even on systems that default to double buffering. This can be useful for:
- Programs that use incremental update
- Displaying certain types of image data like movie flipbooks
- Legacy programs that expect single-buffered behavior
Example:
auto window = new SingleWindow(640, 480, "Single Buffered");
// Add widgets...
window.show();
run();SingleWindowPtr _singleWindowHandleThe underlying single window handlestring _titleStored title for referenceSingleWindowPtr singleWindowHandle() @safe nothrow @nogcReturns the underlying single window handle.void title(string newTitle)Sets the window title.this(int width, int height, string title = null)Creates a new single-buffered window with the specified size.this(int x, int y, int width, int height, string title = null)Creates a new single-buffered window with position and size.~thisDestroys the window and releases resources.Menu window widget.
MenuWindow is a window type specifically designed for popup menus. It uses hardware overlay planes if available for flicker-free display. When overlay planes are not available, it falls back to normal drawing.
Example:
auto menu = new MenuWindow(150, 200);
menu.setOverlay(); // Use hardware overlay if available
// Add menu items...
menu.show();MenuWindowPtr _menuWindowHandleThe underlying menu window handlestring _titleStored title for referencevoid title(string newTitle)Sets the window title.this(int width, int height, string title = null)Creates a new menu window with the specified size.this(int x, int y, int width, int height, string title = null)Creates a new menu window with position and size.~thisDestroys the window and releases resources.