summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-10 07:59:53 +0000
committersekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-10 07:59:53 +0000
commit7093ec0d7d60e03e81c7a9fa8bdadca639e1a112 (patch)
treef00d8353e9456f9bfb41c97d246cedd1096cf1be
parent837473a40efa0ed7b725e12fb0df0557f5cf3a90 (diff)
downloadfpGUI-7093ec0d7d60e03e81c7a9fa8bdadca639e1a112.tar.xz
Added new multihandle prototype
-rw-r--r--prototypes/newmultihandle/examples/helloworld.lpi173
-rw-r--r--prototypes/newmultihandle/examples/helloworld.lpr63
-rw-r--r--prototypes/newmultihandle/fpgui.pas23
-rw-r--r--prototypes/newmultihandle/fpguipackage.lpk43
-rw-r--r--prototypes/newmultihandle/fpguipackage.pas20
-rw-r--r--prototypes/newmultihandle/gui_button.inc50
-rw-r--r--prototypes/newmultihandle/gui_widget.inc20
7 files changed, 392 insertions, 0 deletions
diff --git a/prototypes/newmultihandle/examples/helloworld.lpi b/prototypes/newmultihandle/examples/helloworld.lpi
new file mode 100644
index 00000000..400175bb
--- /dev/null
+++ b/prototypes/newmultihandle/examples/helloworld.lpi
@@ -0,0 +1,173 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="\"/>
+ <Version Value="5"/>
+ <General>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=".exe"/>
+ <ActiveEditorIndexAtStart Value="0"/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ <Language Value=""/>
+ <CharSet Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="2">
+ <Item1>
+ <PackageName Value="fpguipackage"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="fpGFXPackage"/>
+ </Item2>
+ </RequiredPackages>
+ <Units Count="6">
+ <Unit0>
+ <Filename Value="helloworld.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="helloworld"/>
+ <CursorPos X="3" Y="56"/>
+ <TopLine Value="38"/>
+ <EditorIndex Value="0"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="..\fpgui.pas"/>
+ <UnitName Value="fpgui"/>
+ <CursorPos X="31" Y="8"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="1"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit1>
+ <Unit2>
+ <Filename Value="..\..\fpgui2\source\gui\gui_form.pas"/>
+ <UnitName Value="gui_form"/>
+ <CursorPos X="5" Y="2"/>
+ <TopLine Value="1"/>
+ <UsageCount Value="10"/>
+ </Unit2>
+ <Unit3>
+ <Filename Value="..\gui_widget.inc"/>
+ <IsPartOfProject Value="True"/>
+ <CursorPos X="47" Y="12"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="3"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit3>
+ <Unit4>
+ <Filename Value="..\gui_button.inc"/>
+ <IsPartOfProject Value="True"/>
+ <CursorPos X="3" Y="27"/>
+ <TopLine Value="6"/>
+ <EditorIndex Value="4"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit4>
+ <Unit5>
+ <Filename Value="..\..\..\gfx\gfxbase.pas"/>
+ <UnitName Value="GfxBase"/>
+ <CursorPos X="17" Y="1028"/>
+ <TopLine Value="1014"/>
+ <EditorIndex Value="2"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit5>
+ </Units>
+ <JumpHistory Count="17" HistoryIndex="16">
+ <Position1>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="5" Column="58" TopLine="1"/>
+ </Position1>
+ <Position2>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="6" Column="27" TopLine="1"/>
+ </Position2>
+ <Position3>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="4" Column="14" TopLine="1"/>
+ </Position3>
+ <Position4>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="1" Column="29" TopLine="1"/>
+ </Position4>
+ <Position5>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="12" Column="17" TopLine="1"/>
+ </Position5>
+ <Position6>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="15" Column="11" TopLine="1"/>
+ </Position6>
+ <Position7>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="6" Column="9" TopLine="1"/>
+ </Position7>
+ <Position8>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="8" Column="10" TopLine="1"/>
+ </Position8>
+ <Position9>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="28" Column="2" TopLine="16"/>
+ </Position9>
+ <Position10>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="29" Column="3" TopLine="17"/>
+ </Position10>
+ <Position11>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="38" Column="28" TopLine="26"/>
+ </Position11>
+ <Position12>
+ <Filename Value="..\gui_button.inc"/>
+ <Caret Line="27" Column="1" TopLine="6"/>
+ </Position12>
+ <Position13>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="38" Column="51" TopLine="26"/>
+ </Position13>
+ <Position14>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="46" Column="3" TopLine="34"/>
+ </Position14>
+ <Position15>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="12" Column="41" TopLine="1"/>
+ </Position15>
+ <Position16>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="11" Column="52" TopLine="1"/>
+ </Position16>
+ <Position17>
+ <Filename Value="..\gui_widget.inc"/>
+ <Caret Line="12" Column="40" TopLine="1"/>
+ </Position17>
+ </JumpHistory>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/prototypes/newmultihandle/examples/helloworld.lpr b/prototypes/newmultihandle/examples/helloworld.lpr
new file mode 100644
index 00000000..af6c89b9
--- /dev/null
+++ b/prototypes/newmultihandle/examples/helloworld.lpr
@@ -0,0 +1,63 @@
+program HelloWorld;
+
+{$mode objfpc}{$h+}
+
+uses
+ fpgui,
+ fpGFX,
+ gfxBase;
+
+type
+ TMainForm = class(TFWidget)
+ private
+// BoxLayout: TFBoxLayout;
+ btnHello: TFButton;
+ public
+ procedure AfterConstruction; override;
+ end;
+
+
+{ TMainForm }
+
+procedure TMainForm.AfterConstruction;
+var
+ lSize: TSize;
+begin
+ inherited AfterConstruction;
+ Name := 'MainForm';
+// BorderWidth := 8;
+// Text := 'fpGUI Application';
+
+ { every fpGUI app needs a layout manager }
+{ BoxLayout := TFBoxLayout.Create(self);
+ BoxLayout.Spacing := 8;
+ BoxLayout.VertAlign := vertFill;
+ InsertChild(BoxLayout);}
+
+ { create our button }
+ btnHello := TFButton.Create('Hello World!', self);
+{ btnHello.CanExpandWidth := True;
+ btnHello.CanExpandHeight := True;
+ BoxLayout.InsertChild(btnHello); }
+
+ { set a min and max size }
+ lSize.cx := 150;
+ lSize.cy := 100;
+ SetMinMaxClientSize(lSize, lSize);
+end;
+
+
+var
+ MainForm: TMainForm;
+begin
+ GFApplication.Initialize;
+ MainForm := TMainForm.Create(nil);
+ try
+// GFApplication.AddWindow(MainForm);
+ MainForm.Show;
+ GFApplication.Run;
+ finally
+// MainForm.Free;
+ end;
+end.
+
diff --git a/prototypes/newmultihandle/fpgui.pas b/prototypes/newmultihandle/fpgui.pas
new file mode 100644
index 00000000..c4baf0e7
--- /dev/null
+++ b/prototypes/newmultihandle/fpgui.pas
@@ -0,0 +1,23 @@
+unit fpgui;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, gfxbase, fpgfx;
+
+{$include gui_widget.inc}
+
+{$include gui_button.inc}
+
+implementation
+
+{$define READ_IMPLEMENTATION}
+
+{$include gui_widget.inc}
+
+{$include gui_button.inc}
+
+end.
+
diff --git a/prototypes/newmultihandle/fpguipackage.lpk b/prototypes/newmultihandle/fpguipackage.lpk
new file mode 100644
index 00000000..46b70a33
--- /dev/null
+++ b/prototypes/newmultihandle/fpguipackage.lpk
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <Package Version="2">
+ <PathDelim Value="\"/>
+ <Name Value="fpguipackage"/>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <SearchPaths>
+ <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
+ </SearchPaths>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Files Count="1">
+ <Item1>
+ <Filename Value="fpgui.pas"/>
+ <UnitName Value="fpgui"/>
+ </Item1>
+ </Files>
+ <Type Value="RunAndDesignTime"/>
+ <RequiredPkgs Count="2">
+ <Item1>
+ <PackageName Value="fpGFXPackage"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="FCL"/>
+ <MinVersion Major="1" Valid="True"/>
+ </Item2>
+ </RequiredPkgs>
+ <UsageOptions>
+ <UnitPath Value="$(PkgOutDir)"/>
+ </UsageOptions>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ </PublishOptions>
+ </Package>
+</CONFIG>
diff --git a/prototypes/newmultihandle/fpguipackage.pas b/prototypes/newmultihandle/fpguipackage.pas
new file mode 100644
index 00000000..3e13dea3
--- /dev/null
+++ b/prototypes/newmultihandle/fpguipackage.pas
@@ -0,0 +1,20 @@
+{ This file was automatically created by Lazarus. Do not edit!
+This source is only used to compile and install the package.
+ }
+
+unit fpguipackage;
+
+interface
+
+uses
+ fpgui, LazarusPackageIntf;
+
+implementation
+
+procedure Register;
+begin
+end;
+
+initialization
+ RegisterPackage('fpguipackage', @Register);
+end.
diff --git a/prototypes/newmultihandle/gui_button.inc b/prototypes/newmultihandle/gui_button.inc
new file mode 100644
index 00000000..672b9868
--- /dev/null
+++ b/prototypes/newmultihandle/gui_button.inc
@@ -0,0 +1,50 @@
+{$ifndef READ_IMPLEMENTATION}
+
+type
+ TFButton = class(TFWidget)
+ constructor Create(AParent: TFCustomWindow); override;
+ constructor Create(ACaption: string; AParent: TFCustomWindow);
+ procedure Paint(Sender: TObject; const Rect: TRect);
+ procedure MouseReleased(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ end;
+
+
+{$else}
+
+constructor TFButton.Create(AParent: TFCustomWindow);
+begin
+ inherited Create(AParent);
+
+ OnMouseReleased := @MouseReleased;
+ OnPaint := @Paint;
+
+ SetClientSize(Size(125, 125));
+ SetMinMaxClientSize(Size(125, 125), Size(125, 125));
+end;
+
+constructor TFButton.Create(ACaption: string; AParent: TFCustomWindow);
+begin
+ Create(AParent);
+end;
+
+procedure TFButton.MouseReleased(Sender: TObject; AButton: TMouseButton;
+ AShift: TShiftState; const AMousePos: TPoint);
+begin
+ WriteLn('Mouse released on child window');
+end;
+
+procedure TFButton.Paint(Sender: TObject; const Rect: TRect);
+var
+ r: TRect;
+ tw: integer;
+begin
+ Canvas.SetColor(colBlue);
+ r.Left := 0;
+ r.Top := 0;
+ r.Right := Width;
+ r.Bottom := Height;
+ Canvas.FillRect(r);
+end;
+
+{$endif}
+
diff --git a/prototypes/newmultihandle/gui_widget.inc b/prototypes/newmultihandle/gui_widget.inc
new file mode 100644
index 00000000..2521541d
--- /dev/null
+++ b/prototypes/newmultihandle/gui_widget.inc
@@ -0,0 +1,20 @@
+{$ifndef READ_IMPLEMENTATION}
+
+type
+ TFWidget = class(TFWindow)
+ constructor Create(AParent: TFCustomWindow); virtual;
+ end;
+
+{$else}
+
+constructor TFWidget.Create(AParent: TFCustomWindow);
+begin
+ if (AParent = nil) then inherited Create(nil, [woWindow])
+ else inherited Create(AParent, [woChildWindow]);
+
+ SetClientSize(Size(125, 125));
+ SetMinMaxClientSize(Size(125, 125), Size(125, 125));
+end;
+
+{$endif}
+