diff --git a/examples/gui/aboutdialog/aboutdialog.lpi b/examples/gui/aboutdialog/aboutdialog.lpi
new file mode 100644
index 000000000..a9b5e87bd
--- /dev/null
+++ b/examples/gui/aboutdialog/aboutdialog.lpi
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
diff --git a/examples/gui/aboutdialog/aboutdialog.lpr b/examples/gui/aboutdialog/aboutdialog.lpr
new file mode 100644
index 000000000..e200242d2
--- /dev/null
+++ b/examples/gui/aboutdialog/aboutdialog.lpr
@@ -0,0 +1,114 @@
+{
+ Demo app to show TfpgAbout
+ Written by Jonathan A. Foster
+ Started April 10th, 2019
+
+ This unit is part of the fpGUI Toolkit project.
+
+ Copyright (c) 2006 - 2019 by Graeme Geldenhuys.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about redistributing fpGUI.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+}
+program aboutdialog;
+
+{$mode objfpc}{$H+}
+
+uses
+ SysUtils,
+ Classes,
+ fpg_constants,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_button,
+ fAbout;
+
+
+{@VFD_NEWFORM_DECL}
+
+{@VFD_NEWFORM_IMPL}
+
+
+
+{*********************************************************************
+ * Main Form *
+ *********************************************************************}
+type
+ TfrmMain = class(TfpgForm)
+ public
+ {@VFD_HEAD_BEGIN: frmMain}
+ click_me: TfpgButton;
+ {@VFD_HEAD_END: frmMain}
+
+ procedure AfterCreate; override;
+ procedure clicked(Sender: TObject);
+ end;
+
+
+
+ procedure TfrmMain.AfterCreate;
+ begin
+ inherited AfterCreate;
+ {@VFD_BODY_BEGIN: frmMain}
+ Name := 'frmMain';
+ SetPosition(0, 0, 100, 100);
+ WindowPosition := wpAuto;
+
+ click_me := TfpgButton.Create(self);
+ with click_me do
+ begin
+ Name := 'click_me';
+ SetPosition(0, 0, 100, 100);
+ anchors := [anLeft, anTop, anRight, anBottom];
+ Text := 'Click Me!';
+ OnClick := @clicked;
+ end;
+ {@VFD_BODY_END: frmMain}
+ end;
+
+
+
+ procedure TfrmMain.clicked(Sender: TObject);
+ begin
+ if AboutDlg = mrOk then
+ Close;
+ end;
+
+
+
+{*********************************************************************
+ * Launch control *
+ *********************************************************************}
+var
+ main: TfrmMain;
+ app: TfpgApplication;
+begin
+
+ app := fpgApplication;
+ app.Initialize;
+ app.AppTitle := 'A Demo About Box';
+ app.AppVersion := FPGUI_VERSION;
+ app.AppAuthor := 'jon@jfpossibilties.com';
+ app.AppCopyright := '(c) 2019 the fpGUI project GPL2';
+ app.AppSiteName := 'fpgui.SF.net';
+ app.AppSiteURL := fpGUIWebsite;
+ app.AppIcon := 'stdimg.dlg.info';
+ { set these for the about box to link to a help topic in your help file
+ when the license statement is clicked:
+ app.AppLicTopic := 0;
+ app.HelpFile := 'myhelp.inf'; }
+ app.HelpContext := 10;
+ main := TfrmMain.Create(nil);
+ try
+ main.Show;
+ app.run;
+ finally
+ main.Free;
+ end;
+end.
diff --git a/examples/gui/helloworld/helloworld.lpr b/examples/gui/helloworld/helloworld.lpr
index e25a47573..5c1ac986c 100644
--- a/examples/gui/helloworld/helloworld.lpr
+++ b/examples/gui/helloworld/helloworld.lpr
@@ -17,7 +17,7 @@ THelloWorldForm = class(TfpgForm)
procedure ButtonClick(Sender: TObject);
private
Button: TfpgButton;
- protected
+ public
procedure AfterCreate; override;
end;
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index ed187019f..a9cdcf026 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -141,6 +141,200 @@ EfpGUIUserFeedbackException = class(EfpGUIException);
UserNamedColorStart = 128;
{$I predefinedcolors.inc}
+type
+ TfpgIdentMapEntry = record
+ Value: longword;
+ Name: string;
+ end;
+
+const
+ fpgColors: array[0..184] of TfpgIdentMapEntry = (
+ (Value: clAqua; Name: 'clAqua'),
+ (Value: clBlack; Name: 'clBlack'),
+ (Value: clBlue; Name: 'clBlue'),
+ (Value: clCream; Name: 'clCream'),
+ (Value: clDkGray; Name: 'clDkGray'),
+ (Value: clFuchsia; Name: 'clFuchsia'),
+ (Value: clGray; Name: 'clGray'),
+ (Value: clGreen; Name: 'clGreen'),
+ (Value: clLime; Name: 'clLime'),
+ (Value: clLtGray; Name: 'clLtGray'),
+ (Value: clMaroon; Name: 'clMaroon'),
+ (Value: clNavy; Name: 'clNavy'),
+ (Value: clOlive; Name: 'clOlive'),
+ (Value: clPurple; Name: 'clPurple'),
+ (Value: clRed; Name: 'clRed'),
+ (Value: clSilver; Name: 'clSilver'),
+ (Value: clTeal; Name: 'clTeal'),
+ (Value: clWhite; Name: 'clWhite'),
+ (Value: clYellow; Name: 'clYellow'),
+ (Value: clNone; Name: 'clNone'),
+ (Value: clDefault; Name: 'clDefault'),
+ (Value: clMoneyGreen; Name: 'clMoneyGreen'),
+ (Value: clSkyBlue; Name: 'clSkyBlue'),
+ (Value: clMedGray; Name: 'clMedGray'),
+ (Value: clUIDesignerGreen; Name: 'clUIDesignerGreen'),
+ (Value: cl_BaseNamedColor; Name: 'cl_BaseNamedColor'),
+ (Value: clWindowBackground; Name: 'clWindowBackground'),
+ (Value: clBoxColor; Name: 'clBoxColor'),
+ (Value: clButtonFace; Name: 'clButtonFace'),
+ (Value: clShadow1; Name: 'clShadow1'),
+ (Value: clShadow2; Name: 'clShadow2'),
+ (Value: clHilite1; Name: 'clHilite1'),
+ (Value: clHilite2; Name: 'clHilite2'),
+ (Value: clText1; Name: 'clText1'),
+ (Value: clText2; Name: 'clText2'),
+ (Value: clText3; Name: 'clText3'),
+ (Value: clText4; Name: 'clText4'),
+ (Value: clSelection; Name: 'clSelection'),
+ (Value: clSelectionText; Name: 'clSelectionText'),
+ (Value: clInactiveSel; Name: 'clInactiveSel'),
+ (Value: clInactiveSelText; Name: 'clInactiveSelText'),
+ (Value: clScrollBar; Name: 'clScrollBar'),
+ (Value: clListBox; Name: 'clListBox'),
+ (Value: clGridLines; Name: 'clGridLines'),
+ (Value: clGridHeader; Name: 'clGridHeader'),
+ (Value: clWidgetFrame; Name: 'clWidgetFrame'),
+ (Value: clInactiveWgFrame; Name: 'clInactiveWgFrame'),
+ (Value: clTextCursor; Name: 'clTextCursor'),
+ (Value: clChoiceListBox; Name: 'clChoiceListBox'),
+ (Value: clUnset; Name: 'clUnset'),
+ (Value: clMenuText; Name: 'clMenuText'),
+ (Value: clMenuDisabled; Name: 'clMenuDisabled'),
+ (Value: clHintWindow; Name: 'clHintWindow'),
+ (Value: clGridSelection; Name: 'clGridSelection'),
+ (Value: clGridSelectionText; Name: 'clGridSelectionText'),
+ (Value: clGridInactiveSel; Name: 'clGridInactiveSel'),
+ (Value: clGridInactiveSelText; Name: 'clGridInactiveSelText'),
+ (Value: clSplitterGrabBar; Name: 'clSplitterGrabBar'),
+ (Value: clHyperLink; Name: 'clHyperLink'),
+ (Value: clPlaceholderText; Name: 'clPlaceholderText'),
+ (Value: clAliceBlue; Name: 'clAliceBlue'),
+ (Value: clAntiqueWhite; Name: 'clAntiqueWhite'),
+ (Value: clAquamarine; Name: 'clAquamarine'),
+ (Value: clAzure; Name: 'clAzure'),
+ (Value: clBeige; Name: 'clBeige'),
+ (Value: clBisque; Name: 'clBisque'),
+ (Value: clBlanchedAlmond; Name: 'clBlanchedAlmond'),
+ (Value: clBlueViolet; Name: 'clBlueViolet'),
+ (Value: clBrown; Name: 'clBrown'),
+ (Value: clBurlyWood; Name: 'clBurlyWood'),
+ (Value: clCadetBlue; Name: 'clCadetBlue'),
+ (Value: clChartreuse; Name: 'clChartreuse'),
+ (Value: clChocolate; Name: 'clChocolate'),
+ (Value: clCoral; Name: 'clCoral'),
+ (Value: clCornflowerBlue; Name: 'clCornflowerBlue'),
+ (Value: clCornsilk; Name: 'clCornsilk'),
+ (Value: clCrimson; Name: 'clCrimson'),
+ (Value: clCyan; Name: 'clCyan'),
+ (Value: clDarkBlue; Name: 'clDarkBlue'),
+ (Value: clDarkCyan; Name: 'clDarkCyan'),
+ (Value: clDarkGoldenrod; Name: 'clDarkGoldenrod'),
+ (Value: clDarkGray; Name: 'clDarkGray'),
+ (Value: clDarkGreen; Name: 'clDarkGreen'),
+ (Value: clDarkKhaki; Name: 'clDarkKhaki'),
+ (Value: clDarkMagenta; Name: 'clDarkMagenta'),
+ (Value: clDarkOliveGreen; Name: 'clDarkOliveGreen'),
+ (Value: clDarkOrange; Name: 'clDarkOrange'),
+ (Value: clDarkOrchid; Name: 'clDarkOrchid'),
+ (Value: clDarkRed; Name: 'clDarkRed'),
+ (Value: clDarkSalmon; Name: 'clDarkSalmon'),
+ (Value: clDarkSeaGreen; Name: 'clDarkSeaGreen'),
+ (Value: clDarkSlateBlue; Name: 'clDarkSlateBlue'),
+ (Value: clDarkSlateGray; Name: 'clDarkSlateGray'),
+ (Value: clDarkTurquoise; Name: 'clDarkTurquoise'),
+ (Value: clDarkViolet; Name: 'clDarkViolet'),
+ (Value: clDeepPink; Name: 'clDeepPink'),
+ (Value: clDeepSkyBlue; Name: 'clDeepSkyBlue'),
+ (Value: clDimGray; Name: 'clDimGray'),
+ (Value: clDodgerBlue; Name: 'clDodgerBlue'),
+ (Value: clFireBrick; Name: 'clFireBrick'),
+ (Value: clFloralWhite; Name: 'clFloralWhite'),
+ (Value: clForestGreen; Name: 'clForestGreen'),
+ (Value: clGainsboro; Name: 'clGainsboro'),
+ (Value: clGhostWhite; Name: 'clGhostWhite'),
+ (Value: clGold; Name: 'clGold'),
+ (Value: clGoldenrod; Name: 'clGoldenrod'),
+ (Value: clGreenYellow; Name: 'clGreenYellow'),
+ (Value: clHoneydew; Name: 'clHoneydew'),
+ (Value: clHotPink; Name: 'clHotPink'),
+ (Value: clIndianRed; Name: 'clIndianRed'),
+ (Value: clIndigo; Name: 'clIndigo'),
+ (Value: clIvory; Name: 'clIvory'),
+ (Value: clKhaki; Name: 'clKhaki'),
+ (Value: clLavender; Name: 'clLavender'),
+ (Value: clLavenderBlush; Name: 'clLavenderBlush'),
+ (Value: clLawnGreen; Name: 'clLawnGreen'),
+ (Value: clLemonChiffon; Name: 'clLemonChiffon'),
+ (Value: clLightBlue; Name: 'clLightBlue'),
+ (Value: clLightCoral; Name: 'clLightCoral'),
+ (Value: clLightCyan; Name: 'clLightCyan'),
+ (Value: clLightGoldenrodYellow; Name: 'clLightGoldenrodYellow'),
+ (Value: clLightGreen; Name: 'clLightGreen'),
+ (Value: clLightGray; Name: 'clLightGray'),
+ (Value: clLightPink; Name: 'clLightPink'),
+ (Value: clLightSalmon; Name: 'clLightSalmon'),
+ (Value: clLightSeaGreen; Name: 'clLightSeaGreen'),
+ (Value: clLightSkyBlue; Name: 'clLightSkyBlue'),
+ (Value: clLightSlateGray; Name: 'clLightSlateGray'),
+ (Value: clLightSteelBlue; Name: 'clLightSteelBlue'),
+ (Value: clLightYellow; Name: 'clLightYellow'),
+ (Value: clLimeGreen; Name: 'clLimeGreen'),
+ (Value: clLinen; Name: 'clLinen'),
+ (Value: clMagenta; Name: 'clMagenta'),
+ (Value: clMediumAquamarine; Name: 'clMediumAquamarine'),
+ (Value: clMediumBlue; Name: 'clMediumBlue'),
+ (Value: clMediumOrchid; Name: 'clMediumOrchid'),
+ (Value: clMediumPurple; Name: 'clMediumPurple'),
+ (Value: clMediumSeaGreen; Name: 'clMediumSeaGreen'),
+ (Value: clMediumSlateBlue; Name: 'clMediumSlateBlue'),
+ (Value: clMediumSpringGreen; Name: 'clMediumSpringGreen'),
+ (Value: clMediumTurquoise; Name: 'clMediumTurquoise'),
+ (Value: clMediumVioletRed; Name: 'clMediumVioletRed'),
+ (Value: clMidnightBlue; Name: 'clMidnightBlue'),
+ (Value: clMintCream; Name: 'clMintCream'),
+ (Value: clMistyRose; Name: 'clMistyRose'),
+ (Value: clMoccasin; Name: 'clMoccasin'),
+ (Value: clNavajoWhite; Name: 'clNavajoWhite'),
+ (Value: clOldLace; Name: 'clOldLace'),
+ (Value: clOliveDrab; Name: 'clOliveDrab'),
+ (Value: clOrange; Name: 'clOrange'),
+ (Value: clOrangeRed; Name: 'clOrangeRed'),
+ (Value: clOrchid; Name: 'clOrchid'),
+ (Value: clPaleGoldenrod; Name: 'clPaleGoldenrod'),
+ (Value: clPaleGreen; Name: 'clPaleGreen'),
+ (Value: clPaleTurquoise; Name: 'clPaleTurquoise'),
+ (Value: clPaleVioletRed; Name: 'clPaleVioletRed'),
+ (Value: clPaleBlue; Name: 'clPaleBlue'),
+ (Value: clPapayaWhip; Name: 'clPapayaWhip'),
+ (Value: clPeachPuff; Name: 'clPeachPuff'),
+ (Value: clPeru; Name: 'clPeru'),
+ (Value: clPink; Name: 'clPink'),
+ (Value: clPlum; Name: 'clPlum'),
+ (Value: clPowderBlue; Name: 'clPowderBlue'),
+ (Value: clRosyBrown; Name: 'clRosyBrown'),
+ (Value: clRoyalBlue; Name: 'clRoyalBlue'),
+ (Value: clSaddleBrown; Name: 'clSaddleBrown'),
+ (Value: clSalmon; Name: 'clSalmon'),
+ (Value: clSandyBrown; Name: 'clSandyBrown'),
+ (Value: clSeaGreen; Name: 'clSeaGreen'),
+ (Value: clSeashell; Name: 'clSeashell'),
+ (Value: clSienna; Name: 'clSienna'),
+ (Value: clSkyBlue2; Name: 'clSkyBlue2'),
+ (Value: clSlateBlue; Name: 'clSlateBlue'),
+ (Value: clSlateGray; Name: 'clSlateGray'),
+ (Value: clSnow; Name: 'clSnow'),
+ (Value: clSpringGreen; Name: 'clSpringGreen'),
+ (Value: clSteelBlue; Name: 'clSteelBlue'),
+ (Value: clTan; Name: 'clTan'),
+ (Value: clThistle; Name: 'clThistle'),
+ (Value: clTomato; Name: 'clTomato'),
+ (Value: clTurquoise; Name: 'clTurquoise'),
+ (Value: clViolet; Name: 'clViolet'),
+ (Value: clWheat; Name: 'clWheat'),
+ (Value: clWhiteSmoke; Name: 'clWhiteSmoke'),
+ (Value: clYellowGreen; Name: 'clYellowGreen'));
+
type
// forward declarations
TfpgDropBase = class;
@@ -983,6 +1177,8 @@ function fpgColor(const ARed, AGreen, ABlue: byte): TfpgColor;
function fpgColor(const ARed, AGreen, ABlue, AAlpha: byte): TfpgColor;
function fpgDarker(const AColor: TfpgColor; APercent: Byte = 50): TfpgColor;
function fpgLighter(const AColor: TfpgColor; APercent: Byte = 50): TfpgColor;
+function fpgColorToString(const AColor: TfpgColor): ansistring;
+function StringTofpgColor(const AColor: string): TfpgColor;
{ Points }
@@ -1330,6 +1526,42 @@ function fpgLighter(const AColor: TfpgColor; APercent: Byte): TfpgColor;
Result := RGBTripleTofpgColor(lColor);
end;
+function fpgColorToString(const AColor: TfpgColor): ansistring;
+var
+ i: integer;
+begin
+ for i := Low(fpgColors) to High(fpgColors) do
+ if fpgColors[i].Value = AColor then
+ begin
+ Result := fpgColors[i].Name;
+ exit;
+ end;
+
+ Result := '$' + HexStr(AColor, 8);
+end;
+
+function StringTofpgColor(const AColor: string): TfpgColor;
+var
+ i: integer;
+ HexStr: string;
+begin
+ Result := clDefault;
+
+ for i := Low(fpgColors) to High(fpgColors) do
+ if fpgColors[i].Name = AColor then
+ begin
+ Result := fpgColors[i].Value;
+ exit;
+ end;
+
+ if Pos('$', AColor) = 0 then
+ HexStr := '$' + AColor
+ else
+ HexStr := AColor;
+
+ Result := StrToDWord(HexStr);
+end;
+
procedure SortRect(var ARect: TRect);
begin
with ARect do
diff --git a/src/corelib/x11/fpgui_toolkit.pas b/src/corelib/x11/fpgui_toolkit.pas
index 081a9aa9a..ccd5e5b2b 100644
--- a/src/corelib/x11/fpgui_toolkit.pas
+++ b/src/corelib/x11/fpgui_toolkit.pas
@@ -22,7 +22,7 @@ interface
fpg_ColorWheel, fpg_interface, fpg_editbtn, fpg_imgfmt_jpg, fpg_imgutils,
fpg_stylemanager, fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks,
fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png,
- U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon, Agg2D,
+ U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon,
fpg_dbugintf, fpg_dbugmsg, fpg_fontcache, fpg_window, fpg_style_carbon,
fpg_style_plastic, fpg_style_win8, fpg_scrollframe, fpg_toggle,
fpg_StringGridBuilder, fpg_CSVParser, fpg_ledmatrix, fpg_dnd_window,