diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-23 09:40:43 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-23 09:40:43 +0000 |
commit | 652ba160012b1eda3a1f6dafb9311b0dcade476c (patch) | |
tree | 8abf8d7cc6246484c646b8160b8ab0179ac5b069 /prototypes/fpgui2 | |
parent | 6bda2054c8dda9b98f9958c54fce9f27927642c5 (diff) | |
download | fpGUI-652ba160012b1eda3a1f6dafb9311b0dcade476c.tar.xz |
Restructure Part 3.
* Moved all the examples over from the prototype directory.
* Removed obsolete GFX examples.
Diffstat (limited to 'prototypes/fpgui2')
19 files changed, 0 insertions, 1573 deletions
diff --git a/prototypes/fpgui2/examples/core/canvastest/button.bmp b/prototypes/fpgui2/examples/core/canvastest/button.bmp Binary files differdeleted file mode 100644 index 8ae427cf..00000000 --- a/prototypes/fpgui2/examples/core/canvastest/button.bmp +++ /dev/null diff --git a/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpi b/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpi deleted file mode 100644 index 9c070422..00000000 --- a/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpi +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value="./"/> - <TargetFileExt Value=""/> - <Title Value="fpcanvas"/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="fpgcanvas.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="fpgcanvas"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits -"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpr b/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpr deleted file mode 100644 index 4e3b0944..00000000 --- a/prototypes/fpgui2/examples/core/canvastest/fpgcanvas.lpr +++ /dev/null @@ -1,205 +0,0 @@ -program fpgcanvas; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, SysUtils, - fpgfx, - gfxbase, - gui_form, - gfx_imgfmt_bmp; - - -type - - { TMainForm } - - TMainForm = class(TfpgForm) - private - bmp: TfpgImage; - dst: TfpgImage; - protected - procedure HandlePaint; override; - public - procedure AfterCreate; override; - procedure BeforeDestruction; override; - end; - -{ TMainForm } - -procedure TMainForm.HandlePaint; -var - r: TfpgRect; - fnt: TfpgFont; - y: integer; - c: TfpgColor; -begin - // Enable double buffering. Must be before 'inherited' to prevent form - // clearing itself. - Canvas.BeginDraw; - inherited HandlePaint; - - // Testing Rectangles - Canvas.SetColor(clBlack); - r.Top := 5; - r.Left := 60; - r.Width := 50; - r.Height := 50; - Canvas.DrawRectangle(r); - - r.Left := 120; - Canvas.SetLineStyle(2, lsDash); - Canvas.DrawRectangle(r); - - r.Left := 180; - Canvas.SetColor(clGreen); - Canvas.SetLineStyle(1, lsDot); - Canvas.DrawRectangle(r); - - r.Left := 240; - Canvas.SetColor(clBlue); - Canvas.SetLineStyle(1, lsSolid); - Canvas.FillRectangle(r); - - - // Testing line drawing - Canvas.DrawLine(5, 5, 50, 50); - Canvas.SetColor(clBlue); - Canvas.DrawLine(50, 5, 5, 50); - Canvas.SetColor(clRed); - { Diagonal line } - Canvas.DrawLine(60, 5, 110, 55); - { Horizontal line } - Canvas.DrawLine(60, 3, 110, 3); - { Vertical line } - Canvas.DrawLine(58, 5, 58, 55); - - - // Testing Text and Fonts - y := 60; - Canvas.SetTextColor(clBlack); - Canvas.DrawString(5, y, 'This text must be black and default font (' + fpgApplication.DefaultFont.FontDesc + ')'); - Canvas.SetTextColor(clRed); - y := y + Canvas.Font.Height; // fonts are different sizes on differet OS's - Canvas.DrawString(5, y, 'This text must be red.'); - Canvas.SetTextColor(clBlack); - y := y + Canvas.Font.Height; - Canvas.DrawString(5, y, 'Russian (UTF-8) text -> Òåñò'); - y := y + Canvas.Font.Height; - fnt := fpgApplication.GetFont('Times-14:bold'); - Canvas.Font := fnt; - Canvas.DrawString(5, y, 'Font used is ' + Canvas.Font.FontDesc); - y := y + Canvas.Font.Height; - - - // Testing basic style drawings - Canvas.Font := fpgApplication.DefaultFont; - Canvas.DrawString(320, 3, 'DrawButtonFace():'); - Canvas.DrawButtonFace(300, 20, 75, 25, []); - Canvas.DrawString(385, 20, '= []'); - Canvas.DrawButtonFace(300, 50, 75, 25, [btnIsDefault]); - Canvas.DrawString(385, 50, '= [btnIsDefault]'); - Canvas.DrawButtonFace(300, 80, 75, 25, [btnIsPressed]); - Canvas.DrawString(385, 80, '= [btnIsPressed]'); - Canvas.DrawButtonFace(300, 110, 75, 25, [btnIsEmbedded, btnIsPressed]); - Canvas.DrawString(385, 110, '= [embed & press]'); - Canvas.DrawButtonFace(300, 140, 75, 25, [btnIsEmbedded]); - Canvas.DrawString(385, 140, '= [btnIsEmbedded]'); - - Canvas.DrawString(45, y, 'DrawControlFrame():'); - y := y + Canvas.Font.Height; - Canvas.DrawControlFrame(5, y, 200, 23); - - - // Testing Bitmap painting - Canvas.DrawString(5, 180, 'Single BMP file:'); - Canvas.DrawString(300, 210, '(mask enabled for all images)'); - Canvas.DrawImage(150, 180, bmp); - Canvas.DrawString(5, 210, 'Parts of BMP file:'); - Canvas.DrawImagePart(150, 210, bmp, 0, 0, 32, 21); - Canvas.DrawImagePart(190, 210, bmp, 32, 0, 32, 21); - Canvas.DrawImagePart(230, 210, bmp, 64, 0, 32, 21); - -// Canvas.StretchDraw(150, 240, 160, 21, bmp); - Canvas.StretchDraw(150, 240, 300, 50, bmp); - - Canvas.DrawImage(150, 300, dst); - Canvas.StretchDraw(180, 300, 70, 70, dst); - Canvas.StretchDraw(265, 300, 230, 25, bmp); - - - // testing accuracy of line/rectangle drawing - Canvas.SetColor(clBlack); - Canvas.SetLineStyle(1, lsSolid); - r.Top := 302; - r.Left := 182; - r.Width := 66; - r.Height := 66; - Canvas.DrawRectangle(r); - - Canvas.SetColor(clBlue); - Canvas.DrawLine(183, 303, 247, 303); - - -// Stretch(bmp, dst, ResampleFilters[6].Filter, ResampleFilters[6].Width); -//// Canvas.DrawImage(150, 240, bmp); -// Canvas.DrawImage(160, 250, dst); - - - - // Testing Canvas.Pixels[] - // two pixels should have changed color in the top left of the form - Canvas.Pixels[7,5] := clBlue; // This tests consistant bit order handling (RGB) - Canvas.Pixels[8,5] := clRed; - c := Canvas.Pixels[192, 227]; // should be orange like color - Canvas.Pixels[9,5] := c; - c := Canvas.Pixels[150 + (32*4) + 3, 199]; // should be lightblue like color - Canvas.Pixels[10,5] := c; - - Canvas.EndDraw; -end; - -procedure TMainForm.AfterCreate; -begin - inherited AfterCreate; - SetPosition(100, 100, 500, 400); - WindowTitle := 'fpGFX Canvas Test'; - - bmp := LoadImage_BMP('button.bmp'); - if not Assigned(bmp) then - raise Exception.Create('Failed to load button.bmp'); - bmp.CreateMaskFromSample(0,0); - bmp.UpdateImage; - -// dst := TfpgImage.Create; -// dst.AllocateImage(bmp.ColorDepth, 200, 50); - dst := LoadImage_BMP('gears2.bmp'); - dst.CreateMaskFromSample(0,0); - dst.UpdateImage; -end; - -procedure TMainForm.BeforeDestruction; -begin - dst.Free; - bmp.Free; - inherited BeforeDestruction; -end; - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - - -begin - MainProc; -end. - diff --git a/prototypes/fpgui2/examples/core/canvastest/gears2.bmp b/prototypes/fpgui2/examples/core/canvastest/gears2.bmp Binary files differdeleted file mode 100755 index 52ac3254..00000000 --- a/prototypes/fpgui2/examples/core/canvastest/gears2.bmp +++ /dev/null diff --git a/prototypes/fpgui2/examples/core/canvastest/linux_screenshot.png b/prototypes/fpgui2/examples/core/canvastest/linux_screenshot.png Binary files differdeleted file mode 100644 index e7268d23..00000000 --- a/prototypes/fpgui2/examples/core/canvastest/linux_screenshot.png +++ /dev/null diff --git a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi deleted file mode 100644 index f09daf7e..00000000 --- a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="\"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value=".\"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="eventtest.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="eventtest"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <PathDelim Value="\"/> - <CodeGeneration> - <Optimizations> - <OptimizationLevel Value="0"/> - </Optimizations> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr deleted file mode 100644 index 5ba36a09..00000000 --- a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr +++ /dev/null @@ -1,247 +0,0 @@ -program eventtest; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, SysUtils, GFXBase, fpGFX, gfx_widget; - - -const - ButtonNames: array[TMouseButton] of PChar = - ('Left', 'Right', 'Middle'); - -type - - { TMainForm } - - TMainForm = class(TfpgWindow) - private - FMoveEventCount: integer; - function ShiftStateToStr(Shift: TShiftState): string; - function MouseState(AShift: TShiftState; const AMousePos: TPoint): string; - procedure MsgActivate(var msg: TfpgMessageRec); message FPGM_ACTIVATE; - procedure MsgDeActivate(var msg: TfpgMessageRec); message FPGM_DEACTIVATE; - procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE; - procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT; - procedure MsgResize(var msg: TfpgMessageRec); message FPGM_RESIZE; - procedure MsgMove(var msg: TfpgMessageRec); message FPGM_MOVE; - procedure MsgKeyChar(var msg: TfpgMessageRec); message FPGM_KEYCHAR; - procedure MsgKeyPress(var msg: TfpgMessageRec); message FPGM_KEYPRESS; - procedure MsgKeyRelease(var msg: TfpgMessageRec); message FPGM_KEYRELEASE; - procedure MsgMouseDown(var msg: TfpgMessageRec); message FPGM_MOUSEDOWN; - procedure MsgMouseUp(var msg: TfpgMessageRec); message FPGM_MOUSEUP; - procedure MsgMouseMove(var msg: TfpgMessageRec); message FPGM_MOUSEMOVE; - procedure MsgDoubleClick(var msg: TfpgMessageRec); message FPGM_DOUBLECLICK; - procedure MsgMouseEnter(var msg: TfpgMessageRec); message FPGM_MOUSEENTER; - procedure MsgMouseExit(var msg: TfpgMessageRec); message FPGM_MOUSEEXIT; - procedure MsgScroll(var msg: TfpgMessageRec); message FPGM_SCROLL; - protected - public - constructor Create(AOwner: TComponent); override; - procedure Show; - end; - -{ TMainForm } - -function TMainForm.ShiftStateToStr(Shift: TShiftState): string; -begin - SetLength(Result, 0); - if ssShift in Shift then - Result := 'Shift '; - if ssAlt in Shift then - Result := Result + 'Alt '; - if ssCtrl in Shift then - Result := Result + 'Ctrl '; - if ssMeta in Shift then - Result := Result + 'Meta '; - if ssSuper in Shift then - Result := Result + 'Super '; - if ssHyper in Shift then - Result := Result + 'Hyper '; - if ssAltGr in Shift then - Result := Result + 'AltGr '; - if ssCaps in Shift then - Result := Result + 'Caps '; - if ssNum in Shift then - Result := Result + 'Num '; - if ssScroll in Shift then - Result := Result + 'Scroll '; - if ssLeft in Shift then - Result := Result + 'Left '; - if ssRight in Shift then - Result := Result + 'Right '; - if ssMiddle in Shift then - Result := Result + 'Middle '; - if ssDouble in Shift then - Result := Result + 'Double '; - if Length(Result) > 0 then - SetLength(Result, Length(Result) - 1); - -end; - -function TMainForm.MouseState(AShift: TShiftState; const AMousePos: TPoint): string; -var - ShiftStateStr: String; -begin - ShiftStateStr := ShiftStateToStr(AShift); - Result := '[X=' + IntToStr(AMousePos.x) + ' Y=' + IntToStr(AMousePos.y); - if Length(ShiftStateStr) > 0 then - Result := Result + ' ' + ShiftStateStr; - Result := Result + '] '; -end; - -procedure TMainForm.MsgActivate(var msg: TfpgMessageRec); -begin - Writeln('Window Activate message'); -end; - -procedure TMainForm.MsgDeActivate(var msg: TfpgMessageRec); -begin - Writeln('Window is Deactivate message'); -end; - -procedure TMainForm.MsgClose(var msg: TfpgMessageRec); -begin - Writeln('Window Close message'); - Halt(0); -end; - -procedure TMainForm.MsgPaint(var msg: TfpgMessageRec); -var - h: integer; -begin - Writeln('Paint message'); - Canvas.BeginDraw; - h := Canvas.Font.Height; - Canvas.SetColor(clWhite); - Canvas.FillRectangle(0, 0, Width, Height); - Canvas.SetTextColor(clBlack); - Canvas.DrawString(0, 0, 'Event test'); - Canvas.DrawString(0, h, 'Do something interactive (move mouse, press keys...)'); - Canvas.DrawString(0, h*2, 'and watch the output on the console.'); - Canvas.EndDraw; -end; - -procedure TMainForm.MsgResize(var msg: TfpgMessageRec); -begin - Writeln('Resize'); - FWidth := msg.Params.rect.Width; - FHeight := msg.Params.rect.Height; - - WriteLn('Window has been resized. New width: ', - Width, ' x ', Height); -// '; new client width: ', ClientWidth, ' x ', ClientHeight); - -end; - -procedure TMainForm.MsgMove(var msg: TfpgMessageRec); -begin - WriteLn('Window has been moved to ', Left, '/', Top); -end; - -procedure TMainForm.MsgKeyChar(var msg: TfpgMessageRec); -var - AKeyChar: Char; -begin - Write('Character generated: '); - AKeyChar := msg.Params.keyboard.keychar; - if AKeyChar >= ' ' then - WriteLn('''', AKeyChar, '''') - else - WriteLn('#', Ord(AKeyChar)); -end; - -procedure TMainForm.MsgKeyPress(var msg: TfpgMessageRec); -begin - WriteLn('[', ShiftStateToStr(msg.Params.keyboard.shiftstate), '] Key pressed: ', - KeycodeToText(msg.Params.keyboard.keycode, [])); -end; - -procedure TMainForm.MsgKeyRelease(var msg: TfpgMessageRec); -begin - WriteLn('[', ShiftStateToStr(msg.Params.keyboard.shiftstate), '] Key released: ', - KeycodeToText(msg.Params.keyboard.keycode, [])); -end; - -procedure TMainForm.MsgMouseDown(var msg: TfpgMessageRec); -begin - WriteLn(MouseState(msg.Params.mouse.shiftstate, Point(msg.Params.mouse.x, msg.Params.mouse.y)), - 'Mouse button pressed: ', ' button=' + IntToStr(msg.Params.mouse.Buttons)); -// ButtonNames[msg.Params.mouse.Buttons]); -end; - -procedure TMainForm.MsgMouseUp(var msg: TfpgMessageRec); -begin - WriteLn(MouseState(msg.Params.mouse.shiftstate, Point(msg.Params.mouse.x, msg.Params.mouse.y)), - 'Mouse button released: ', ' button=' + IntToStr(msg.Params.mouse.Buttons)); -// ButtonNames[msg.Params.mouse.Buttons]); -end; - -procedure TMainForm.MsgMouseMove(var msg: TfpgMessageRec); -begin - inc(FMoveEventCount); - // only report mouse moves every 10 messages - just to limit the output a bit - if (FMoveEventCount mod 10) = 0 then - begin - WriteLn(MouseState(msg.Params.mouse.shiftstate, Point(msg.Params.mouse.x, msg.Params.mouse.y)), 'Mouse moved'); - end; -end; - -procedure TMainForm.MsgDoubleClick(var msg: TfpgMessageRec); -begin - Writeln('Mouse doubleclick'); -end; - -procedure TMainForm.MsgMouseEnter(var msg: TfpgMessageRec); -begin - WriteLn(MouseState(msg.Params.mouse.shiftstate, Point(msg.Params.mouse.x, msg.Params.mouse.y)), 'Mouse entered window'); -end; - -procedure TMainForm.MsgMouseExit(var msg: TfpgMessageRec); -begin - WriteLn('Mouse left window'); -end; - -procedure TMainForm.MsgScroll(var msg: TfpgMessageRec); -var - delta: smallint; -begin - delta := msg.Params.mouse.delta; - Writeln('Mouse scroll delta=' + IntToStr(delta) + ' button=' + IntToStr(msg.Params.mouse.Buttons)); -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited Create(aowner); - FMoveEventCount := 0; - FWidth := 400; - FHeight := 100; - WindowAttributes := [waSizeable, waScreenCenterPos]; -end; - -procedure TMainForm.Show; -begin - AllocateWindowHandle; - // We can't set a title if we don't have a window handle. So we do that here - // and not in the constructor. - SetWindowTitle('fpGFX event test'); -end; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. - diff --git a/prototypes/fpgui2/examples/core/helloworld/helloworld.lpi b/prototypes/fpgui2/examples/core/helloworld/helloworld.lpi deleted file mode 100644 index 3a9cb741..00000000 --- a/prototypes/fpgui2/examples/core/helloworld/helloworld.lpi +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value="./"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="helloworld.pas"/> - <IsPartOfProject Value="True"/> - <UnitName Value="HelloWorld"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/core/helloworld/helloworld.pas b/prototypes/fpgui2/examples/core/helloworld/helloworld.pas deleted file mode 100644 index 52e56158..00000000 --- a/prototypes/fpgui2/examples/core/helloworld/helloworld.pas +++ /dev/null @@ -1,116 +0,0 @@ -{ - fpGUI - Free Pascal GUI Library - - HelloWorld - GFX Hello World application - - Copyright (C) 2007 See the file AUTHORS.txt, included in this - distribution, for details of the copyright. - - 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 HelloWorld; - -{$mode objfpc}{$H+} - -uses - Classes - ,fpGFX - ,GFXBase - ; - -const - HelloWorldString: String = 'Hello, world!'; - - -type - - TMainWindow = class(TfpgWindow) - private - procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT; - procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE; - procedure MsgResize(var msg: TfpgMessageRec); message FPGM_RESIZE; - public - constructor Create(AOwner: TComponent); override; - procedure Show; - end; - - -constructor TMainWindow.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FWidth := 350; - FHeight := 200; - WindowAttributes := [waSizeable, waScreenCenterPos]; -end; - -procedure TMainWindow.Show; -begin - AllocateWindowHandle; - // We can't set a title if we don't have a window handle. So we do that here - // and not in the constructor. - SetWindowTitle('fpGFX Hello World'); -end; - -procedure TMainWindow.MsgPaint(var msg: TfpgMessageRec); -var - Color: TfpgColor; - r: TfpgRect; - i: Integer; -begin - Canvas.BeginDraw; // begin double buffering - - Color := 0; - r.Left := 0; - r.Width := FWidth; - for i := 0 to FHeight-1 do - begin - Color := $ff - (i * $ff) div FHeight; // shades of Blue - Canvas.SetColor(Color); - r.Top := i; - r.Height := i + 1; - Canvas.DrawRectangle(r); - end; - - Canvas.Font := fpgGetFont('Arial-30'); - - Canvas.SetTextColor(clBlack); - Canvas.DrawString((Width - Canvas.Font.TextWidth(HelloWorldString)) div 2 + 1, - (Height - Canvas.Font.Height) div 2 + 1, HelloWorldString); - - Canvas.SetTextColor(clWhite); - Canvas.DrawString((Width - Canvas.Font.TextWidth(HelloWorldString)) div 2 - 1, - (Height - Canvas.Font.Height) div 2 - 1, HelloWorldString); - - Canvas.EndDraw(0, 0, FWidth, FHeight); -end; - -procedure TMainWindow.MsgClose(var msg: TfpgMessageRec); -begin - ReleaseWindowHandle; - Halt(0); -end; - -procedure TMainWindow.MsgResize(var msg: TfpgMessageRec); -begin - FWidth := msg.Params.rect.Width; - FHeight := msg.Params.rect.Height; -end; - - - -var - MainWindow: TMainWindow; -begin - fpgApplication.Initialize; - MainWindow := TMainWindow.Create(nil); - MainWindow.Show; - fpgApplication.Run; - MainWindow.Free; -end. - diff --git a/prototypes/fpgui2/examples/core/imgtest/bitmaptest.dpr b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.dpr deleted file mode 100644 index 8ab86361..00000000 --- a/prototypes/fpgui2/examples/core/imgtest/bitmaptest.dpr +++ /dev/null @@ -1,86 +0,0 @@ -program bitmaptest; - -{$mode objfpc}{$H+} - -uses - Classes, - SysUtils, - gfxbase, - fpgfx, - gfx_imgfmt_bmp; - -type - - TMainForm = class(TfpgWindow) - private - img: TfpgImage; - procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT; - procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Show; - end; - - -{ TMainForm } - -procedure TMainForm.MsgPaint(var msg: TfpgMessageRec); -begin - Canvas.BeginDraw; - Canvas.DrawImage(0, 0, img); - Canvas.EndDraw; -end; - -procedure TMainForm.MsgClose(var msg: TfpgMessageRec); -begin - ReleaseWindowHandle; - Halt(0); -end; - -constructor TMainForm.Create(AOwner: TComponent); -var - i, j: integer; -begin - inherited Create(AOwner); - FWidth := 256; - FHeight := 256; - WindowAttributes := [waScreenCenterPos]; - - img := TfpgImage.Create; - img.AllocateImage(32, 256, 256); - img.UpdateImage; - // populate the bitmap with pretty colors :-) - for j := 0 to 255 do - for i := 0 to 255 do - PLongWord(img.ImageData)[j * 256 + i] := (i shl 16) or (j shl 8); -end; - -destructor TMainForm.Destroy; -begin - img.Free; - inherited Destroy; -end; - -procedure TMainForm.Show; -begin - AllocateWindowHandle; - // We can only set the title once we have a window handle. - SetWindowTitle('fpGUI Bitmap Test'); -end; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. - diff --git a/prototypes/fpgui2/examples/core/imgtest/bitmaptest.lpi b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.lpi deleted file mode 100644 index c8bf98e0..00000000 --- a/prototypes/fpgui2/examples/core/imgtest/bitmaptest.lpi +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="\"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value=".\"/> - <TargetFileExt Value=""/> - <Title Value="bitmaptest"/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <DestinationDirectory Value="$(TestDir)\publishedproject\"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="bitmaptest.dpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="bitmaptest"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <PathDelim Value="\"/> - <SearchPaths> - <IncludeFiles Value="..\source\"/> - <OtherUnitFiles Value="..\source\;..\source\x11\;..\gui\"/> - </SearchPaths> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits -"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr b/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr deleted file mode 100644 index 7099b761..00000000 --- a/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr +++ /dev/null @@ -1,107 +0,0 @@ -program aligntest; - -{$mode objfpc}{$H+} - -uses - Classes, SysUtils, - fpgfx, gfxbase, gfx_widget, gui_form, gui_label; - -type - TMainForm = class(TfpgForm) - private - lblTop: array[1..3] of TfpgLabel; - lblBottom: array[1..3] of TfpgLabel; - lblLeft: array[1..3] of TfpgLabel; - lblRight: array[1..3] of TfpgLabel; - lblClient: TfpgLabel; - lblNone: TfpgLabel; - AlignRect: TfpgRect; - public - procedure AfterCreate; override; - end; - - -{ TMainForm } - -procedure TMainForm.AfterCreate; -var - x: integer; - y: integer; - n: integer; - ColorArray: array[1..3] of TfpgColor; -begin - x := 10; - y := 10; - ColorArray[1] := clDodgerBlue; - ColorArray[2] := clDeepSkyBlue; - ColorArray[3] := clSkyBlue; - - for n := low(lblTop) to high(lblTop) do - begin - lblTop[n] := CreateLabel(self, x, y, 'alTop '+IntToStr(n)); - lblTop[n].BackgroundColor := ColorArray[n]; - lblTop[n].Align := alTop; - lblTop[n].Width := 100; - inc(y,20); - end; - - y := 280; - for n:=low(lblBottom) to high(lblBottom) do - begin - lblBottom[n] := CreateLabel(self, x, y, 'alBottom '+IntToStr(n)); - lblBottom[n].BackgroundColor := ColorArray[n]; - lblBottom[n].Align := alBottom; - dec(y,20); - end; - - y := 100; - x := 10; - for n:=low(lblLeft) to high(lblLeft) do - begin - lblLeft[n] := CreateLabel(self, x, y, 'L'+IntToStr(n)); - lblLeft[n].BackgroundColor := ColorArray[n]; - lblLeft[n].Align := alLeft; - inc(x,30); - end; - - x := 200; - for n:=low(lblRight) to high(lblRight) do - begin - lblRight[n] := CreateLabel(self, x, y, 'R'+IntToStr(n)); - lblRight[n].BackgroundColor := ColorArray[n]; - lblRight[n].Align := alRight; - dec(x,30); - end; - - lblClient := CreateLabel(self, 150, 150, 'alClient'); - lblClient.BackgroundColor := clWhite; - lblClient.Align := alClient; - - lblNone := CreateLabel(self, 15, 120, 'Resize the form to see Align in action'); - lblNone.Color := clWhite; - lblNone.BackgroundColor := clBlack; -end; - - -procedure MainProc; -var - frm : TMainForm; -begin - fpgApplication.Initialize; - - frm := TMainForm.Create(nil); - frm.WindowPosition := wpScreenCenter; - frm.Width := 300; - frm.Height := 300; - frm.MinWidth := 250; - frm.MinHeight := 150; - frm.WindowTitle := 'fpGUI Align Example'; - frm.Show; - - fpgApplication.Run; -end; - -begin - MainProc; -end. - diff --git a/prototypes/fpgui2/examples/gui/alignment/aligntest.lpi b/prototypes/fpgui2/examples/gui/alignment/aligntest.lpi deleted file mode 100644 index 5d943df0..00000000 --- a/prototypes/fpgui2/examples/gui/alignment/aligntest.lpi +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value="./"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="aligntest.dpr"/> - <IsPartOfProject Value="True"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <SearchPaths> - <IncludeFiles Value="../src/"/> - <OtherUnitFiles Value="../src/"/> - </SearchPaths> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpi b/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpi deleted file mode 100644 index 2d2e9d9d..00000000 --- a/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpi +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion 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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="modalforms.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="modalforms"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpr b/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpr deleted file mode 100644 index c3faeaf3..00000000 --- a/prototypes/fpgui2/examples/gui/modalforms/modalforms.lpr +++ /dev/null @@ -1,165 +0,0 @@ -{ - Demo of modal forms in action. - - NOTE: Model form are not 100% implemented yet! -} -program modalforms; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, - fpgfx, - gui_form, - gui_dialogs, - gui_button, - gui_label; - -type - // forward declaration - TForm1 = class; - TForm2 = class; - - TMainForm = class(TfpgForm) - private - btnClose: TfpgButton; - btnOpenForm1: TfpgButton; - procedure btnCloseClick(Sender: TObject); - procedure btnOpenForm1Click(Sender: TObject); - public - constructor Create(AOwner: TComponent); override; - end; - - - TForm1 = class(TfpgForm) - private - Label1: TfpgLabel; - btnClose: TfpgButton; - btnOpenForm2: TfpgButton; - procedure btnCloseClick(Sender: TObject); - procedure btnOpenForm2Click(Sender: TObject); - public - constructor Create(AOwner: TComponent); override; - end; - - - TForm2 = class(TfpgForm) - private - Label1: TfpgLabel; - btnClose: TfpgButton; - procedure btnCloseClick(Sender: TObject); - public - constructor Create(AOwner: TComponent); override; - end; - - -{ TForm2 } - -procedure TForm2.btnCloseClick(Sender: TObject); -begin - Close; -end; - -constructor TForm2.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - WindowTitle := 'Form2'; - Sizeable := False; - SetPosition(200, 200, 200, 200); - - Label1 := CreateLabel(self, 10, 10, 'This is Form2'); - - btnClose := CreateButton(self, 110, 170, 80, 'Quit', @btnCloseClick); - btnClose.ImageName := 'stdimg.Quit'; - btnClose.ShowImage := True; -end; - -{ TForm1 } - -procedure TForm1.btnCloseClick(Sender: TObject); -begin - Close; -end; - -procedure TForm1.btnOpenForm2Click(Sender: TObject); -var - frm: TForm2; -begin - try - frm := TForm2.Create(nil); - frm.ShowModal; - writeln('Form2: This should only appear after the form closes.'); - finally - frm.Free; - end; -end; - -constructor TForm1.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - WindowTitle := 'Form1'; - Sizeable := False; - SetPosition(150, 150, 200, 200); - - Label1 := CreateLabel(self, 10, 10, 'This is Form1'); - - btnClose := CreateButton(self, 110, 170, 80, 'Quit', @btnCloseClick); - btnClose.ImageName := 'stdimg.Quit'; - btnClose.ShowImage := True; - - btnOpenForm2 := CreateButton(self, 70, 100, 80, 'Open Form2', @btnOpenForm2Click); -end; - - -{ TMainForm } - -procedure TMainForm.btnCloseClick(Sender: TObject); -begin - Close; -end; - -procedure TMainForm.btnOpenForm1Click(Sender: TObject); -var - frm: TForm1; -begin - try - frm := TForm1.Create(nil); - frm.ShowModal; - writeln('Form1: This should only appear after the form closes.'); - finally - frm.Free; - end; -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - WindowTitle := 'Modal Form Demo'; - Sizeable := False; - SetPosition(100, 100, 400, 200); - - btnClose := CreateButton(self, 310, 170, 80, 'Quit', @btnCloseClick); - btnClose.ImageName := 'stdimg.Quit'; - btnClose.ShowImage := True; - - btnOpenForm1 := CreateButton(self, 100, 100, 80, 'Open Form1', @btnOpenForm1Click); -end; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. - diff --git a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi deleted file mode 100644 index f43952b3..00000000 --- a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value="./"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="stdimglist.lpr"/> - <IsPartOfProject Value="True"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr deleted file mode 100644 index 06212cfc..00000000 --- a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr +++ /dev/null @@ -1,93 +0,0 @@ -program stdimglist; - -{$mode objfpc}{$H+} - -uses - Classes, SysUtils, - fpgfx, gfxbase, gui_form, gfx_imgfmt_bmp, gui_button; - -type - - TMainForm = class(TfpgForm) - private - btnClose: TfpgButton; - procedure btnCloseClick(Sender: TObject); - protected - procedure HandlePaint; override; - public - constructor Create(aowner: TComponent); override; - procedure AfterCreate; override; - end; - -{ TMainForm } - -procedure TMainForm.AfterCreate; -begin - SetPosition(100,100,700,500); - WindowTitle := 'fpGUI Standard Image Listing'; -end; - -procedure TMainForm.btnCloseClick(Sender: TObject); -begin - Close; -end; - -procedure TMainForm.HandlePaint; -var - n: integer; - x: TfpgCoord; - y: TfpgCoord; - sl: TStringList; - img: TfpgImage; -begin - Canvas.BeginDraw; // begin double buffering - inherited HandlePaint; - - sl := TStringList.Create; - x := 8; - y := 8; - fpgImages.ListImages(sl); - - for n := 0 to sl.Count-1 do - begin - Canvas.DrawString(x, y, sl[n]+':'); - - img := TfpgImage(sl.Objects[n]); - if img <> nil then - Canvas.DrawImage(x+150, y, img); - - inc(y, img.Height+8); - if y > Height-32 then // largest images are 32 in height - begin - inc(x, 200); - y := 8; - end; - end; - - Canvas.EndDraw; - sl.Free; -end; - -constructor TMainForm.Create(aowner: TComponent); -begin - inherited Create(aowner); - // Place button in bottom right corner. - btnClose := CreateButton(self, Width-90, Height-35, 75, 'Quit', @btnCloseClick); - btnClose.ImageName := 'stdimg.quit'; -// btnClose.Focusable := False; - btnClose.Anchors := [anRight, anBottom]; -end; - -procedure MainProc; -var - frm : TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. diff --git a/prototypes/fpgui2/examples/gui/timertest/timertest.lpi b/prototypes/fpgui2/examples/gui/timertest/timertest.lpi deleted file mode 100644 index 0dfae648..00000000 --- a/prototypes/fpgui2/examples/gui/timertest/timertest.lpi +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="\"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value=".\"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="1"> - <Item1> - <PackageName Value="fpGFX2"/> - </Item1> - </RequiredPackages> - <Units Count="1"> - <Unit0> - <Filename Value="timertest.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="timertest"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <PathDelim Value="\"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/timertest/timertest.lpr b/prototypes/fpgui2/examples/gui/timertest/timertest.lpr deleted file mode 100644 index 7c4209df..00000000 --- a/prototypes/fpgui2/examples/gui/timertest/timertest.lpr +++ /dev/null @@ -1,125 +0,0 @@ -program timertest; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, SysUtils, fpgfx, gfxbase, gui_form, gui_button, gui_label; - -type - TMainForm = class(TfpgForm) - private - btnClose: TfpgButton; - btnStopStart: TfpgButton; - timer1: TfpgTimer; - timer2: TfpgTimer; - timer3: TfpgTimer; - lblTimer1: TfpgLabel; - lblTimer2: TfpgLabel; - lblTimer3: TfpgLabel; - cnt1: integer; - cnt2: integer; - procedure MyTimer1(Sender: TObject); - procedure MyTimer2(Sender: TObject); - procedure MyTimer3(Sender: TObject); - procedure btnCloseClick(Sender: TObject); - procedure btnStopStartClick(Sender: TObject); - public - constructor Create(AOwner: TComponent); override; - end; - - -{ TMainForm } - -procedure TMainForm.MyTimer1(Sender: TObject); -begin - lblTimer1.Text := FormatDateTime('hh:nn:ss.zzz', now); -end; - -procedure TMainForm.MyTimer2(Sender: TObject); -begin - Inc(cnt1); - lblTimer2.Text := IntToStr(cnt1); -end; - -procedure TMainForm.MyTimer3(Sender: TObject); -begin - Inc(cnt2); - lblTimer3.Text := IntToStr(cnt2); -end; - -procedure TMainForm.btnCloseClick(Sender: TObject); -begin - Close; -end; - -procedure TMainForm.btnStopStartClick(Sender: TObject); -begin - if btnStopStart.Text = 'Stop' then - btnStopStart.Text := 'Start' - else - btnStopStart.Text := 'Stop'; - - timer1.Enabled := not timer1.Enabled; -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - WindowTitle := 'fpGUI Timer test'; - WindowPosition := wpScreenCenter; - Width := 400; - Height := 250; - - cnt1 := 0; - cnt2 := 0; - - btnClose := CreateButton(self, 320, 220, 75, 'Close', @btnCloseClick); - btnStopStart := CreateButton(self, 200, 50, 75, 'Stop', @btnStopStartClick); - - lblTimer1 := CreateLabel(self, 50, 50, '---'); - lblTimer1.FontDesc := 'Arial-14:bold'; - lblTimer1.Height := lblTimer1.Font.Height; - lblTimer1.Width := 150; - - lblTimer2 := CreateLabel(self, 50, 80, '---'); - lblTimer2.FontDesc := 'Arial-14:bold'; - lblTimer2.Height := lblTimer2.Font.Height; - lblTimer2.Width := 150; - - lblTimer3 := CreateLabel(self, 50, 110, '---'); - lblTimer3.FontDesc := 'Arial-14:bold'; - lblTimer3.Height := lblTimer3.Font.Height; - lblTimer3.Width := 150; - - timer1 := TfpgTimer.Create(50); - timer1.OnTimer := @MyTimer1; - timer1.Enabled := True; - - timer2 := TfpgTimer.Create(200); - timer2.OnTimer := @MyTimer2; - timer2.Enabled := True; - - timer3 := TfpgTimer.Create(1000); - timer3.OnTimer := @MyTimer3; - timer3.Enabled := True; -end; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - - -begin - MainProc; -end. - |