FpGUI
Encyclopedia
fpGUI, the Free Pascal GUI
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

 toolkit, is a cross-platform
Cross-platform
In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

 graphical user interface toolkit developed by Graeme Geldenhuys. fpGUI is open source and free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

, licensed under a Modified LGPL license. The toolkit has been implemented using the Free Pascal
Free Pascal
Free Pascal Compiler is a free Pascal and Object Pascal compiler.In addition to its own Object Pascal dialect, Free Pascal supports, to varying degrees, the dialects of several other compilers, including those of Turbo Pascal, Delphi, and some historical Macintosh compilers...

 compiler, meaning it is written in the Object Pascal
Object Pascal
Object Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.-Early history at Apple:...

 language.

fpGUI consists only of graphical widgets or components and a cross-platform 2D drawing library. It doesn't implement database layers, 3D graphics, XML parsers etc. It also doesn't rely on any huge third party libraries like GTK or Qt. All the extras come straight from what is available with the Free Pascal Component Library (FCL) which comes standard with the Free Pascal
Free Pascal
Free Pascal Compiler is a free Pascal and Object Pascal compiler.In addition to its own Object Pascal dialect, Free Pascal supports, to varying degrees, the dialects of several other compilers, including those of Turbo Pascal, Delphi, and some historical Macintosh compilers...

 compiler.

History

The first version of fpGUI was written by Sebastian Günther back in 2000. The project was then abandoned in 2002. fpGUI was a successor to an earlier OO GTK wrapper, fpGTK, and was pretty much a fresh start to allow multiple (backend) widgetsets, most notably win32. The toolkit was used for some internal FPC tooling (e.g. the fpdoc editor), but there were still a lot of things outstanding before the toolkit could be truly useful and used in real life applications by end-users. Most of these tools where migrated to the maturing Lazarus in the 2004-2006 timeframe.

Graeme Geldenhuys revived the toolkit in mid 2006 where Sebastian left off. He continued developing the toolkit for the next year. Merging three sub-projects (fpGFX, fpIMG and fpGUI) into a single project fpGUI. Graeme extended the amount of components and backend graphics layer and improving the overall toolkit. The supported platforms at that stage was Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 and FreeBSD
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

 via X11 and Microsoft Windows via GDI. After a few months Felipe Monteiro de Carvalho joined the development team adding support for Windows Mobile devices and extending the graphics support and design. Felipe also started working on Mac OS X support via Carbon.

Current

At the beginning of June 2007 Graeme found some major design issues in the source base. This prevented fpGUI from being truly useful in real applications. After numerous prototypes the fpGUI project was completely rewritten. Past experience helped a lot and new design ideas were implemented. The code base ended up being much simpler with a cleaner design. One of the major changes was that all widgets were now based on a multi-handle (windowed) design. Each widget now has a window handle. Other GUI toolkits that follow a similar design are GTK, Xt
Intrinsics
X Toolkit Intrinsics is a library used in the X Window System. More precisely, it is a library that uses the low-level Xlib library and provides a friendly API to develop X11 software with graphical widgets...

 and FLTK
FLTK
FLTK is a cross-platform GUI library developed by Bill Spitzak and others. Made with 3D graphics programming in mind, it has an interface to OpenGL, but it is also suitable for general GUI programming....

 to name a few. GUI toolkits that follow the opposite design are toolkits like the latest Qt and MSEgui.

Example Program

The following program shows a single window with a "Quit" button in the bottom right. On the canvas (background) of the window it paints all the standard built-in images used with fpGUI.

program stdimglist;

{$mode objfpc}{$H+}

uses
Classes, SysUtils,
fpg_base, fpg_main, fpg_form, fpg_imgfmt_bmp, fpg_button;

type

TMainForm = class(TfpgForm)
private
btnClose: TfpgButton;
procedure btnCloseClick(Sender: TObject);
protected
procedure HandlePaint; override;
public
constructor Create(aowner: TComponent); override;
procedure AfterCreate; override;
end;

