diff options
Diffstat (limited to 'examples')
7 files changed, 256 insertions, 0 deletions
diff --git a/examples/apps/ide/src/templates/default/program.pas b/examples/apps/ide/src/templates/default/program.pas new file mode 100644 index 00000000..d901e3ac --- /dev/null +++ b/examples/apps/ide/src/templates/default/program.pas @@ -0,0 +1,11 @@ +program ${PROGRAMNAME}; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils; + +begin + WriteLn('Hello'); +end. diff --git a/examples/apps/ide/src/templates/fpgui/mainform.pas b/examples/apps/ide/src/templates/fpgui/mainform.pas new file mode 100644 index 00000000..6b9500ac --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/mainform.pas @@ -0,0 +1,45 @@ +unit frm_main; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form; + +type + + TMainForm = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: MainForm} + {@VFD_HEAD_END: MainForm} + public + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + +implementation + +{@VFD_NEWFORM_IMPL} + +procedure TMainForm.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: MainForm} + Name := 'MainForm'; + SetPosition(374, 228, 490, 258); + WindowTitle := 'MainForm'; + Hint := ''; + WindowPosition := wpOneThirdDown; + + {@VFD_BODY_END: MainForm} + {%endregion} +end; + + +end. diff --git a/examples/apps/ide/src/templates/fpgui/program.pas b/examples/apps/ide/src/templates/fpgui/program.pas new file mode 100644 index 00000000..7f3f9732 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/program.pas @@ -0,0 +1,31 @@ +program ${PROGRAMNAME}; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpg_main, + frm_main; + + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + try + frm.Show; + fpgApplication.Run; + finally + frm.Free; + end; +end; + +begin + MainProc; +end. + diff --git a/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas new file mode 100644 index 00000000..0b17ee85 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas @@ -0,0 +1,55 @@ +program ${PROJECTNAME}; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, fpg_main, fpg_form; + +type + + TMainForm = class(TfpgForm) + public + {@VFD_HEAD_BEGIN: MainForm} + {@VFD_HEAD_END: MainForm} + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + + + +{@VFD_NEWFORM_IMPL} + +procedure TMainForm.AfterCreate; +begin + {@VFD_BODY_BEGIN: MainForm} + Name := 'MainForm'; + SetPosition(316, 186, 300, 250); + WindowTitle := 'MainForm'; + + {@VFD_BODY_END: MainForm} +end; + + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + try + frm.Show; + fpgApplication.Run; + finally + frm.Free; + end; +end; + +begin + MainProc; +end. + + diff --git a/examples/apps/ide/src/templates/fpgui/simpleform.pas b/examples/apps/ide/src/templates/fpgui/simpleform.pas new file mode 100644 index 00000000..d804f4a3 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/simpleform.pas @@ -0,0 +1,45 @@ +unit ${UNITNAME}; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form; + +type + + T${FORMNAME} = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: ${FORMNAME}} + {@VFD_HEAD_END: ${FORMNAME}} + public + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + +implementation + +{@VFD_NEWFORM_IMPL} + +procedure T${FORMNAME}.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: ${FORMNAME}} + Name := '${FORMNAME}'; + SetPosition(374, 228, 490, 258); + WindowTitle := 'New Form'; + Hint := ''; + WindowPosition := wpOneThirdDown; + + {@VFD_BODY_END: ${FORMNAME}} + {%endregion} +end; + + +end. diff --git a/examples/apps/ide/src/templates/fptest/program.pas b/examples/apps/ide/src/templates/fptest/program.pas new file mode 100644 index 00000000..8c4729bc --- /dev/null +++ b/examples/apps/ide/src/templates/fptest/program.pas @@ -0,0 +1,30 @@ +program ${%PROGRAMNAME%}; + +{$Mode objfpc}{$H+} + + +{$Define TextRunner} +{.$Define GUIRunner} + + +{$ifdef GuiRunner} + {$apptype gui} +{$endif} + + +uses + {$IFDEF TextRunner} + TextTestRunner, + {$ENDIF} + {$IFDEF GUIRunner} + GUITestRunner, + {$ENDIF} + Classes, + SampleTests; + +begin + // Register all tests + SampleTests.RegisterTests; + + RunRegisteredTests; +end. diff --git a/examples/apps/ide/src/templates/fptest/testunit.pas b/examples/apps/ide/src/templates/fptest/testunit.pas new file mode 100644 index 00000000..83d2a624 --- /dev/null +++ b/examples/apps/ide/src/templates/fptest/testunit.pas @@ -0,0 +1,39 @@ +unit ${UNITNAME}; + +{$mode objfpc}{$H+} + +interface + +uses + TestFramework; + +type + TMyTestCase = class(TTestCase) + published + procedure FirstTest; + end; + + +procedure RegisterTests; + + +implementation + +//uses +// SomeUnitToTest; + + +procedure RegisterTests; +begin + TestFramework.RegisterTest(TMyTestCase.Suite); +end; + +{ TMyTestCase } + +procedure TMyTestCase.FirstTest; +begin + Check(2, 1+1, 'Failed on 1'); +end; + + +end. |