fpGUI is a cross-platform GUI toolkit written entirely in Object Pascal using the Free Pascal Compiler. It provides a custom-drawn widget set that renders consistently across all supported platforms, with no external widget toolkit dependencies. All rendering is done through the built-in AggPas hybrid canvas, which uses platform APIs (X11, GDI, Cocoa) for window management and input while delivering fully platform-independent, pixel-perfect output via software rasterisation.
-
Cross-platform: Linux (X11), Windows (GDI), macOS (Cocoa), FreeBSD, OpenSolaris
-
AggPas hybrid canvas: Platform-independent rendering via 100% Object Pascal software rasteriser
-
No external dependencies: No GTK, Qt, or other widget toolkit required
-
Custom-drawn widgets: Consistent look and feel across all platforms
-
Themeable: Multiple built-in styles including plastic and dark themes
-
Layout managers: MigLayout (ported from Java), FlowLayout, and BorderLayout
-
Fluent constraint API: LC, AC, and CC classes for concise layout definitions
-
Rich widget set: Buttons, edits, grids, treeviews, listviews, menus, tabs, scrollbars, and more
-
Visual form designer: UI Designer for rapid form creation
-
PDF reporting engine: Built-in report generation with print preview
-
Drag and drop: OS-independent DND support between applications and widgets
-
Unicode support: Full Unicode text input and rendering
-
Documentation viewer: DocView application for viewing INF/IPF help files
| Directory | Description |
|---|---|
|
Core fpGUI framework source |
|
Unit tests |
|
Visual UI Designer application |
|
Documentation viewer (INF/IPF file viewer) |
|
Example applications and widget demos |
|
Third-party contributed components |
-
Free Pascal Compiler 3.2.2 or later
-
PasBuild build tool (optional but recommended)
Install the X11 development libraries:
sudo apt-get install libx11-dev libxft-devUsing PasBuild from the project root:
# Linux / FreeBSD
pasbuild compile -m fpgui-framework -p unix
pasbuild compile -m fpgui-framework -p unix,debug # with debug symbols
# Windows
pasbuild compile -m fpgui-framework -p windows
pasbuild compile -m fpgui-framework -p windows,debug # with debug symbolsprogram ContactForm;
{$mode objfpc}{$H+}
uses
fpg_base, fpg_main, fpg_form, fpg_label, fpg_edit, fpg_button,
fpg_miglayout, fpg_mig_lc, fpg_mig_cc;
type
TMainForm = class(TfpgForm)
public
procedure AfterCreate; override;
end;
procedure TMainForm.AfterCreate;
var
mig: TfpgMigLayoutManager;
lbl: TfpgLabel;
edt: TfpgEdit;
btn: TfpgButton;
begin
inherited AfterCreate;
WindowTitle := 'Contact Form';
Width := 400;
Height := 200;
// Create a 2-column MigLayout grid
mig := TfpgMigLayoutManager.Create;
mig.LC.SetWrapAfter(2);
LayoutManager := mig;
// Row 1: Name
lbl := TfpgLabel.Create(Self);
lbl.Text := 'Name:';
mig.AddLayoutComponent(lbl, TfpgMigCC.Create());
edt := TfpgEdit.Create(Self);
edt.PreferredSize := fpgSize(200, 24);
mig.AddLayoutComponent(edt, TfpgMigCC.Create().GrowX());
// Row 2: Email
lbl := TfpgLabel.Create(Self);
lbl.Text := 'Email:';
mig.AddLayoutComponent(lbl, TfpgMigCC.Create());
edt := TfpgEdit.Create(Self);
edt.PreferredSize := fpgSize(200, 24);
mig.AddLayoutComponent(edt, TfpgMigCC.Create().GrowX());
// Row 3: Buttons spanning both columns
btn := TfpgButton.Create(Self);
btn.Text := 'OK';
btn.PreferredSize := fpgSize(80, 24);
mig.AddLayoutComponent(btn, TfpgMigCC.Create().SpanX.Split(2).Tag('ok'));
btn := TfpgButton.Create(Self);
btn.Text := 'Cancel';
btn.PreferredSize := fpgSize(80, 24);
mig.AddLayoutComponent(btn, TfpgMigCC.Create().Tag('cancel'));
end;
procedure MainProc;
var
frm: TMainForm;
begin
fpgApplication.Initialize;
frm := TMainForm.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
frm.Free;
end;
end;
begin
MainProc;
end.The fpGUI framework is distributed under the LGPL-2.1 with a static linking exception (Modified LGPL), the same license model used by the Free Pascal RTL and Lazarus LCL. This permits use in both open-source and proprietary applications without requiring the application source to be published.
See license.ModifiedLGPL.txt and license.LGPL2.txt for full details.
| Component | License |
|---|---|
Framework ( |
Modified LGPL |
UI Designer ( |
Modified LGPL |
DocView ( |
GPLv2 |
Examples ( |
GPLv2 |
Extras ( |
Various (see specific directories) |
-
Repository: https://github.com/graemeg/fpgui
-
Free Pascal Compiler: https://www.freepascal.org