{ TMainForm }

procedure TMainForm.AfterCreate;
begin
SetPosition(100,100,700,500);
WindowTitle := 'fpGUI Standard Image Listing';
end;

procedure TMainForm.btnCloseClick(Sender: TObject);
begin
Close;
end;

procedure TMainForm.HandlePaint;
var
n: integer;
x: TfpgCoord;
y: TfpgCoord;
sl: TStringList;
img: TfpgImage;
begin
Canvas.BeginDraw; // begin double buffering
inherited HandlePaint;

sl := TStringList.Create;
x := 8;
y := 8;
fpgImages.ListImages(sl);

for n := 0 to sl.Count-1 do
begin
Canvas.DrawString(x, y, sl[n]+':');

img := TfpgImage(sl.Objects[n]);
if img <> nil then
Canvas.DrawImage(x+130, y, img);

inc(y, img.Height+8);
if y > Height-32 then // largest images are 32 in height
begin
inc(x, 200);
y := 8;
end;
end;

Canvas.EndDraw;
sl.Free;
end;

constructor TMainForm.Create(aowner: TComponent);
begin
inherited Create(aowner);
// Place button in bottom right corner.
btnClose := CreateButton(self, Width-90, Height-35, 75, 'Quit', @btnCloseClick);
btnClose.ImageName := 'stdimg.quit';
btnClose.Anchors := [anRight, anBottom];
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.


Here is a screenshot of the above program when run under Linux.


Licensing

fpGUI is statically linked into programs and is licensed using a modified version of LGPL specially designed to allow static linking to proprietary programs. The only code you need to make available are any changes you made to the fpGUI toolkit - nothing more.

Software written with fpGUI

  • Master Maths
    Used in a computer based training system. As well as a basic accounting and administration package for franchisees.
  • A Visual Form Designer which is now included as part of fpGUI. It allows the developer to create user interfaces at a much faster pace.
  • Unimesur and various tools
    Written by Jean-Marc, the Unimesur program allows to convert measurements of flows of liquids and gases, between mass and volume units. All results were verified for the exactness of the conversion factors.
  • fpGUI DocView
    An INF help file
    Information Presentation Facility
    Information Presentation Facility is a system for presenting online help and hypertext on IBM OS/2 systems. IPF also refers to the markup language that is used to create IPF content. The IPF language has its origins in BookMaster and Generalized Markup Language developed by IBM...

     viewer that currently works on Windows, Linux and FreeBSD. INF is the default help format of fpGUI, and is also the help format used in OS/2
    OS/2
    OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

     (and eComStation
    EComStation
    eComStation or eCS is a PC operating system based on OS/2, published by Serenity Systems. It includes several additions and accompanying software not present in the IBM version of the system.-Differences between eComStation and OS/2:...

    ).

See also

  • Lazarus (software)
    Lazarus (software)
    Lazarus is a free cross-platform IDE which provides a Delphi-like development experience for Pascal and Object Pascal developers. It is developed for, and supported by, the Free Pascal compiler. Since early 2008, Lazarus has been available for Microsoft Windows, several Linux distributions,...

  • Widget toolkit
    Widget toolkit
    In computing, a widget toolkit, widget library, or GUI toolkit is a set of widgets for use in designing applications with graphical user interfaces...

  • Qt
    Qt (toolkit)
    Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...

  • wxWidgets
    WxWidgets
    wxWidgets is a widget toolkit for creating graphical user interfaces for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with minimal or no code changes...

  • GTK+
    GTK+
    GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...

  • FOX toolkit
    FOX toolkit
    The FOX toolkit is an open source, cross-platform widget toolkit, that is, a library of basic elements for building a graphical user interface...

  • FLTK
    FLTK
    FLTK is a cross-platform GUI library developed by Bill Spitzak and others. Made with 3D graphics programming in mind, it has an interface to OpenGL, but it is also suitable for general GUI programming....


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK