Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
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.
1. Features
-
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
2. Project Structure
| 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 |
3. Building
3.1. Prerequisites
-
Free Pascal Compiler 3.2.2 or later
-
PasBuild build tool (optional but recommended)
3.1.1. Linux / FreeBSD
Install the X11 development libraries:
sudo apt-get install libx11-dev libxft-dev libxext-dev
libxext-dev provides libXext.so, which the X11 backend links against for the
XSync extension. Distributions that ship only the runtime libXext.so.6 will
fail at link time with cannot find -lXext.
3.2. Compiling the Framework
Using 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 symbols
3.4. Compiling Everything
To compile the entire project (framework, applications, examples, and tools):
pasbuild compile -p unix pasbuild compile -p windows
3.5. Compiling Individual Applications
To compile a specific module:
# DocView pasbuild compile -m fpgui-docview -p unix # UI Designer pasbuild compile -m fpgui-uidesigner -p unix # All examples at once pasbuild compile -m fpgui-examples -p unix # A specific example (e.g. MigLayout demo) pasbuild compile -m examples-gui-lmmig -p unix
4. Quick Start
program 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.
5. Licensing
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) |
7. Links
-
Repository: https://github.com/graemeg/fpgui
-
Free Pascal Compiler: https://www.freepascal.org