summaryrefslogtreecommitdiff
path: root/examples/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-04 07:40:04 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-04 07:40:04 +0000
commitfbeed45e8a3facb1d556753d2f9f905380d6b5ab (patch)
tree7ea8739df6e804c59c883eff4088bfbbfe02db37 /examples/gui
parentf63b41e29d784264924e96c5b44b36bb039cd554 (diff)
downloadfpGUI-fbeed45e8a3facb1d556753d2f9f905380d6b5ab.tar.xz
* Improved the Wu Line example. It now draws three different objects.
Diffstat (limited to 'examples/gui')
-rw-r--r--examples/gui/wulinetest/wuline_test.lpi1
-rw-r--r--examples/gui/wulinetest/wuline_test.lpr130
2 files changed, 105 insertions, 26 deletions
diff --git a/examples/gui/wulinetest/wuline_test.lpi b/examples/gui/wulinetest/wuline_test.lpi
index 4929958e..e0f7918c 100644
--- a/examples/gui/wulinetest/wuline_test.lpi
+++ b/examples/gui/wulinetest/wuline_test.lpi
@@ -17,7 +17,6 @@
</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>
diff --git a/examples/gui/wulinetest/wuline_test.lpr b/examples/gui/wulinetest/wuline_test.lpr
index e1a04f7d..56241b93 100644
--- a/examples/gui/wulinetest/wuline_test.lpr
+++ b/examples/gui/wulinetest/wuline_test.lpr
@@ -7,7 +7,7 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, gfxbase, fpgfx, gui_form, gui_button, math,
- gfx_imgfmt_bmp, gfx_wuline;
+ gfx_imgfmt_bmp, gfx_wuline, gui_bevel, gui_radiobutton;
type
@@ -15,32 +15,53 @@ type
TMainForm = class(TfpgForm)
private
- btnGo: TfpgButton;
- procedure btnGoClicked(Sender: TObject);
- procedure DrawSpokes(phase: double);
- procedure DrawSpiral;
+ {@VFD_HEAD_BEGIN: MainForm}
+ btnQuit: TfpgButton;
+ pnlName1: TfpgBevel;
+ rbSpokes: TfpgRadioButton;
+ rbLines: TfpgRadioButton;
+ rbSpiral: TfpgRadioButton;
+ {@VFD_HEAD_END: MainForm}
+ procedure btnQuitClicked(Sender: TObject);
+ procedure DrawSpokes(phase: double);
+ procedure DrawSpiral;
+ procedure DrawLines;
+ procedure RadioButtonChanged(Sender: TObject);
+ protected
+ procedure HandlePaint; override;
public
- constructor Create(AOwner: TComponent); override;
+ procedure AfterCreate; override;
end;
+{@VFD_NEWFORM_DECL}
+
{ TMainForm }
-procedure TMainForm.btnGoClicked(Sender: TObject);
+procedure TMainForm.RadioButtonChanged(Sender: TObject);
begin
- Canvas.BeginDraw;
-
-// DrawWuCircle(Canvas, 200, 200, 50, clBlue);
-// DrawSpiral;
+ RePaint;
+end;
- DrawSpokes(0);
+procedure TMainForm.HandlePaint;
+begin
+ Canvas.BeginDraw;
+ inherited HandlePaint;
-// WuLine(Canvas, Point(10, 35), Point(280, 180), clBlack);
-// Canvas.SetColor(clBlack);
-// Canvas.DrawLine(10, 45, 280, 190);
+ if rbSpokes.Checked then
+ DrawSpokes(0)
+ else if rbLines.Checked then
+ DrawLines
+ else if rbSpiral.Checked then
+ DrawSpiral;
Canvas.EndDraw;
end;
+procedure TMainForm.btnQuitClicked(Sender: TObject);
+begin
+ Close;
+end;
+
// Generates spokes. Animates them using phase.
procedure TMainForm.DrawSpokes(phase: double);
var
@@ -88,24 +109,83 @@ begin
Canvas.EndDraw;
end;
-constructor TMainForm.Create(AOwner: TComponent);
+procedure TMainForm.DrawLines;
+begin
+ WuLine(Canvas, Point(10, 35), Point(280, 180), clBlack);
+ Canvas.SetColor(clBlack);
+ Canvas.DrawLine(10, 45, 280, 190);
+end;
+
+procedure TMainForm.AfterCreate;
begin
- inherited Create(AOwner);
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(278, 186, 600, 400);
WindowTitle := 'fpGUI Wu Anti-Aliased Line test';
WindowPosition := wpScreenCenter;
- Width := 600;
- Height := 400;
-
- btnGo := TfpgButton.Create(self);
- with btnGo do
+ Sizeable := False;
+
+ btnQuit := TfpgButton.Create(self);
+ with btnQuit do
begin
- SetPosition(4, 4, 90, 24);
- Text := 'GO';
- OnClick := @btnGoClicked;
+ Name := 'btnQuit';
+ SetPosition(500, 368, 90, 24);
+ Anchors := [anRight,anBottom];
+ Text := 'Quit';
+ FontDesc := '#Label1';
+ ImageName := '';
+ OnClick := @btnQuitClicked;
end;
+
+ pnlName1 := TfpgBevel.Create(self);
+ with pnlName1 do
+ begin
+ Name := 'pnlName1';
+ SetPosition(436, 8, 156, 76);
+ end;
+
+ rbSpokes := TfpgRadioButton.Create(pnlName1);
+ with rbSpokes do
+ begin
+ Name := 'rbSpokes';
+ SetPosition(12, 8, 120, 19);
+ Text := 'Spokes';
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ Checked := True;
+ OnChange := @RadioButtonChanged;
+ end;
+
+ rbLines := TfpgRadioButton.Create(pnlName1);
+ with rbLines do
+ begin
+ Name := 'rbLines';
+ SetPosition(12, 28, 120, 19);
+ Text := 'Lines';
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ OnChange := @RadioButtonChanged;
+ end;
+
+ rbSpiral := TfpgRadioButton.Create(pnlName1);
+ with rbSpiral do
+ begin
+ Name := 'rbSpiral';
+ SetPosition(12, 48, 120, 19);
+ Text := 'Spiral';
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ OnChange := @RadioButtonChanged;
+ end;
+
+ {@VFD_BODY_END: MainForm}
end;
+{@VFD_NEWFORM_IMPL}
+
+
+
procedure MainProc;
var
frm: TMainForm;