diff options
author | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-10 09:20:34 +0000 |
---|---|---|
committer | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-10 09:20:34 +0000 |
commit | 83aba3ca53aee8a12c665e09531ecf187c1df94a (patch) | |
tree | 85112f8289ed13946ec1c62247c2176aee34bb2c | |
parent | 7093ec0d7d60e03e81c7a9fa8bdadca639e1a112 (diff) | |
download | fpGUI-83aba3ca53aee8a12c665e09531ecf187c1df94a.tar.xz |
improved prototype to at least do basic drawing on the button and widget
-rw-r--r-- | prototypes/newmultihandle/examples/helloworld.lpi | 102 | ||||
-rw-r--r-- | prototypes/newmultihandle/examples/helloworld.lpr | 12 | ||||
-rw-r--r-- | prototypes/newmultihandle/gui_button.inc | 17 | ||||
-rw-r--r-- | prototypes/newmultihandle/gui_widget.inc | 16 |
4 files changed, 71 insertions, 76 deletions
diff --git a/prototypes/newmultihandle/examples/helloworld.lpi b/prototypes/newmultihandle/examples/helloworld.lpi index 400175bb..dd138dfa 100644 --- a/prototypes/newmultihandle/examples/helloworld.lpi +++ b/prototypes/newmultihandle/examples/helloworld.lpi @@ -7,7 +7,7 @@ <MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
- <ActiveEditorIndexAtStart Value="0"/>
+ <ActiveEditorIndexAtStart Value="4"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@@ -34,13 +34,13 @@ <PackageName Value="fpGFXPackage"/>
</Item2>
</RequiredPackages>
- <Units Count="6">
+ <Units Count="7">
<Unit0>
<Filename Value="helloworld.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="helloworld"/>
- <CursorPos X="3" Y="56"/>
- <TopLine Value="38"/>
+ <CursorPos X="18" Y="12"/>
+ <TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
@@ -50,7 +50,7 @@ <UnitName Value="fpgui"/>
<CursorPos X="31" Y="8"/>
<TopLine Value="1"/>
- <EditorIndex Value="1"/>
+ <EditorIndex Value="2"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit1>
@@ -64,100 +64,60 @@ <Unit3>
<Filename Value="..\gui_widget.inc"/>
<IsPartOfProject Value="True"/>
- <CursorPos X="47" Y="12"/>
+ <CursorPos X="17" Y="3"/>
<TopLine Value="1"/>
- <EditorIndex Value="3"/>
+ <EditorIndex Value="4"/>
<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"/>
+ <CursorPos X="27" Y="37"/>
+ <TopLine Value="37"/>
+ <EditorIndex Value="5"/>
<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"/>
+ <CursorPos X="12" Y="122"/>
+ <TopLine Value="109"/>
+ <EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
+ <Unit6>
+ <Filename Value="..\..\..\..\..\lazarus215\fpc\2.1.5\source\rtl\objpas\classes\classesh.inc"/>
+ <CursorPos X="4" Y="25"/>
+ <TopLine Value="13"/>
+ <EditorIndex Value="1"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit6>
</Units>
- <JumpHistory Count="17" HistoryIndex="16">
+ <JumpHistory Count="5" HistoryIndex="4">
<Position1>
- <Filename Value="..\gui_widget.inc"/>
- <Caret Line="5" Column="58" TopLine="1"/>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="44" Column="44" TopLine="27"/>
</Position1>
<Position2>
- <Filename Value="..\gui_widget.inc"/>
- <Caret Line="6" Column="27" TopLine="1"/>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="45" Column="27" TopLine="33"/>
</Position2>
<Position3>
- <Filename Value="..\gui_widget.inc"/>
- <Caret Line="4" Column="14" TopLine="1"/>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="25" Column="13" TopLine="21"/>
</Position3>
<Position4>
- <Filename Value="..\gui_widget.inc"/>
- <Caret Line="1" Column="29" TopLine="1"/>
+ <Filename Value="helloworld.lpr"/>
+ <Caret Line="26" Column="13" TopLine="7"/>
</Position4>
<Position5>
<Filename Value="..\gui_widget.inc"/>
- <Caret Line="12" Column="17" TopLine="1"/>
+ <Caret Line="27" Column="23" TopLine="12"/>
</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>
diff --git a/prototypes/newmultihandle/examples/helloworld.lpr b/prototypes/newmultihandle/examples/helloworld.lpr index af6c89b9..fcb9541b 100644 --- a/prototypes/newmultihandle/examples/helloworld.lpr +++ b/prototypes/newmultihandle/examples/helloworld.lpr @@ -3,6 +3,7 @@ program HelloWorld; {$mode objfpc}{$h+}
uses
+ Classes,
fpgui,
fpGFX,
gfxBase;
@@ -22,6 +23,7 @@ type procedure TMainForm.AfterConstruction;
var
lSize: TSize;
+ lPoint: TPoint;
begin
inherited AfterConstruction;
Name := 'MainForm';
@@ -39,10 +41,16 @@ begin { btnHello.CanExpandWidth := True;
btnHello.CanExpandHeight := True;
BoxLayout.InsertChild(btnHello); }
+ lSize.cx := 50;
+ lSize.cy := 100;
+ btnHello.SetMinMaxClientSize(lSize, lSize);
+ lPoint.x := 25;
+ lPoint.y := 25;
+ btnHello.SetPosition(lPoint);
{ set a min and max size }
- lSize.cx := 150;
- lSize.cy := 100;
+ lSize.cx := 200;
+ lSize.cy := 200;
SetMinMaxClientSize(lSize, lSize);
end;
diff --git a/prototypes/newmultihandle/gui_button.inc b/prototypes/newmultihandle/gui_button.inc index 672b9868..7208abe0 100644 --- a/prototypes/newmultihandle/gui_button.inc +++ b/prototypes/newmultihandle/gui_button.inc @@ -2,9 +2,11 @@ type
TFButton = class(TFWidget)
+ public
+ Text: string;
constructor Create(AParent: TFCustomWindow); override;
constructor Create(ACaption: string; AParent: TFCustomWindow);
- procedure Paint(Sender: TObject; const Rect: TRect);
+ procedure Paint(Sender: TObject; const Rect: TRect); override;
procedure MouseReleased(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
end;
@@ -25,6 +27,8 @@ end; constructor TFButton.Create(ACaption: string; AParent: TFCustomWindow);
begin
Create(AParent);
+
+ Text := ACaption;
end;
procedure TFButton.MouseReleased(Sender: TObject; AButton: TMouseButton;
@@ -38,12 +42,19 @@ var r: TRect;
tw: integer;
begin
- Canvas.SetColor(colBlue);
+ Canvas.SetColor(colGray);
r.Left := 0;
r.Top := 0;
r.Right := Width;
r.Bottom := Height;
- Canvas.FillRect(r);
+ Canvas.DrawRect(r);
+
+ Canvas.SetColor(colWhite);
+ r.Left := 1;
+ r.Top := 1;
+ r.Right := Width + 1;
+ r.Bottom := Height + 1;
+ Canvas.DrawRect(r);
end;
{$endif}
diff --git a/prototypes/newmultihandle/gui_widget.inc b/prototypes/newmultihandle/gui_widget.inc index 2521541d..39a5a9e5 100644 --- a/prototypes/newmultihandle/gui_widget.inc +++ b/prototypes/newmultihandle/gui_widget.inc @@ -2,7 +2,9 @@ type
TFWidget = class(TFWindow)
+ public
constructor Create(AParent: TFCustomWindow); virtual;
+ procedure Paint(Sender: TObject; const Rect: TRect); virtual;
end;
{$else}
@@ -12,9 +14,23 @@ begin if (AParent = nil) then inherited Create(nil, [woWindow])
else inherited Create(AParent, [woChildWindow]);
+ OnPaint := @Paint;
+
SetClientSize(Size(125, 125));
SetMinMaxClientSize(Size(125, 125), Size(125, 125));
end;
+procedure TFWidget.Paint(Sender: TObject; const Rect: TRect);
+var
+ r: TRect;
+begin
+ Canvas.SetColor(colLtGray);
+ r.Left := 0;
+ r.Top := 0;
+ r.Right := Width;
+ r.Bottom := Height;
+ Canvas.FillRect(r);
+end;
+
{$endif}
|