fpGUI Toolkit is intended for Open Source and Commercial applications. fpGUI uses the LGPL2 license with the static linking exception - the same as the Free Pascal Compiler's RTL.

fpGUI is an Object Pascal toolkit for cross-platform application development. It provides single-source portability across Linux, MS Windows, *BSD and embedded systems running Embedded Linux and Windows CE.

For more information, see the fpGUI Toolkit website at:

The base unit and starting point of fpGUI

This unit contains all the abstract classes for the CoreLib code of fpGUI. It also defines many types and constants used throughout the toolkit.

When implementing support for a completely new windowing system (eg: Carbon used in Mac OS-X) you would implement all the abstract methods defined in this unit.

A custom type used to represent X and Y coordinates. Internally TfpgCoord is actually a Integer type. We created a custom alias type for use in fpGUI in the event that we might want to change the underlying type in the future. Example to floating points. Represents a color in integer format.

TfpgColor is always in RRGGBB (Red, Green, Blue) format, no matter the operating system.

The fpg_base unit also contains definitions of many useful color constants. It defines the standard predefined Delphi colors (like clRed, clMagenta etc.), the 140 web safe colors using the defacto standard names as used by Netscape and Internet Explorer web browsers. As well as some internal color constants used by many GUI components (like clText, clWindowBackground etc.).

A record structure holding the RGBA values of a color. This is now marked as "deprecated". Please use TFPColor instead. Alpha support has not really been implemented in fpGUI yet. Enum type defining what types of windows can be created. The window being created is a child on another window. This normally means no titlebar or window borders are going to be created. This would specify a standard window with titlebar and window borders. This would specify a standard window with titlebar and window borders. It grabs input focus, and appears in the taskbar. This windows type is similar to wtWindow, but grabs focus. This windows is the same as wtWindow, but grabs the input focus until it has closed. This window normally doesn't appear in the taskbar. This window will normally not have a titlebar or window borders. This window will normally not have a titlebar or window borders and will appear above other windows. It is used for example in the dropdown window of a ComboBox or a tooltip window or popup menus. This type of window does not steal focus. An enum types defining extra attributes of a window. If this attribute is set, the window will be resizeable by the user. If this attribute is set, the underlying window manager will decide where the window will be placed on the screen it it becomes visible for the first time. If this attribute is set, the window will be centred on the screen when it is shown for the first time. A set of TWindowAttribute types. Enum types of the available mouse cursor shapes. Normally the default arrow cursor. Normally a hourglass or watch representing a busy state. Enum types defining how a gradient must be painted Defines that the gradient must be painted vertically. Defines that the gradient must be painted horizontally. Represents the type of entry found on the filesystem. Denotes a File type Denotes a Directory type Represents the clipboard function being triggered by some keyboard key combination. No clipboard action detected Copy to clipboard action detected Paste to clipboard action detected Cut to clipboard action detected Constant representing the left mouse button. Constant representing the right mouse button. Constant representing the middle mouse button. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. Platform independent messages used by fpGUI. A graphical (pixel based) rectangle structure used throughout fpGUI.

Note that this structure is not a class, so static allocations are allowed. This makes it much easier to use in Widgets and in fpGUI internal messages.

Think of the pixel screen/grid like the grid of a spreadsheet (or as a magnified look of the top corner of your screen).

.
     0   1
   +---+---+---
0  | x |   |
   +---+---+---
1  |   |   |
   +---+---+---
2  |   |   |
   +---+---+---
   |   |   |

x is at (0,0). A pixel is always 1x1, you don't get smaller (we are not using sub-pixels like on LCD screens, because they don't apply to all screens).

So with that example, Width = 1 pixel and Height = 1 pixel. In the case of Classes.Bounds() the Right and Bottom values are (1,1) which looking at the above image will be wrong, the pixel only covers one block, so in a screen/pixel environment, Right, Bottom is also (0,0), the same as Top/Left. This is what TfpgRect.Right and TfpgRect.Bottom will report.

.
     0   1
   +---+---+---
0  | x | x |
   +---+---+---
1  | x | x |
   +---+---+---
2  |   |   |
   +---+---+---
   |   |   |

In this example we have a rectangle. Top/Left = (0,0) and Bottom/Right = (1,1). This means Width = 2 pixels and Height = 2 pixels. Clearly visible in the image above.

