summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2015-04-09 08:12:22 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2015-04-09 08:12:22 +0100
commitdb31f06d5e7adf28fad60e36fd9e5d2cf0519e84 (patch)
treebc7782a4a174ce57836947cec194281651b642e7 /examples
parentc8acc2c1666015daeb3038c838e5018c0ecd8903 (diff)
parentf37cd9b2a08a41b8d877f64f9d5d5402105ee74a (diff)
downloadfpGUI-db31f06d5e7adf28fad60e36fd9e5d2cf0519e84.tar.xz
Merge branch 'release-1.4'
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/debugserver/frm_main.pas2
-rw-r--r--examples/apps/fpcunit/fpg_guitestrunner.pas30
-rw-r--r--examples/apps/ide/TODO8
-rw-r--r--examples/apps/ide/src/extrafpc.cfg5
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas8
-rw-r--r--examples/apps/ide/src/frm_configureide.pas4
-rw-r--r--examples/apps/ide/src/frm_main.pas62
-rw-r--r--examples/apps/ide/src/frm_projectoptions.pas10
-rw-r--r--examples/apps/ide/src/maximus.lpi33
-rw-r--r--examples/apps/ide/src/maximus.lpr1
-rw-r--r--examples/apps/ide/src/unitlist.pas32
-rw-r--r--examples/apps/ide/src/units/i386-freebsd/.gitignore1
-rw-r--r--examples/apps/ide/src/units/i386-linux/.gitignore1
-rw-r--r--examples/apps/ide/src/units/i386-win32/.gitignore1
-rw-r--r--examples/apps/ide/src/units/x86_64-freebsd/.gitignore1
-rw-r--r--examples/apps/ide/src/units/x86_64-linux/.gitignore1
-rw-r--r--examples/gui/colorwheel/colorwheel_test.lpi4
-rw-r--r--examples/gui/colorwheel/frm_main.pas235
-rw-r--r--examples/gui/customwindow/close.bmpbin0 -> 338 bytes
-rw-r--r--examples/gui/customwindow/custom_window.lpi65
-rw-r--r--examples/gui/customwindow/custom_window.lpr352
-rw-r--r--examples/gui/customwindow/extrafpc.cfg10
-rw-r--r--examples/gui/customwindow/images.inc57
-rw-r--r--examples/gui/customwindow/resize.bmpbin0 -> 474 bytes
-rw-r--r--examples/gui/customwindow/units/.gitignore1
-rw-r--r--examples/gui/drag_n_drop/dndexample.lpr6
-rw-r--r--examples/gui/filedialog/filedialog.lpi2
-rw-r--r--examples/gui/filedialog/filedialog.lpr2
-rw-r--r--examples/gui/gridtest/gridtest.lpr11
-rw-r--r--examples/gui/listviewtest/listviewtest.lpi7
-rw-r--r--examples/gui/listviewtest/listviewtest.lpr20
-rw-r--r--examples/gui/modalforms/modalforms.lpi2
-rw-r--r--examples/gui/modalforms/modalforms.lpr5
-rw-r--r--examples/gui/reporting/u_demo.pas3
-rw-r--r--examples/gui/togglebox/ToggleBoxTest.lpi77
-rw-r--r--examples/gui/togglebox/ToggleBoxTest.lpr30
-rw-r--r--examples/gui/togglebox/mainfrm.pas44
-rw-r--r--examples/gui/video_vlc/frmvlcplayer.pas34
-rw-r--r--examples/gui/video_vlc/testfpguivlc.lpi13
39 files changed, 1052 insertions, 128 deletions
diff --git a/examples/apps/debugserver/frm_main.pas b/examples/apps/debugserver/frm_main.pas
index 436a170c..27ac382c 100644
--- a/examples/apps/debugserver/frm_main.pas
+++ b/examples/apps/debugserver/frm_main.pas
@@ -307,7 +307,7 @@ begin
//else
// grdMessages.Items.InsertItem(LI, 0);
grdMessages.Cells[0, r] := IntToStr(AMsg.MsgType);
- grdMessages.Cells[1, r] := FormatDateTime('HH:mm:ss', AMsg.MsgTimeStamp);
+ grdMessages.Cells[1, r] := FormatDateTime('HH:nn:ss', AMsg.MsgTimeStamp);
grdMessages.Cells[2, r] := AMsg.Msg;
grdMessages.FocusCol := 0;
grdMessages.FocusRow := grdMessages.RowCount-1;
diff --git a/examples/apps/fpcunit/fpg_guitestrunner.pas b/examples/apps/fpcunit/fpg_guitestrunner.pas
index ca1a7f81..400fa0d1 100644
--- a/examples/apps/fpcunit/fpg_guitestrunner.pas
+++ b/examples/apps/fpcunit/fpg_guitestrunner.pas
@@ -7,11 +7,10 @@ interface
uses
SysUtils, Classes,
// fpGUI toolkit
- fpg_base, fpg_main, fpg_edit, fpg_widget, fpg_form, fpg_label, fpg_button,
- fpg_listbox, fpg_memo, fpg_combobox, fpg_basegrid, fpg_grid,
- fpg_dialogs, fpg_checkbox, fpg_tree, fpg_trackbar, fpg_progressbar,
- fpg_radiobutton, fpg_tab, fpg_menu, fpg_panel, fpg_popupcalendar,
- fpg_gauge, fpg_splitter, fpg_imagelist,
+ fpg_base, fpg_main, fpg_form, fpg_label, fpg_button,
+ fpg_memo,
+ fpg_dialogs, fpg_tree, fpg_progressbar,
+ fpg_menu, fpg_panel, fpg_splitter, fpg_imagelist,
// FPCUnit support
fpcunit, testregistry, testdecorator;
@@ -310,6 +309,7 @@ end;
procedure TGUITestRunnerForm.btnRunClicked(Sender: TObject);
begin
+ tvTests.FullExpand;
if tvTests.Selection = nil then
begin
TfpgMessageDialog.Critical('No selection', 'Please select a test case first.');
@@ -474,16 +474,6 @@ begin
SetPosition(305, 196, 530, 547);
WindowTitle := 'GUI Test Runner';
- bvlTree := TfpgBevel.Create(self);
- with bvlTree do
- begin
- Name := 'bvlTree';
- SetPosition(4, 8, 512, 364);
- Shape := bsSpacer;
- MinHeight := 200;
- Align := alClient;
- end;
-
bvlButtons := TfpgBevel.Create(self);
with bvlButtons do
begin
@@ -511,6 +501,16 @@ begin
Align := alBottom;
end;
+ bvlTree := TfpgBevel.Create(self);
+ with bvlTree do
+ begin
+ Name := 'bvlTree';
+ SetPosition(4, 8, 512, 364);
+ Shape := bsSpacer;
+ MinHeight := 200;
+ Align := alClient;
+ end;
+
pbName1 := TfpgProgressBar.Create(bvlTree);
with pbName1 do
begin
diff --git a/examples/apps/ide/TODO b/examples/apps/ide/TODO
index 9a90c33e..72b9f0db 100644
--- a/examples/apps/ide/TODO
+++ b/examples/apps/ide/TODO
@@ -1,6 +1,6 @@
Personal todo list for fpGUI IDE project
-
+
Legend
======
@@ -22,8 +22,8 @@ fpGUI IDE
[ ] Assembly window
[ ] CPU window
[x] Syntax highlighting with descent speed.
-[ ] Basic Search dialog
-[x] Find in Files dialog
+[x] Basic Search dialog
+[ ] Find in Files dialog
[ ] Regex support in all search dialogs
[ ] External Tools setup and usage
[ ] Keyboard Shortcuts dialog
@@ -36,7 +36,7 @@ fpGUI IDE
[ ] Unit Testing framework integration (with DUnit2 project)
[ ] Code Templates support
[o] File Browser tabsheet implementation. File navigation and opening of files.
-[ ] GoTo Line Number dialog
+[x] GoTo Line Number dialog
[ ] Converting all UI to MiG Layout Manager based dialogs.
[ ] TextEdit: enable line drawing functionality. eg: some key combination with
the cursor (arrow) keys allows line drawing. Double and single line
diff --git a/examples/apps/ide/src/extrafpc.cfg b/examples/apps/ide/src/extrafpc.cfg
index 2132065d..7d50b94c 100644
--- a/examples/apps/ide/src/extrafpc.cfg
+++ b/examples/apps/ide/src/extrafpc.cfg
@@ -1,9 +1,6 @@
--FUunits
+-FUunits/$fpctarget
-Fu../../../../lib/$fpctarget
-Fi.
--Xs
--XX
--CX
#ifdef mswindows
-WG
#endif
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index 3e88f3d1..6acea537 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1583,17 +1583,20 @@ begin
ckCopy:
begin
CopyToClipboard;
+ consumed := True;
end;
ckPaste:
begin
// if not ReadOnly then
PasteFromClipboard;
+ consumed := True;
end;
ckCut:
begin
CutToClipboard;
+ consumed := True;
end;
end;
@@ -1611,6 +1614,8 @@ begin
SLine := FLines[CaretPos.Y];
+ if not consumed then
+ begin
case keycode of
keyBackspace:
begin
@@ -1728,7 +1733,8 @@ begin
end;
consumed := True;
end;
- end;
+ end; // case keycode
+ end; // if not consumed
if CaretScroll then
begin
diff --git a/examples/apps/ide/src/frm_configureide.pas b/examples/apps/ide/src/frm_configureide.pas
index fad0418f..51061a42 100644
--- a/examples/apps/ide/src/frm_configureide.pas
+++ b/examples/apps/ide/src/frm_configureide.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -229,7 +229,6 @@ constructor TConfigureIDEForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FInternalMacroList := TIDEMacroList.Create;
- OnKeyPress := @FormKeyPressed;
end;
destructor TConfigureIDEForm.Destroy;
@@ -248,6 +247,7 @@ begin
Hint := '';
ShowHint := True;
WindowPosition := wpOneThirdDown;
+ OnKeyPress := @FormKeyPressed;
btnCancel := TfpgButton.Create(self);
with btnCancel do
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index fe903c31..8a8f3c12 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -118,6 +118,7 @@ type
procedure AddUnitToProject(const AUnitName: TfpgString);
procedure miProjectAddUnitToProject(Sender: TObject);
procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
procedure BuildTerminated(Sender: TObject);
@@ -541,18 +542,18 @@ var
r: TfpgTreeNode;
n: TfpgTreeNode;
begin
- u := TUnit.Create;
- u.FileName := AUnitName;
- u.Opened := True;
- GProject.UnitList.Add(u);
- // add reference to tabsheet
- pcEditor.ActivePage.TagPointer := u;
- s := fpgExtractRelativepath(GProject.ProjectDir, u.FileName);
- r := GetUnitsNode;
- n := r.AppendText(s);
- // add reference to treenode
- n.Data := u;
- tvProject.Invalidate;
+ u := GProject.UnitList.AddFilename(AUnitName);
+ if Assigned(n) then
+ begin
+ // add reference to tabsheet
+ pcEditor.ActivePage.TagPointer := u;
+ s := u.GetRelativePath;
+ r := GetUnitsNode;
+ n := r.AppendText(s);
+ // add reference to treenode
+ n.Data := u;
+ tvProject.Invalidate;
+ end;
end;
procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
@@ -587,6 +588,38 @@ begin
end;
end;
+procedure TMainForm.tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+var
+ r: TfpgTreeNode;
+ n: TfpgTreeNode;
+ i: integer;
+begin
+ if keyCode = keyDelete then
+ begin
+ r := GetUnitsNode;
+ if r.FindSubNode(tvProject.Selection.Text, False) = tvProject.Selection then
+ begin
+ // remove from project, then from tree view
+ n := tvProject.Selection;
+ tvProject.GotoNextNodeUp;
+ r.Remove(n);
+ tvProject.Invalidate;
+ GProject.UnitList.Remove(TUnit(n.Data));
+
+ for i := 0 to pcEditor.PageCount-1 do
+ begin
+ if pcEditor.Pages[i].TagPointer = n.Data then
+ begin
+ pcEditor.Pages[i].TagPointer := nil;
+ break
+ end;
+ end;
+ TUnit(n.Data).Free;
+ n.Free;
+ end;
+ end;
+end;
+
procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
var
cr: TClipboardKeyType;
@@ -1478,6 +1511,7 @@ begin
Hint := '';
TabOrder := 20;
OnDoubleClick := @tvProjectDoubleClick;
+ OnKeyPress := @tvProjectKeyPressed;
end;
tsFiles := TfpgTabSheet.Create(pnlTool);
@@ -1597,7 +1631,7 @@ begin
begin
Name := 'mnuProject';
SetPosition(476, 140, 172, 20);
- AddMenuItem('Options...', rsKeyCtrl+rsKeyShift+'O', @miProjectOptions);
+ AddMenuItem('Options...', rsKeyCtrl+rsKeyShift+'F11', @miProjectOptions);
AddMenuItem('-', '', nil);
AddMenuItem('New (empty)...', '', @miProjectNew);
AddMenuItem('New from Template...', '', @miProjectNewFromTemplate);
diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas
index 1e1c318a..a3e43d6a 100644
--- a/examples/apps/ide/src/frm_projectoptions.pas
+++ b/examples/apps/ide/src/frm_projectoptions.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -103,6 +103,7 @@ type
procedure CleanupCompilerDirs;
procedure CleanupUserMacrosGrid;
procedure SaveToMacroList(AList: TIDEMacroList);
+ procedure FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -582,6 +583,12 @@ begin
// AList.SetValue(cMacro_FPCSrcDir, edtFPCSrcDir.Directory);
end;
+procedure TProjectOptionsForm.FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if KeyCode = keyEscape then
+ Close;
+end;
+
constructor TProjectOptionsForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -603,6 +610,7 @@ begin
WindowTitle := 'Project Options';
Hint := '';
ShowHint := True;
+ OnKeyPress := @FormKeyPressed;
btnCancel := TfpgButton.Create(self);
with btnCancel do
diff --git a/examples/apps/ide/src/maximus.lpi b/examples/apps/ide/src/maximus.lpi
index accb3570..01a377d7 100644
--- a/examples/apps/ide/src/maximus.lpi
+++ b/examples/apps/ide/src/maximus.lpi
@@ -42,7 +42,6 @@
<Unit0>
<Filename Value="maximus.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="maximus"/>
</Unit0>
<Unit1>
<Filename Value="frm_main.pas"/>
@@ -52,7 +51,6 @@
<Unit2>
<Filename Value="frm_configureide.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_configureide"/>
</Unit2>
<Unit3>
<Filename Value="ideconst.pas"/>
@@ -67,7 +65,6 @@
<Unit5>
<Filename Value="frm_debug.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_debug"/>
</Unit5>
<Unit6>
<Filename Value="project.pas"/>
@@ -77,7 +74,6 @@
<Unit7>
<Filename Value="unitlist.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="UnitList"/>
</Unit7>
<Unit8>
<Filename Value="frm_projectoptions.pas"/>
@@ -97,47 +93,42 @@
<Unit11>
<Filename Value="ideimages.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="ideimages"/>
</Unit11>
<Unit12>
<Filename Value="stringhelpers.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="stringhelpers"/>
</Unit12>
<Unit13>
<Filename Value="frm_procedurelist.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_procedurelist"/>
</Unit13>
<Unit14>
- <Filename Value="mpaslex.pas"/>
+ <Filename Value="filemonitor.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="mPasLex"/>
+ <UnitName Value="filemonitor"/>
</Unit14>
<Unit15>
- <Filename Value="filemonitor.pas"/>
+ <Filename Value="synregexpr.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="filemonitor"/>
</Unit15>
<Unit16>
- <Filename Value="synregexpr.pas"/>
+ <Filename Value="fpg_textedit.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="SynRegExpr"/>
+ <UnitName Value="fpg_textedit"/>
</Unit16>
<Unit17>
- <Filename Value="fpg_textedit.pas"/>
+ <Filename Value="frm_find.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="fpg_textedit"/>
</Unit17>
<Unit18>
- <Filename Value="frm_find.pas"/>
+ <Filename Value="sha1.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_find"/>
+ <UnitName Value="Sha1"/>
</Unit18>
<Unit19>
- <Filename Value="sha1.pas"/>
+ <Filename Value="mPasLex.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="Sha1"/>
+ <UnitName Value="mPasLex"/>
</Unit19>
</Units>
</ProjectOptions>
@@ -162,11 +153,7 @@
</Optimizations>
</CodeGeneration>
<Other>
- <CompilerMessages>
- <UseMsgFile Value="True"/>
- </CompilerMessages>
<CustomOptions Value="-dDEBUGSVRx"/>
- <CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>
diff --git a/examples/apps/ide/src/maximus.lpr b/examples/apps/ide/src/maximus.lpr
index cf9c439f..13a2047e 100644
--- a/examples/apps/ide/src/maximus.lpr
+++ b/examples/apps/ide/src/maximus.lpr
@@ -39,7 +39,6 @@ uses
ideimages,
stringhelpers,
frm_procedurelist,
- mPasLex,
filemonitor,
SynRegExpr,
fpg_textedit,
diff --git a/examples/apps/ide/src/unitlist.pas b/examples/apps/ide/src/unitlist.pas
index 827326e7..e6c09a69 100644
--- a/examples/apps/ide/src/unitlist.pas
+++ b/examples/apps/ide/src/unitlist.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -31,6 +31,7 @@ type
function GetUnitName: TfpgString;
public
constructor Create;
+ function GetRelativePath: TfpgString;
property FileName: TfpgString read FFilename write FFilename;
property UnitName: TfpgString read GetUnitName;
property Opened: Boolean read FOpened write FOpened;
@@ -48,6 +49,8 @@ type
function Count: integer;
function FindByName(const AUnitName: TfpgString): TUnit;
function FileExists(const AFilename: TfpgString): Boolean;
+ function AddFileName(const AFilename: TfpgString): TUnit;
+ function Remove(AUnit: TUnit): integer;
procedure Add(NewUnit: TUnit);
procedure Clear;
procedure Delete(AIndex: integer);
@@ -58,7 +61,8 @@ type
implementation
uses
- fpg_utils;
+ fpg_utils,
+ project;
{ TUnitList }
@@ -128,6 +132,25 @@ begin
end;
end;
+function TUnitList.AddFileName(const AFilename: TfpgString): TUnit;
+var
+ u: TUnit;
+begin
+ if not FileExists(AFilename) then
+ begin
+ u := TUnit.Create;
+ u.FileName := AFilename;
+ u.Opened := True;
+ Add(u);
+ Result := u;
+ end;
+end;
+
+function TUnitList.Remove(AUnit: TUnit): integer;
+begin
+ Result := FList.Remove(AUnit);
+end;
+
procedure TUnitList.Add(NewUnit: TUnit);
var
l: Integer;
@@ -176,6 +199,11 @@ begin
Result := fpgExtractFileName(Filename);
end;
+function TUnit.GetRelativePath: TfpgString;
+begin
+ Result := fpgExtractRelativepath(GProject.ProjectDir, FileName);
+end;
+
constructor TUnit.Create;
begin
inherited Create;
diff --git a/examples/apps/ide/src/units/i386-freebsd/.gitignore b/examples/apps/ide/src/units/i386-freebsd/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-freebsd/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/i386-linux/.gitignore b/examples/apps/ide/src/units/i386-linux/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-linux/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/i386-win32/.gitignore b/examples/apps/ide/src/units/i386-win32/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-win32/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/x86_64-freebsd/.gitignore b/examples/apps/ide/src/units/x86_64-freebsd/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/x86_64-freebsd/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/x86_64-linux/.gitignore b/examples/apps/ide/src/units/x86_64-linux/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/x86_64-linux/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/gui/colorwheel/colorwheel_test.lpi b/examples/gui/colorwheel/colorwheel_test.lpi
index 3ad6b196..a0be0fc2 100644
--- a/examples/gui/colorwheel/colorwheel_test.lpi
+++ b/examples/gui/colorwheel/colorwheel_test.lpi
@@ -38,7 +38,6 @@
<Unit0>
<Filename Value="colorwheel_test.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="colorwheel_test"/>
</Unit0>
<Unit1>
<Filename Value="frm_main.pas"/>
@@ -64,8 +63,5 @@
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
- <Other>
- <CompilerPath Value="$(CompPath)"/>
- </Other>
</CompilerOptions>
</CONFIG>
diff --git a/examples/gui/colorwheel/frm_main.pas b/examples/gui/colorwheel/frm_main.pas
index 3633b740..612ea6c1 100644
--- a/examples/gui/colorwheel/frm_main.pas
+++ b/examples/gui/colorwheel/frm_main.pas
@@ -8,10 +8,34 @@ uses
SysUtils, Classes, fpg_base, fpg_main, fpg_widget,
fpg_edit, fpg_form, fpg_label, fpg_button,
fpg_dialogs, fpg_menu, fpg_checkbox,
- fpg_panel, fpg_ColorWheel;
+ fpg_panel, fpg_ColorWheel, fpg_spinedit;
type
+ TColorPickedEvent = procedure(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor) of object;
+
+
+ TPickerButton = class(TfpgButton)
+ private
+ FContinuousResults: Boolean;
+ FOnColorPicked: TColorPickedEvent;
+ FColorPos: TPoint;
+ FColor: TfpgColor;
+ FColorPicking: Boolean;
+ private
+ procedure DoColorPicked;
+ protected
+ procedure HandleLMouseDown(X, Y: integer; ShiftState: TShiftState); override;
+ procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
+ public
+ constructor Create(AOwner: TComponent); override;
+ published
+ property ContinuousResults: Boolean read FContinuousResults write FContinuousResults;
+ property OnColorPicked: TColorPickedEvent read FOnColorPicked write FOnColorPicked;
+ end;
+
+
TMainForm = class(TfpgForm)
private
{@VFD_HEAD_BEGIN: MainForm}
@@ -28,36 +52,134 @@ type
Label4: TfpgLabel;
Label5: TfpgLabel;
Label6: TfpgLabel;
- edR: TfpgEdit;
- edG: TfpgEdit;
- edB: TfpgEdit;
+ edR: TfpgSpinEdit;
+ edG: TfpgSpinEdit;
+ edB: TfpgSpinEdit;
+ lblHex: TfpgLabel;
Label7: TfpgLabel;
Label8: TfpgLabel;
Bevel2: TfpgBevel;
Label9: TfpgLabel;
chkCrossHair: TfpgCheckBox;
chkBGColor: TfpgCheckBox;
+ btnPicker: TPickerButton;
+ chkContinuous: TfpgCheckBox;
{@VFD_HEAD_END: MainForm}
FViaRGB: Boolean; // to prevent recursive changes
- procedure btnQuitClicked(Sender: TObject);
- procedure chkCrossHairChange(Sender: TObject);
- procedure chkBGColorChange(Sender: TObject);
- procedure UpdateHSVComponents;
- procedure UpdateRGBComponents;
- procedure ColorChanged(Sender: TObject);
- procedure RGBChanged(Sender: TObject);
+ FColorPicking: Boolean;
+ procedure btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor);
+ procedure chkContinuousChanged(Sender: TObject);
+ procedure btnQuitClicked(Sender: TObject);
+ procedure chkCrossHairChange(Sender: TObject);
+ procedure chkBGColorChange(Sender: TObject);
+ procedure UpdateHSVComponents;
+ procedure UpdateRGBComponents;
+ procedure ColorChanged(Sender: TObject);
+ procedure RGBChanged(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
- procedure AfterCreate; override;
+ procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
implementation
-
{@VFD_NEWFORM_IMPL}
+function ConvertToHexa(Value: Integer): string;
+var
+ ValH,ValL: Integer;
+begin
+ValH:= Value div 16;
+ValL:= Value mod 16;
+case ValH of
+ 15:
+ Result:= 'F';
+ 14:
+ Result:= 'E';
+ 13:
+ Result:= 'D';
+ 12:
+ Result:= 'C';
+ 11:
+ Result:= 'B';
+ 10:
+ Result:= 'A';
+ else
+ Result:= IntToStr(ValH);
+ end;
+case ValL of
+ 15:
+ Result:= Result+'F';
+ 14:
+ Result:= Result+'E';
+ 13:
+ Result:= Result+'D';
+ 12:
+ Result:= Result+'C';
+ 11:
+ Result:= Result+'B';
+ 10:
+ Result:= Result+'A';
+ else
+ Result:= Result+IntToStr(ValL);
+ end;
+end;
+
+function Hexa(Red,Green,Blue: Integer): string;
+begin
+Result:= '$'+ConvertToHexa(Red)+ConvertToHexa(Green)+ConvertToHexa(Blue);
+end;
+
+{ TPickerButton }
+
+procedure TPickerButton.DoColorPicked;
+var
+ pt: TPoint;
+begin
+ pt := WindowToScreen(self, FColorPos);
+ FColor := fpgApplication.GetScreenPixelColor(pt);
+ if Assigned(FOnColorPicked) then
+ FOnColorPicked(self, FColorPos, FColor);
+end;
+
+procedure TPickerButton.HandleLMouseDown(X, Y: integer; ShiftState: TShiftState);
+begin
+ inherited HandleLMouseDown(X, Y, ShiftState);
+ MouseCursor := mcCross;
+ FColorPicking := True;
+ CaptureMouse;
+end;
+
+procedure TPickerButton.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
+begin
+ inherited HandleLMouseUp(x, y, shiftstate);
+ ReleaseMouse;
+ FColorPicking := False;
+ MouseCursor := mcDefault;
+ DoColorPicked;
+end;
+
+procedure TPickerButton.HandleMouseMove(x, y: integer; btnstate: word;
+ shiftstate: TShiftState);
+begin
+ //inherited HandleMouseMove(x, y, btnstate, shiftstate);
+ if not FColorPicking then
+ Exit;
+ FColorPos.x := x;
+ FColorPos.y := y;
+ if FContinuousResults then
+ DoColorPicked;
+end;
+
+constructor TPickerButton.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ FColorPicking := False;
+ FContinuousResults := False;
+end;
+
procedure TMainForm.ColorChanged(Sender: TObject);
begin
UpdateHSVComponents;
@@ -71,18 +193,30 @@ var
c: TfpgColor;
begin
FViaRGB := True; // revent recursive updates
- rgb.Red := StrToInt(edR.Text);
- rgb.Green := StrToInt(edG.Text);
- rgb.Blue := StrToInt(edB.Text);
+ rgb.Red := edR.Value;
+ rgb.Green := edG.Value;
+ rgb.Blue := edB.Value;
c := RGBTripleTofpgColor(rgb);
ColorWheel1.SetSelectedColor(c); // This will trigger ColorWheel and ValueBar OnChange event
FViaRGB := False;
+ lblHex.Text:= 'Hex = '+ Hexa(rgb.Red,rgb.Green,rgb.Blue);
end;
constructor TMainForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FViaRGB := False;
+ FColorPicking := False;
+end;
+
+procedure TMainForm.btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor);
+begin
+ ColorWheel1.SetSelectedColor(AColor);
+end;
+
+procedure TMainForm.chkContinuousChanged(Sender: TObject);
+begin
+ btnPicker.ContinuousResults := chkContinuous.Checked;
end;
procedure TMainForm.btnQuitClicked(Sender: TObject);
@@ -127,9 +261,10 @@ var
begin
c := ValueBar1.SelectedColor;
rgb := fpgColorToRGBTriple(c);
- edR.Text := IntToStr(rgb.Red);
- edG.Text := IntToStr(rgb.Green);
- edB.Text := IntToStr(rgb.Blue);
+ edR.Value := rgb.Red;
+ edG.Value := rgb.Green;
+ edB.Value := rgb.Blue;
+ lblHex.Text:= 'Hex = '+ Hexa(rgb.Red,rgb.Green,rgb.Blue);
end;
procedure TMainForm.AfterCreate;
@@ -138,6 +273,7 @@ begin
Name := 'MainForm';
SetPosition(349, 242, 537, 411);
WindowTitle := 'ColorWheel test app';
+ Hint := '';
WindowPosition := wpUser;
Button1 := TfpgButton.Create(self);
@@ -166,6 +302,7 @@ begin
begin
Name := 'ValueBar1';
SetPosition(304, 20, 52, 244);
+ Value := 1;
OnChange := @ColorChanged;
end;
@@ -174,6 +311,7 @@ begin
begin
Name := 'Bevel1';
SetPosition(20, 288, 76, 56);
+ Hint := '';
end;
Label1 := TfpgLabel.Create(self);
@@ -275,39 +413,55 @@ begin
Text := 'Blue';
end;
- edR := TfpgEdit.Create(self);
+ edR := TfpgSpinEdit.Create(self);
with edR do
begin
Name := 'edR';
SetPosition(296, 280, 44, 26);
TabOrder := 13;
- Text := '255';
+ MinValue := 0;
+ MaxValue := 255;
+ Value := 255;
FontDesc := '#Edit1';
OnExit := @RGBChanged;
end;
- edG := TfpgEdit.Create(self);
+ edG := TfpgSpinEdit.Create(self);
with edG do
begin
Name := 'edG';
SetPosition(296, 308, 44, 26);
TabOrder := 14;
- Text := '255';
+ MinValue := 0;
+ MaxValue := 255;
+ Value := 255;
FontDesc := '#Edit1';
OnExit := @RGBChanged;
end;
- edB := TfpgEdit.Create(self);
+ edB := TfpgSpinEdit.Create(self);
with edB do
begin
Name := 'edB';
SetPosition(296, 336, 44, 26);
TabOrder := 15;
- Text := '255';
+ MinValue := 0;
+ MaxValue := 255;
+ Value := 255;
FontDesc := '#Edit1';
OnExit := @RGBChanged;
end;
+ lblHex := TfpgLabel.Create(self);
+ with lblHex do
+ begin
+ Name := 'lblHex';
+ SetPosition(380, 316, 120, 16);
+ FontDesc := '#Label2';
+ Hint := '';
+ Text := 'Hex = ';
+ end;
+
Label7 := TfpgLabel.Create(self);
with Label7 do
begin
@@ -333,6 +487,7 @@ begin
begin
Name := 'Bevel2';
SetPosition(388, 8, 2, 260);
+ Hint := '';
Style := bsLowered;
end;
@@ -353,6 +508,7 @@ begin
Name := 'chkCrossHair';
SetPosition(396, 32, 128, 20);
FontDesc := '#Label1';
+ Hint := '';
TabOrder := 20;
Text := 'Large CrossHair';
OnChange := @chkCrossHairChange;
@@ -364,11 +520,37 @@ begin
Name := 'chkBGColor';
SetPosition(396, 56, 132, 20);
FontDesc := '#Label1';
+ Hint := '';
TabOrder := 21;
Text := 'New BG Color';
OnChange := @chkBGColorChange;
end;
+ btnPicker := TPickerButton.Create(self);
+ with btnPicker do
+ begin
+ Name := 'btnPicker';
+ SetPosition(116, 372, 80, 23);
+ Text := 'Picker';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 24;
+ OnColorPicked := @btnColorPicked;
+ end;
+
+ chkContinuous := TfpgCheckBox.Create(self);
+ with chkContinuous do
+ begin
+ Name := 'chkContinous';
+ SetPosition(205, 375, 90, 19);
+ FontDesc := '#Label1';
+ Hint := '';
+ TabOrder := 25;
+ Text := 'Continous';
+ OnChange := @chkContinuousChanged;
+ end;
+
{@VFD_BODY_END: MainForm}
// link the two components
@@ -376,6 +558,9 @@ begin
// ColorWheel1.BackgroundColor := clFuchsia;
// ValueBar1.BackgroundColor := clFuchsia;
// ColorWheel1.CursorSize := 400;
+ UpdateHSVComponents;
+ if not FViaRGB then
+ UpdateRGBComponents;
end;
diff --git a/examples/gui/customwindow/close.bmp b/examples/gui/customwindow/close.bmp
new file mode 100644
index 00000000..af6745a5
--- /dev/null
+++ b/examples/gui/customwindow/close.bmp
Binary files differ
diff --git a/examples/gui/customwindow/custom_window.lpi b/examples/gui/customwindow/custom_window.lpi
new file mode 100644
index 00000000..2059fa29
--- /dev/null
+++ b/examples/gui/customwindow/custom_window.lpi
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="custom_window"/>
+ <UseAppBundle Value="False"/>
+ <ResourceType Value="res"/>
+ </General>
+ <i18n>
+ <EnableI18N LFM="False"/>
+ </i18n>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_toolkit"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="custom_window.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="custom_window"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="images.inc"/>
+ <IsPartOfProject Value="True"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ </SearchPaths>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="3">
+ <Item1>
+ <Name Value="EAbort"/>
+ </Item1>
+ <Item2>
+ <Name Value="ECodetoolError"/>
+ </Item2>
+ <Item3>
+ <Name Value="EFOpenError"/>
+ </Item3>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/examples/gui/customwindow/custom_window.lpr b/examples/gui/customwindow/custom_window.lpr
new file mode 100644
index 00000000..eab06e5d
--- /dev/null
+++ b/examples/gui/customwindow/custom_window.lpr
@@ -0,0 +1,352 @@
+{ This was a very quick and dirty demo to show how custom windows with your
+ own style of borders (eg: like Chrome or elementryOS) can be implement.
+ There is obviously lots of scope for improving this code and creating
+ custom widgets to make better use of code reuse and abstraction. }
+program custom_window;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, SysUtils,
+ fpg_base, fpg_main, fpg_form, fpg_button,
+ fpg_stylemanager, fpg_cmdlineparams, fpg_grid,
+ fpg_StringGridBuilder, fpg_editbtn, fpg_checkbox,
+ fpg_panel, fpg_dialogs;
+
+type
+
+ TMainForm = class(TfpgForm)
+ procedure ResizeClicked(Sender: TObject);
+ private
+ {@VFD_HEAD_BEGIN: MainForm}
+ btnQuit: TfpgButton;
+ Grid1: TfpgStringGrid;
+ FilenameEdit1: TfpgFileNameEdit;
+ btnGo: TfpgButton;
+ CheckBox1: TfpgCheckBox;
+ bvlTitle: TfpgBevel;
+ btnClose: TfpgImagePanel;
+ btnResize: TfpgImagePanel;
+ bvlTasks: TfpgBevel;
+ {@VFD_HEAD_END: MainForm}
+ FLastPos: TPoint;
+ FMouseTracked: Boolean;
+ procedure TitleMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure TitleMouseMoved(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint);
+ procedure btnCloseClicked(Sender: TObject);
+ procedure PaintTasksPanel(Sender: TObject);
+ procedure PaintTitle(Sender: TObject);
+ procedure FormPaint(Sender: TObject);
+ procedure btnQuitClicked(Sender: TObject);
+ procedure btnGoClicked(Sender: TObject);
+ public
+ constructor Create(AOwner: TComponent); override;
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+const
+ cBackground = TfpgColor($FFf5f5f5);
+ cGradientTop = TfpgColor($FFe5e5e5);
+ cGradientBottom = TfpgColor($FFbcbcbc);
+ cBorder = TfpgColor($FF7c7c7c);
+ cGrayPanel = TfpgColor($FFdedede);
+
+ { tip: probably best to use specific fonts for specific OSes }
+ cHeader1 = 'Arial-11:bold:antialias=true';
+ cHeader2 = 'Arial-10:antialias=true';
+
+{$I images.inc}
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.ResizeClicked(Sender: TObject);
+begin
+ ShowMessage('I''ll leave this one up to you to implement and experiment with. ;-)', 'Hint');
+end;
+
+procedure TMainForm.TitleMouseDown(Sender: TObject; AButton: TMouseButton;
+ AShift: TShiftState; const AMousePos: TPoint);
+begin
+ FMouseTracked := True;
+ FLastPos := bvlTitle.WindowToScreen(self, AMousePos);
+ bvlTitle.CaptureMouse;
+end;
+
+procedure TMainForm.TitleMouseUp(Sender: TObject; AButton: TMouseButton;
+ AShift: TShiftState; const AMousePos: TPoint);
+begin
+ FMouseTracked := False;
+ bvlTitle.ReleaseMouse;
+end;
+
+procedure TMainForm.TitleMouseMoved(Sender: TObject; AShift: TShiftState;
+ const AMousePos: TPoint);
+var
+ dx, dy: integer;
+ pt: TPoint;
+begin
+ pt := WindowToScreen(self, AMousePos);
+ if not FMouseTracked then
+ begin
+ FLastPos := pt;
+ Exit;
+ end;
+
+ dx := pt.X - FLastPos.X;
+ dy := pt.Y - FLastPos.Y;
+ Left := Left + dx;
+ Top := Top + dy;
+ FLastPos := pt;
+ UpdateWindowPosition;
+end;
+
+procedure TMainForm.btnCloseClicked(Sender: TObject);
+begin
+ btnQuit.Click;
+end;
+
+procedure TMainForm.PaintTasksPanel(Sender: TObject);
+begin
+ with bvlTasks do
+ begin
+ Canvas.Clear(cGrayPanel);
+
+ Canvas.Color := cBorder;
+ Canvas.DrawRectangle(0, 0, Width, Height);
+
+ Canvas.TextColor := cBorder;
+ // Output some sample text
+ Canvas.Font := fpgGetFont(cHeader1);
+ Canvas.DrawText(8, 10, 'Personal');
+ Canvas.Font := fpgGetFont(cHeader2);
+ Canvas.DrawText(20, 30, 'Home');
+ Canvas.DrawText(20, 50, 'Documents');
+ Canvas.DrawText(20, 70, 'Music');
+ Canvas.DrawText(20, 90, 'Pictures');
+ Canvas.Font := fpgGetFont(cHeader1);
+ Canvas.DrawText(8, 110, 'Network');
+ Canvas.Font := fpgGetFont(cHeader2);
+ Canvas.DrawText(20, 130, 'Entire network');
+ end;
+end;
+
+procedure TMainForm.PaintTitle(Sender: TObject);
+var
+ r: TfpgRect;
+begin
+ r.SetRect(0, 1, Width, 46);
+ with bvlTitle do
+ begin
+ Canvas.GradientFill(r, cGradientTop, cGradientBottom, gdVertical);
+
+ Canvas.Color := TfpgColor($FFc9c9c9);
+ Canvas.DrawLine(0, Height-2, Width, Height-2);
+
+ Canvas.Color := cBorder;
+ Canvas.DrawRectangle(0, 0, Width, Height);
+
+ Canvas.TextColor := cBorder;
+ Canvas.Font := fpgGetFont(cHeader1);
+ Canvas.DrawText(30, 8, Width-60, 20, WindowTitle, [txtHCenter, txtTop]);
+ end;
+end;
+
+procedure TMainForm.FormPaint(Sender: TObject);
+begin
+ Canvas.Color := cBorder;
+ Canvas.DrawRectangle(0, 0, Width, Height);
+end;
+
+procedure TMainForm.btnQuitClicked(Sender: TObject);
+begin
+ Close;
+end;
+
+procedure TMainForm.btnGoClicked(Sender: TObject);
+var
+ sgb: TStringGridBuilder;
+begin
+ try
+ sgb := TStringGridBuilder.CreateCustom(Grid1, FilenameEdit1.FileName, CheckBox1.Checked);
+ sgb.Run;
+ finally
+ sgb.Free;
+ end;
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ Include(FWindowAttributes, waBorderLess); // borderless and steals focus like a normal form
+ FMouseTracked := False;
+
+ fpgSetNamedColor(clWindowBackground, cBackground);
+
+ fpgImages.AddBMP( // 8x9 pixels.
+ 'my.close',
+ @img_close,
+ sizeof(img_close));
+
+ fpgImages.AddBMP( // 10x11 pixels.
+ 'my.resize',
+ @img_resize,
+ sizeof(img_resize));
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(464, 271, 866, 473);
+ WindowTitle := 'fpGUI Custom Window Demo';
+ Hint := '';
+ OnPaint := @FormPaint;
+
+ btnQuit := TfpgButton.Create(self);
+ with btnQuit do
+ begin
+ Name := 'btnQuit';
+ SetPosition(772, 436, 80, 23);
+ Text := 'Quit';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 1;
+ OnClick := @btnQuitClicked;
+ end;
+
+ Grid1 := TfpgStringGrid.Create(self);
+ with Grid1 do
+ begin
+ Name := 'Grid1';
+ SetPosition(182, 120, 666, 276);
+ BackgroundColor := TfpgColor($80000002);
+ FontDesc := '#Grid';
+ HeaderFontDesc := '#GridHeader';
+ Hint := '';
+ RowCount := 0;
+ RowSelect := False;
+ TabOrder := 2;
+ end;
+
+ FilenameEdit1 := TfpgFileNameEdit.Create(self);
+ with FilenameEdit1 do
+ begin
+ Name := 'FilenameEdit1';
+ SetPosition(182, 92, 510, 24);
+ ExtraHint := '';
+ FileName := '';
+ Filter := 'CSV Files (*.csv)|*.csv';
+ InitialDir := '';
+ TabOrder := 3;
+ end;
+
+ btnGo := TfpgButton.Create(self);
+ with btnGo do
+ begin
+ Name := 'btnGo';
+ SetPosition(768, 92, 80, 23);
+ Text := 'GO';
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 4;
+ OnClick := @btnGoClicked;
+ end;
+
+ CheckBox1 := TfpgCheckBox.Create(self);
+ with CheckBox1 do
+ begin
+ Name := 'CheckBox1';
+ SetPosition(184, 68, 120, 19);
+ FontDesc := '#Label1';
+ Hint := '';
+ TabOrder := 5;
+ Text := 'Has Header';
+ end;
+
+ bvlTitle := TfpgBevel.Create(self);
+ with bvlTitle do
+ begin
+ Name := 'bvlTitle';
+ SetPosition(0, 0, 866, 48);
+ Anchors := [anLeft,anRight,anTop];
+ Hint := '';
+ Shape := bsSpacer;
+ OnPaint := @PaintTitle;
+ OnMouseMove := @TitleMouseMoved;
+ OnMouseDown := @TitleMouseDown;
+ OnMouseUp := @TitleMouseUp;
+ end;
+
+ btnClose := TfpgImagePanel.Create(bvlTitle);
+ with btnClose do
+ begin
+ Name := 'btnClose';
+ SetPosition(9, 8, 8, 9);
+ OwnsImage := False;
+ OnClick := @btnCloseClicked;
+ end;
+
+ btnResize := TfpgImagePanel.Create(bvlTitle);
+ with btnResize do
+ begin
+ Name := 'btnResize';
+ SetPosition(849, 8, 10, 11);
+ OwnsImage := False;
+ OnClick := @ResizeClicked;
+ end;
+
+ bvlTasks := TfpgBevel.Create(self);
+ with bvlTasks do
+ begin
+ Name := 'bvlTasks';
+ SetPosition(0, 47, 170, 426);
+ Anchors := [anLeft,anTop,anBottom];
+ Hint := '';
+ Shape := bsSpacer;
+ OnPaint := @PaintTasksPanel;
+ end;
+
+ {@VFD_BODY_END: MainForm}
+ {%endregion}
+
+ btnClose.Image := fpgImages.GetImage('my.close');
+ btnResize.Image := fpgImages.GetImage('my.resize');
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+
+ { Set our new style as the default (before we create any forms), unless
+ a the end-user specified a different style via the command line. }
+ if not gCommandLineParams.IsParam('style') then
+ begin
+ if fpgStyleManager.SetStyle('Plastic Light Gray') then
+ fpgStyle := fpgStyleManager.Style;
+ end;
+
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/gui/customwindow/extrafpc.cfg b/examples/gui/customwindow/extrafpc.cfg
new file mode 100644
index 00000000..89eafa99
--- /dev/null
+++ b/examples/gui/customwindow/extrafpc.cfg
@@ -0,0 +1,10 @@
+-FUunits
+-Fu../../../lib/$fpctarget
+-Fu../common/
+-Xs
+-XX
+-CX
+#ifdef mswindows
+-WG
+#endif
+
diff --git a/examples/gui/customwindow/images.inc b/examples/gui/customwindow/images.inc
new file mode 100644
index 00000000..79663a24
--- /dev/null
+++ b/examples/gui/customwindow/images.inc
@@ -0,0 +1,57 @@
+
+const
+ img_close: array[0..337] of byte = (
+ 66, 77, 82, 1, 0, 0, 0, 0, 0, 0,122, 0, 0, 0,108, 0, 0,
+ 0, 8, 0, 0, 0, 9, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 216, 0, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66, 71, 82,115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,226,226,226,238,238,238,225,225,225,223,223,223,223,223,
+ 223,226,226,226,238,238,238,226,226,226,228,228,228,184,184,184,231,
+ 231,231,226,226,226,226,226,226,230,230,230,184,184,184,228,228,228,
+ 172,172,172,160,160,160,173,173,173,231,231,231,231,231,231,173,173,
+ 173,160,160,160,172,172,172,216,216,216,159,159,159,153,153,153,170,
+ 170,170,168,168,168,153,153,153,157,157,157,215,215,215,225,225,225,
+ 219,219,219,165,165,165,149,149,149,149,149,149,162,162,162,218,218,
+ 218,225,225,225,227,227,227,229,229,229,158,158,158,141,141,141,142,
+ 142,142,163,163,163,232,232,232,227,227,227,227,227,227,152,152,152,
+ 136,136,136,146,146,146,144,144,144,136,136,136,154,154,154,228,228,
+ 228,149,149,149,128,128,128,140,140,140,217,217,217,215,215,215,138,
+ 138,138,128,128,128,150,150,150,213,213,213,147,147,147,214,214,214,
+ 226,226,226,226,226,226,214,214,214,146,146,146,213,213,213);
+
+
+const
+ img_resize: array[0..473] of byte = (
+ 66, 77,218, 1, 0, 0, 0, 0, 0, 0,122, 0, 0, 0,108, 0, 0,
+ 0, 10, 0, 0, 0, 11, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0,
+ 96, 1, 0, 0,196, 14, 0, 0,196, 14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 66, 71, 82,115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,242,242,242,242,242,242,242,242,242,242,242,242,233,233,
+ 233,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, 0,
+ 0,167,167,167,167,167,167,167,167,167,162,162,162,189,189,189,223,
+ 223,223,223,223,223,223,223,223,223,223,223,223,223,223, 0, 0,157,
+ 157,157,157,157,157,157,157,157,193,193,193,226,226,226,224,224,224,
+ 224,224,224,224,224,224,224,224,224,224,224,224, 0, 0,146,146,146,
+ 141,141,141,144,144,144,164,164,164,229,229,229,224,224,224,224,224,
+ 224,224,224,224,224,224,224,224,224,224, 0, 0,131,131,131,175,175,
+ 175,146,146,146,133,133,133,153,153,153,224,224,224,224,224,224,224,
+ 224,224,224,224,224,224,224,224, 0, 0,174,174,174,225,225,225,215,
+ 215,215,146,146,146,208,208,208,228,228,228,239,239,239,227,227,227,
+ 225,225,225,235,235,235, 0, 0,225,225,225,225,225,225,225,225,225,
+ 225,225,225,225,225,225,225,225,225,183,183,183,232,232,232,235,235,
+ 235,201,201,201, 0, 0,226,226,226,226,226,226,226,226,226,226,226,
+ 226,226,226,226,167,167,167,153,153,153,167,167,167,193,193,193,154,
+ 154,154, 0, 0,226,226,226,226,226,226,226,226,226,226,226,226,226,
+ 226,226,215,215,215,152,152,152,144,144,144,144,144,144,144,144,144,
+ 0, 0,226,226,226,226,226,226,226,226,226,226,226,226,226,226,226,
+ 235,235,235,184,184,184,134,134,134,134,134,134,134,134,134, 0, 0,
+ 227,227,227,227,227,227,227,227,227,227,227,227,227,227,227,168,168,
+ 168,115,115,115,115,115,115,115,115,115,115,115,115, 0, 0);
+
+
diff --git a/examples/gui/customwindow/resize.bmp b/examples/gui/customwindow/resize.bmp
new file mode 100644
index 00000000..8bb264cf
--- /dev/null
+++ b/examples/gui/customwindow/resize.bmp
Binary files differ
diff --git a/examples/gui/customwindow/units/.gitignore b/examples/gui/customwindow/units/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/gui/customwindow/units/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/gui/drag_n_drop/dndexample.lpr b/examples/gui/drag_n_drop/dndexample.lpr
index c95b97d0..46c5a1f6 100644
--- a/examples/gui/drag_n_drop/dndexample.lpr
+++ b/examples/gui/drag_n_drop/dndexample.lpr
@@ -64,6 +64,7 @@ procedure TMainForm.Edit1DragEnter(Sender, Source: TObject;
var
s: string;
begin
+ ShowMimeList(AMimeList);
s := 'text/plain';
if chkAccept.Checked then
Accept := False
@@ -73,7 +74,6 @@ begin
begin
if AMimeChoice <> s then
AMimeChoice := s;
- ShowMimeList(AMimeList);
end;
end;
@@ -83,6 +83,7 @@ procedure TMainForm.Bevel1DragEnter(Sender, Source: TObject;
var
s: string;
begin
+ ShowMimeList(AMimeList);
{ the mime type we want to accept }
s := 'text/html';
{ if we wil accept the drop, set Accept to True }
@@ -93,7 +94,6 @@ begin
if AMimeChoice <> s then
AMimeChoice := s;
- ShowMimeList(AMimeList);
Bevel1.BackgroundColor := clRed;
end;
end;
@@ -121,6 +121,8 @@ end;
procedure TMainForm.btnClearClicked(Sender: TObject);
begin
Grid1.RowCount := 0;
+ Edit1.Text := '';
+ Bevel1.Text := '';
end;
procedure TMainForm.LabelDragStartDetected(Sender: TObject);
diff --git a/examples/gui/filedialog/filedialog.lpi b/examples/gui/filedialog/filedialog.lpi
index 872cf6e3..f6efbd83 100644
--- a/examples/gui/filedialog/filedialog.lpi
+++ b/examples/gui/filedialog/filedialog.lpi
@@ -36,7 +36,6 @@
<Unit0>
<Filename Value="filedialog.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="filedialog"/>
</Unit0>
</Units>
</ProjectOptions>
@@ -54,6 +53,7 @@
</SyntaxOptions>
</Parsing>
<Other>
+ <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/gui/filedialog/filedialog.lpr b/examples/gui/filedialog/filedialog.lpr
index 315b7885..1294ac06 100644
--- a/examples/gui/filedialog/filedialog.lpr
+++ b/examples/gui/filedialog/filedialog.lpr
@@ -119,7 +119,7 @@ procedure TMainForm.btnOpenFileClick(Sender: TObject);
var
dlg: TfpgFileDialog;
begin
- dlg := TfpgFileDialog.Create(nil);
+ dlg := TfpgFileDialog.Create(Self);
try
// defines 3 filters (All Files, Object Pascal and Lazarus Project)
dlg.Filter := 'All Files (*)|*|Object Pascal (*.pas;*.lpr;*.pp)|*.pas;*.lpr;*.pp|Lazarus Project (*.lpi)|*.lpi';
diff --git a/examples/gui/gridtest/gridtest.lpr b/examples/gui/gridtest/gridtest.lpr
index 173806e9..4b53f260 100644
--- a/examples/gui/gridtest/gridtest.lpr
+++ b/examples/gui/gridtest/gridtest.lpr
@@ -17,7 +17,8 @@ uses
fpg_checkbox,
fpg_tab,
fpg_edit,
- fpg_dialogs;
+ fpg_dialogs,
+ fpg_scrollbar;
type
@@ -256,6 +257,14 @@ begin
OnDrawCell := @StringGridDrawCell;
OnDoubleClick := @StringGridDoubleClicked;
OnHeaderClick := @StringGridHeaderClicked;
+ // Testing various scrollbar styles
+// ScrollBarStyle:= ssNone;
+// ScrollBarStyle:= ssHorizontal;
+// ScrollBarStyle:= ssVertical;
+ ScrollBarStyle:= ssAutoBoth;
+// ScrollBarStyle:= ssHorizVisible;
+// ScrollBarStyle:= ssVertiVisible;
+// ScrollBarStyle:= ssBothVisible;
end;
chkShowHeader := TfpgCheckBox.Create(self);
diff --git a/examples/gui/listviewtest/listviewtest.lpi b/examples/gui/listviewtest/listviewtest.lpi
index 50579565..595a5353 100644
--- a/examples/gui/listviewtest/listviewtest.lpi
+++ b/examples/gui/listviewtest/listviewtest.lpi
@@ -36,7 +36,6 @@
<Unit0>
<Filename Value="listviewtest.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="listviewtest"/>
</Unit0>
</Units>
</ProjectOptions>
@@ -53,11 +52,5 @@
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
- <Other>
- <CompilerMessages>
- <UseMsgFile Value="True"/>
- </CompilerMessages>
- <CompilerPath Value="$(CompPath)"/>
- </Other>
</CompilerOptions>
</CONFIG>
diff --git a/examples/gui/listviewtest/listviewtest.lpr b/examples/gui/listviewtest/listviewtest.lpr
index 38bb6c83..57ab27b6 100644
--- a/examples/gui/listviewtest/listviewtest.lpr
+++ b/examples/gui/listviewtest/listviewtest.lpr
@@ -9,7 +9,10 @@ uses
type
+ { TMainForm }
+
TMainForm = class(TfpgForm)
+ procedure ShowFocusItemChange(Sender: TObject);
private
FEdit: TfpgEdit;
FAddButton: TfpgButton;
@@ -18,6 +21,7 @@ type
FTmpListView: TfpgListView;
FQuitButton: TfpgButton;
FCheck: TfpgCheckBox;
+ FShowFocus: TfpgCheckBox;
procedure LVColumnClicked(Listview: TfpgListView; Column: TfpgLVColumn; Button: Integer);
procedure CloseBttn(Sender: TObject);
procedure AddBttn(Sender: TObject);
@@ -35,6 +39,11 @@ type
{ TMainForm }
+procedure TMainForm.ShowFocusItemChange(Sender: TObject);
+begin
+ FListView.ShowFocusRect:=TfpgCheckBox(Sender).Checked;
+end;
+
procedure TMainForm.LVColumnClicked(Listview: TfpgListView; Column: TfpgLVColumn;
Button: Integer);
begin
@@ -260,6 +269,17 @@ begin
OnChange := @ShowHeadersChange;
end;
+ FShowFocus := TfpgCheckBox.Create(BottomPanel);
+ with FShowFocus do begin
+ Parent := BottomPanel;
+ Top := 10;
+ Left := 320;
+ Width := 130;
+ Checked := True;
+ Text := 'Show Item Focus';
+ OnChange:=@ShowFocusItemChange;
+ end;
+
end;
begin
diff --git a/examples/gui/modalforms/modalforms.lpi b/examples/gui/modalforms/modalforms.lpi
index cc8137c8..2f25e23a 100644
--- a/examples/gui/modalforms/modalforms.lpi
+++ b/examples/gui/modalforms/modalforms.lpi
@@ -36,7 +36,6 @@
<Unit0>
<Filename Value="modalforms.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="modalforms"/>
</Unit0>
</Units>
</ProjectOptions>
@@ -54,6 +53,7 @@
</SyntaxOptions>
</Parsing>
<Other>
+ <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/gui/modalforms/modalforms.lpr b/examples/gui/modalforms/modalforms.lpr
index 99f53ab3..bac0af81 100644
--- a/examples/gui/modalforms/modalforms.lpr
+++ b/examples/gui/modalforms/modalforms.lpr
@@ -99,7 +99,7 @@ procedure TForm1.btnOpenForm2Click(Sender: TObject);
var
frm: TForm2;
begin
- frm := TForm2.Create(nil);
+ frm := TForm2.Create(Self);
try
frm.ShowModal;
writeln('Form2: This should only appear after the form closes.');
@@ -113,6 +113,7 @@ end;
constructor TForm1.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
+ Visible:=False;
WindowTitle := 'Form1';
Sizeable := False;
SetPosition(150, 150, 200, 200);
@@ -144,7 +145,7 @@ procedure TMainForm.btnOpenForm1Click(Sender: TObject);
var
frm: TForm1;
begin
- frm := TForm1.Create(nil);
+ frm := TForm1.Create(Self);
try
frm.ShowModal;
writeln('Form1: This should only appear after the form closes.');
diff --git a/examples/gui/reporting/u_demo.pas b/examples/gui/reporting/u_demo.pas
index 349b0ad1..adad8515 100644
--- a/examples/gui/reporting/u_demo.pas
+++ b/examples/gui/reporting/u_demo.pas
@@ -1279,12 +1279,10 @@ begin
Ckb_Preferences := CreateCheckBox(Self, 650, 30, 'FitWindow preference');
Ckb_Preferences.OnChange := @Ckb_PreferencesChange;
P_Zoom := CreatePanel(Self, 650, 60, 200, 60, 'Zoom', bsRaised, taCenter, tlTop, 5);
- P_Zoom.BackgroundColor := clPaleGreen;
SE_Zoom := CreateSpinEdit(P_Zoom, 10, 25, 55, 20, 20, 200, 1, 5, 100);
SE_Zoom.OnChange := @SE_ZoomChange;
L_Zoom := CreateLabel(P_Zoom, 70, 25, '%');
P_Layout := CreatePanel(Self, 650, 130, 200, 110, 'Layout', bsRaised, taCenter, tlTop, 5);
- P_Layout.BackgroundColor := clPaleGreen;
RB_Single := CreateRadiobutton(P_Layout, 10, 25, 'Single');
RB_Single.OnChange := @P_LayoutRBChange;
RB_Two := CreateRadiobutton(P_Layout, 10, 50, 'Two pages');
@@ -1295,7 +1293,6 @@ begin
Ckb_Preferences.Checked := True;
RB_Single.Checked := True;
Bt_Exit := CreateButton(Self, 375, 550, 150, 'Exit', @Bt_ExitClick, 'stdimg.exit');
- Bt_Exit.BackgroundColor := clTomato;
ZoomValue := '100';
Randomize;
for Cpt := 0 to 18 do
diff --git a/examples/gui/togglebox/ToggleBoxTest.lpi b/examples/gui/togglebox/ToggleBoxTest.lpi
new file mode 100644
index 00000000..327b4258
--- /dev/null
+++ b/examples/gui/togglebox/ToggleBoxTest.lpi
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <General>
+ <Flags>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="ToggleBoxTest"/>
+ <UseAppBundle Value="False"/>
+ <ResourceType Value="res"/>
+ </General>
+ <i18n>
+ <EnableI18N LFM="False"/>
+ </i18n>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication Use="True" PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_toolkit"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="ToggleBoxTest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="mainfrm.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="mainfrm"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="ToggleBoxTest"/>
+ </Target>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="3">
+ <Item1>
+ <Name Value="EAbort"/>
+ </Item1>
+ <Item2>
+ <Name Value="ECodetoolError"/>
+ </Item2>
+ <Item3>
+ <Name Value="EFOpenError"/>
+ </Item3>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/examples/gui/togglebox/ToggleBoxTest.lpr b/examples/gui/togglebox/ToggleBoxTest.lpr
new file mode 100644
index 00000000..8866f9c5
--- /dev/null
+++ b/examples/gui/togglebox/ToggleBoxTest.lpr
@@ -0,0 +1,30 @@
+program ToggleBoxTest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}
+ cthreads,
+ {$ENDIF}
+ Classes,
+ fpg_main,
+ mainfrm;
+
+procedure MainProc;
+var
+ frmMain: TfrmMain;
+begin
+ fpgApplication.Initialize;
+ frmMain:= TfrmMain.Create(nil);
+ try
+ frmMain.Show;
+ fpgApplication.Run;
+ finally
+ frmMain.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/gui/togglebox/mainfrm.pas b/examples/gui/togglebox/mainfrm.pas
new file mode 100644
index 00000000..ff9a43da
--- /dev/null
+++ b/examples/gui/togglebox/mainfrm.pas
@@ -0,0 +1,44 @@
+unit mainfrm;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, fpg_base, fpg_form, fpg_toggle;
+
+type
+
+ { TfrmMain }
+
+ TfrmMain = class(TfpgForm)
+ private
+ FToggle: TfpgToggle;
+ public
+ constructor Create(AOwner: TComponent); override;
+ end;
+
+
+implementation
+
+{ TfrmMain }
+
+constructor TfrmMain.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ WindowTitle:='Yay a toggle!';
+ SetWidth(300);
+ SetHeight(200);
+
+ FToggle := TfpgToggle.Create(Self);
+ FToggle.SetPosition(10, 10, 200, 20);
+// FToggle.Width:=200;
+
+ //FToggle.ToggleSide:=tsLeft;
+ //FToggle.ToggleWidth:=100;
+ //FToggle.UseAnimation:=False;
+
+end;
+
+end.
+
diff --git a/examples/gui/video_vlc/frmvlcplayer.pas b/examples/gui/video_vlc/frmvlcplayer.pas
index 7b44c1e1..456ac202 100644
--- a/examples/gui/video_vlc/frmvlcplayer.pas
+++ b/examples/gui/video_vlc/frmvlcplayer.pas
@@ -6,7 +6,7 @@ interface
uses
SysUtils, Classes, fpg_base, fpg_panel, fpg_button, fpg_main, fpg_form,
- fpg_editbtn, fpg_memo, fpg_label, libvlc, vlc, fpg_vlc;
+ fpg_editbtn, fpg_memo, fpg_label, vlc, fpg_vlc;
type
@@ -23,14 +23,17 @@ type
Button3: TfpgButton;
Button4: TfpgButton;
Memo1: TfpgMemo;
- procedure Sync;
+ lblTimeLapse: TfpgLabel;
{@VFD_HEAD_END: VLCPlayerDemo}
+ procedure Sync;
+ procedure DoGUIUpdateTimeLapse;
public
P : TFpgVLCPlayer;
FMsg: String;
procedure AfterCreate; override;
Procedure InitPlayer;
Procedure Log(Const Msg : String);
+ Procedure UpdateTimeLapse(const Msg: String);
Procedure DoPlay(sender : TObject);
Procedure DoPause(sender : TObject);
Procedure DoResume(sender : TObject);
@@ -145,6 +148,7 @@ procedure TVLCPlayerDemoForm.DoOnTimeChanged(Sender: TObject;
const time: TDateTime);
begin
Log('Time changed : '+TimeToStr(Time));
+ UpdateTimeLapse(TimeToStr(time));
end;
procedure TVLCPlayerDemoForm.DoOnSnapshot(Sender: TObject;
@@ -167,6 +171,7 @@ begin
SetPosition(424, 319, 813, 574);
WindowTitle := 'VLCPlayerDemo';
Hint := '';
+ IconName := '';
Panel1 := TfpgPanel.Create(self);
with Panel1 do
@@ -187,7 +192,7 @@ begin
Anchors := [anLeft,anRight,anTop];
ExtraHint := '';
FileName := '';
- Filter := 'Video files|*.avi;*.flv;*.mp4';
+ Filter := 'Video files|*.avi;*.flv;*.mp4;*.mkv|Audio files|*.mp3;*.acc;*.flac;*.ogg';
InitialDir := '';
TabOrder := 2;
end;
@@ -269,6 +274,16 @@ begin
TabOrder := 8;
end;
+ lblTimeLapse := TfpgLabel.Create(self);
+ with lblTimeLapse do
+ begin
+ Name := 'lblTimeLapse';
+ SetPosition(30, 510, 105, 15);
+ FontDesc := 'Liberation Sans-12:bold:antialias=true';
+ Hint := '';
+ Text := 'Label';
+ end;
+
{@VFD_BODY_END: VLCPlayerDemo}
{%endregion}
end;
@@ -306,12 +321,25 @@ begin
Memo1.Lines.Add(FMsg);
end;
+procedure TVLCPlayerDemoForm.DoGUIUpdateTimeLapse;
+begin
+ lblTimeLapse.Text := FMsg;
+end;
+
procedure TVLCPlayerDemoForm.Log(const Msg: String);
begin
FMsg:=Msg;
TThread.Synchronize(Nil,@Self.Sync);
end;
+procedure TVLCPlayerDemoForm.UpdateTimeLapse(const Msg: String);
+begin
+ FMsg := Msg;
+ TThread.Synchronize(nil, @self.DoGUIUpdateTimeLapse);
+// This could also be used in FPC 3.0+
+// TThread.Queue(nil, @DoGUIUpdateTimeLapse);
+end;
+
procedure TVLCPlayerDemoForm.DoPlay(sender: TObject);
begin
InitPlayer;
diff --git a/examples/gui/video_vlc/testfpguivlc.lpi b/examples/gui/video_vlc/testfpguivlc.lpi
index d7a4ad2a..5a13551b 100644
--- a/examples/gui/video_vlc/testfpguivlc.lpi
+++ b/examples/gui/video_vlc/testfpguivlc.lpi
@@ -42,7 +42,6 @@
<Unit0>
<Filename Value="testfpguivlc.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="testfpguivlc"/>
</Unit0>
<Unit1>
<Filename Value="frmvlcplayer.pas"/>
@@ -50,17 +49,17 @@
<UnitName Value="frmvlcplayer"/>
</Unit1>
<Unit2>
- <Filename Value="../fpg_vlc.pas"/>
+ <Filename Value="../../../src/3rdparty/libvlc/fpg_vlc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="fpg_vlc"/>
</Unit2>
<Unit3>
- <Filename Value="../../libvlc/libvlc.pp"/>
+ <Filename Value="../../../src/3rdparty/libvlc/libvlc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="libvlc"/>
</Unit3>
<Unit4>
- <Filename Value="../../libvlc/vlc.pas"/>
+ <Filename Value="../../../src/3rdparty/libvlc/vlc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vlc"/>
</Unit4>
@@ -76,12 +75,6 @@
<OtherUnitFiles Value="../../../src/3rdparty/libvlc"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
- <Other>
- <CompilerMessages>
- <MsgFileName Value=""/>
- </CompilerMessages>
- <CompilerPath Value="$(CompPath)"/>
- </Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">