fltk.multilabel

Multi-label module for FLTK.

This module provides the MultiLabel class for creating compound labels with multiple parts (text + image, etc.) that can be applied to widgets and menu items.

Example:

import fltk.multilabel;
import fltk.widgets;

// Create a multi-label with icon and text
auto ml = new MultiLabel();
ml.setLabelAImage(myIcon);
ml.setLabelBText("  Open File");

// Apply to a button
ml.label(myButton);

Types 2

enumLabelType : int

Label type constants.

These determine how each part of a multi-label is interpreted. Values match FLTK's Fl_Labeltype enum.

NORMAL = 0Normal text label (FLNORMALLABEL)
NO_LABEL = 1No label (FLNOLABEL)
SHADOW = 2Text with shadow (FLSHADOW_LABEL)
ENGRAVED = 3Engraved text (FLENGRAVED_LABEL)
EMBOSSED = 4Embossed text (FLEMBOSSED_LABEL)
MULTI = 5Chained multi-label (FLMULTI_LABEL)
ICON = 6Icon label (FLICON_LABEL)
IMAGE = 7Image label (FLIMAGE_LABEL)

Class for creating compound labels with multiple parts.

MultiLabel allows combining text and images into a single label that can be applied to widgets or menu items. This is particularly useful for menu items that need both an icon and text.

Each MultiLabel has two parts: labelA (left) and labelB (right). Either part can be text or an image. Multiple MultiLabels can be chained together for more complex labels.

Example:

// Create icon + text label for a menu item
auto ml = new MultiLabel();
ml.setLabelAImage(folderIcon);
ml.setLabelBText("  Open Folder");

// Apply to menu item
ml.label(menuBar, itemIndex);

// Create text + text label for a widget
auto ml2 = new MultiLabel();
ml2.setLabelAText("Status: ");
ml2.setLabelBText("Ready");
ml2.label(statusWidget);

Note

The MultiLabel object must remain valid for the lifetime of

the widget/menu item it is applied to, as FLTK stores a pointer to it.

Fields
private MultiLabelPtr handle
private string textA
private string textB
Methods
void setLabelAText(string text)Sets the first (left) label element as text.
void setLabelBText(string text)Sets the second (right) label element as text.
void setLabelAImage(ImagePtr image) nothrow @nogcSets the first (left) label element as an image.
void setLabelBImage(ImagePtr image) nothrow @nogcSets the second (right) label element as an image.
LabelType typeA() nothrow @nogcGets the type of the first (left) label element.
LabelType typeB() nothrow @nogcGets the type of the second (right) label element.
void label(WidgetPtr widget) nothrow @nogcAssociates this multi-label with a widget.
void label(MenuBarPtr menu, int index) nothrow @nogcAssociates this multi-label with a menu item.
MultiLabelPtr ptr() nothrow @nogcReturns the underlying handle pointer.
Constructors
this()Creates a new multi-label.
Destructors