But if we call Classes.Bounds(0,0,2,2) it reports Bottom/Right as (2,2) which is wrong (again looking at the image above as reference). This is my point. Bounds() cannot be used in this case in a graphical environment.

The reason I don't use a grid layout as shown below, is because if the mouse is over the rectangle containing x, the OS (graphics system) reports its position as (0,0). You don't have to have the mouse pointer over the intersecting lines at (0,0) as indicated in the image below. The whole square containing the x is referenced as (0,0), hence the grid layout as show in the images above, and what fpGUI uses. The same grid layout as used in TfpgStringGrid or any Spreadsheet program etc.

.
   0   1   2
0  +---+---+---
   | x |   |
1  +---+---+---
   |   |   |
2  +---+---+---
   |   |   |
3  +---+---+---
   |   |   |
A convenience function to quickly set a rectangle structure. Calculates and returns the bottom position of the rectangle. Calculates and returns the Right most position of the rectangle. Sets the bottom value and recalculates the Height value. Sets the Right value and recalculates the Width value. Abstract class use for representing a Window or Widget fpGUI is a Windowed toolkit. By that we mean that every component or widget has a window handle. Widgets are essentially embedded windows without titlebars or borders inside a main parent window. Abstract class used to represent a Canvas for painting Abstract class used to represent a Image Inverts the Image Allocates OS resources for the Image Allocates OS resources for the Image Mask Creates a mask based on the sample point presented by X and Y parameters Updates the internal image resources and OS resources from image data Width of the image Height of the image Color depth of the image. Currently 24/32-bit is all that is supported. Array property to access a specific color of the image based on X and Y co-ordinates Encapsulates the resources of a font A abstract class representing a base Interpolation filter. This is used as the base class to implement Interpolation filters like Gaussian, Sinc etc... These decendant filters are used in the Canvas.StretchDraw function. Canvas.StretchDraw Draws a rectangle. You can specify the size of the rectangle via X, Y, Width and Height parameters or via a TfpgRect parameter. Draws a line . This method draws a line from (x1,y1) to (x2,y2), but does not draw the last pixel. All supported backends follow the Microsoft API and doesn't draw the last pixel. This optimises consecutive lines being drawn without overlapping pixels. Returns the text representation of a keycode. This is mainly used for debugging, but could also be used for Menu Item keyboard shortcuts etc. Detects if the pressed keys represent a Clipboard key shortcut Detects if the pressed keys represent a Clipboard key shortcut. If it does, it returns the correct enum type detected. Converts the TfpgColor to TRGBTriple type This function converts the given TfpgColor into a TRGBTriple type. TRGBTriple Converts the TRGBTriple to TfpgColor type This function converts the given TRGBTriple into a TfpgColor type. TRGBTriple Returns the Red portion of a color value. Returns the Green portion of a color value. Returns the Blue portion of a color value. Returns the Alpha portion of a color value. Calculates the average color using the two supplied This function calculates and returns the average color by using AColor1 and AColor2. The Alpha value also gets taken into account. Returns true if APoint is inside ARect rectangle This function is used to detect if the point APoint is inside the given rectangle ARect. If it is, the function returns True, otherwise False. Fixes the Top, Bottom and Left, Right to always represent a valid rectangle This function fixes a rectangle so that the Left point is always smaller than the Right. And the Top is always smaller than the Bottom. Draws a line inside a clip rectangle

. This procedure clips a line to the AClipRect boundaries and then calls the DrawLine procedure with the clipped coordinates. If the line lies completely outside of the clip boundary, then the Line routine is not called. This procedure uses the well known Cohen-Sutherland line clipping algorithm to clip each coordinate.

Use this if you did not what to change the Canvas.ClipRegion for some reason. For a detailed explanation see: http://www.nondot.org/~sabre/graphpro/line6.html

Clips the line based on AClipRect boundaries. This does not do any drawing, in only clips the line coordinates. This method is used internally by . A simple data object representing a file . Some properties are OS dependant. Name of a file The extension of a file Size of a file in bytes Is this item a symbolic link (on unix-type OSes) If it is a symbolic link, LinkTarget is what it points too Last modified timestamp A record structure holding the RGBA values of a color. This is the same declaration as the one found in FPImage (include with Free Pascal Compiler). In future when FPImage is integrated with fpGUI, I will remove this declaration.