fltk.layout
FLTK Layout Widgets
This module provides layout container widgets:
- Pack: Automatic widget arrangement (horizontal or vertical)
- Tabs: Tabbed container with multiple pages
- Scroll: Scrollable container for content larger than view
- Tile: Resizable tile container (drag borders to resize)
- Wizard: Step-by-step wizard with prev/next navigation
- Spinner: Numeric input with increment/decrement buttons
License
BSD-3-ClauseCopyright
Copyright © 2025 DDN (D Developer Network) Members
Types 6
Pack layout widget for automatic widget arrangement.
Pack arranges its children automatically in a horizontal or vertical line, with optional spacing between widgets.
Example:
auto pack = new Pack(10, 10, 300, 200);
pack.setVertical();
pack.spacing = 5;
pack.begin();
auto btn1 = new Button(0, 0, 100, 25, "Button 1");
auto btn2 = new Button(0, 0, 100, 25, "Button 2");
pack.end();PackPtr _packHandlevoid spacing(int pixels)Sets the spacing between children.void setHorizontal()Sets the pack to horizontal layout.void setVertical()Sets the pack to vertical layout.void begin()void end()this(int x, int y, int width, int height, string label = null)Creates a new pack widget.Tabs container widget with multiple pages.
Tabs displays a tabbed interface where each child widget represents a page. The child's label becomes the tab label.
Example:
auto tabs = new Tabs(10, 10, 300, 200);
tabs.begin();
auto page1 = new Group(15, 35, 290, 165, "Page 1");
page1.end();
auto page2 = new Group(15, 35, 290, 165, "Page 2");
page2.end();
tabs.end();TabsPtr _tabsHandleWidgetPtr selectedTab()Gets the currently selected tab.void selectedTab(Widget tab)Sets the currently selected tab.void begin()void end()this(int x, int y, int width, int height, string label = null)Scrollable container widget.
Scroll provides a scrollable view for content that is larger than the visible area. Scrollbars appear automatically when needed.
Example:
auto scroll = new Scroll(10, 10, 200, 150);
scroll.begin();
auto bigBox = new Box(0, 0, 400, 400, "Large content");
scroll.end();
scroll.scrollTo(100, 100);ScrollPtr _scrollHandlevoid scrollTo(int x, int y)Scrolls to a specific position.int xposition()Gets the current horizontal scroll position.int yposition()Gets the current vertical scroll position.void begin()void end()this(int x, int y, int width, int height, string label = null)Tile container widget with resizable children.
Tile allows users to resize children by dragging the borders between them.
Example:
auto tile = new Tile(10, 10, 400, 300);
tile.begin();
auto left = new Box(0, 0, 200, 300, "Left");
auto right = new Box(200, 0, 200, 300, "Right");
tile.end();TilePtr _tileHandlethis(int x, int y, int width, int height, string label = null)Wizard container widget for step-by-step interfaces.
Wizard shows one child at a time, with next/prev navigation for creating step-by-step wizards or slideshows.
Example:
auto wizard = new Wizard(10, 10, 300, 200);
wizard.begin();
auto page1 = new Group(0, 0, 300, 200);
auto page2 = new Group(0, 0, 300, 200);
wizard.end();
wizard.next(); // show page2WizardPtr _wizardHandlethis(int x, int y, int width, int height, string label = null)Spinner widget with input field and increment/decrement buttons.
Spinner combines a numeric input field with buttons for incrementing and decrementing the value.
Example:
auto spinner = new Spinner(10, 10, 100, 25, "Value:");
spinner.minimum = 0;
spinner.maximum = 100;
spinner.value = 50;
spinner.step = 1;SpinnerPtr _spinnerHandlethis(int x, int y, int width, int height, string label = null)