summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 14:51:52 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 14:51:52 +0000
commit3665aaf20c92abb76e29bb0a4aa445e57652b1f3 (patch)
treed6b8a9989beef01fbe728590cdc361153828ca5f
parent3cc0dae4705f0535dba9e6f2f126c017c684ae53 (diff)
downloadfpGUI-3665aaf20c92abb76e29bb0a4aa445e57652b1f3.tar.xz
* Defined some Event Types. Mostly for usage of end user
property events. * Implemented some end user events like OnPaint, OnMouseEnter, OnMouseExit, OnShow, OnDestroy, OnActivate, etc... * Minor fix in the X11 font height returned. * Created a new GUI example displaying the usage of the Align property.
-rw-r--r--prototypes/fpgui2/examples/core/canvastest/button.bmpbin0 -> 4438 bytes
-rw-r--r--prototypes/fpgui2/examples/gui/alignment/aligntest.dpr107
-rw-r--r--prototypes/fpgui2/examples/gui/alignment/aligntest.lpi52
-rw-r--r--prototypes/fpgui2/source/core/fpgfx.pas27
-rw-r--r--prototypes/fpgui2/source/core/gdi/gfx_gdi.pas3
-rw-r--r--prototypes/fpgui2/source/core/gfx_widget.pas53
-rw-r--r--prototypes/fpgui2/source/core/gfxbase.pas38
-rw-r--r--prototypes/fpgui2/source/core/x11/gfx_x11.pas9
-rw-r--r--prototypes/fpgui2/source/gui/gui_button.pas1
-rw-r--r--prototypes/fpgui2/source/gui/gui_form.pas61
-rw-r--r--prototypes/fpgui2/source/gui/gui_label.pas1
11 files changed, 326 insertions, 26 deletions
diff --git a/prototypes/fpgui2/examples/core/canvastest/button.bmp b/prototypes/fpgui2/examples/core/canvastest/button.bmp
new file mode 100644
index 00000000..8ae427cf
--- /dev/null
+++ b/prototypes/fpgui2/examples/core/canvastest/button.bmp
Binary files differ
diff --git a/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr b/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr
new file mode 100644
index 00000000..7099b761
--- /dev/null
+++ b/prototypes/fpgui2/examples/gui/alignment/aligntest.dpr
@@ -0,0 +1,107 @@
+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
new file mode 100644
index 00000000..5d943df0
--- /dev/null
+++ b/prototypes/fpgui2/examples/gui/alignment/aligntest.lpi
@@ -0,0 +1,52 @@
+<?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/source/core/fpgfx.pas b/prototypes/fpgui2/source/core/fpgfx.pas
index 8556f169..857a30aa 100644
--- a/prototypes/fpgui2/source/core/fpgfx.pas
+++ b/prototypes/fpgui2/source/core/fpgfx.pas
@@ -30,6 +30,9 @@ type
TFButtonFlags = set of (btnIsEmbedded, btnIsDefault, btnIsPressed,
btnIsSelected, btnHasFocus, btnHasParentColor);
+
+ TMouseButton = (mbLeft, mbRight, mbMiddle);
+
const
AllAnchors = [anLeft, anRight, anTop, anBottom];
@@ -39,11 +42,28 @@ const
type
- TKeyPressNotifyEvent = procedure(Sender: TObject; var keycode: word; var shiftstate: word;
+ { *******************************************
+ Internal event properties: Event Types
+ *******************************************}
+ TIntKeyPressEvent = procedure(Sender: TObject; var keycode: word; var shiftstate: word;
var consumed: boolean) of object;
- TMouseNotifyEvent = procedure(Sender: TObject; x, y: TfpgCoord; var button: word;
+ TIntMouseEvent = procedure(Sender: TObject; x, y: TfpgCoord; var button: word;
var shiftstate: word) of object;
+
+ { *******************************************
+ Public event properties: Event Types
+ *******************************************}
+ { Keyboard }
+ TKeyEvent = procedure(Sender: TObject; AKey: Word; AShift: TShiftState) of object;
+ TKeyCharEvent = procedure(Sender: TObject; AKeyChar: Char) of object;
+ { Mouse }
+ TMouseButtonEvent = procedure(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint) of object;
+ TMouseMoveEvent = procedure(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint) of object;
+ TMouseWheelEvent = procedure(Sender: TObject; AShift: TShiftState; AWheelDelta: Single; const AMousePos: TPoint) of object;
+ { Painting }
+ TPaintEvent = procedure(Sender: TObject; const ARect: TfpgRect) of object;
+
type
TSizeParams = record
min_width: TfpgCoord;
@@ -176,15 +196,16 @@ type
FEnabled: boolean;
FNextAlarm: TDateTime;
FInterval: integer;
+ FOnTimer: TNotifyEvent;
procedure SetEnabled(const AValue: boolean);
public
- OnTimer: TNotifyEvent;
constructor Create(ainterval: integer);
destructor Destroy; override;
procedure CheckAlarm(ctime: TDateTime);
property Enabled: boolean read FEnabled write SetEnabled;
property NextAlarm: TDateTime read FNextAlarm;
property Interval: integer read FInterval write FInterval;
+ property OnTimer: TNotifyEvent read FOnTimer write FOnTimer;
end;
diff --git a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas
index cfd0ce61..d29d1384 100644
--- a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas
+++ b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas
@@ -106,7 +106,7 @@ type
function GetPixel(X, Y: integer): TfpgColor; override;
procedure SetPixel(X, Y: integer; const AValue: TfpgColor); override;
public
- constructor Create;
+ constructor Create; override;
destructor Destroy; override;
end;
@@ -927,6 +927,7 @@ end;
constructor TfpgCanvasImpl.Create;
begin
+ inherited;
FDrawing := False;
FDrawWindow := nil;
FBufferBitmap := 0;
diff --git a/prototypes/fpgui2/source/core/gfx_widget.pas b/prototypes/fpgui2/source/core/gfx_widget.pas
index d69bc971..97932b7c 100644
--- a/prototypes/fpgui2/source/core/gfx_widget.pas
+++ b/prototypes/fpgui2/source/core/gfx_widget.pas
@@ -18,6 +18,10 @@ type
TfpgWidget = class(TfpgWindow)
private
FAlignRect: TfpgRect;
+ FOnMouseEnter: TNotifyEvent;
+ FOnMouseExit: TNotifyEvent;
+ FOnMouseMove: TMouseMoveEvent;
+ FOnPaint: TPaintEvent;
FOnScreen: boolean;
procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT;
procedure MsgResize(var msg: TfpgMessageRec); message FPGM_RESIZE;
@@ -69,10 +73,20 @@ type
procedure MoveAndResizeBy(dx, dy, dw, dh: TfpgCoord);
procedure SetPosition(aleft, atop, awidth, aheight: TfpgCoord);
procedure RePaint;
+
+ //property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
+ //property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
+ //property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
+ //property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
+ //property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;
+ property OnPaint: TPaintEvent read FOnPaint write FOnPaint;
+ property OnMouseExit: TNotifyEvent read FOnMouseExit write FOnMouseExit;
+ property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
+ property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
+ //property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress;
public
constructor Create(aowner: TComponent); override;
destructor Destroy; override;
- OnKeyPress: TKeyPressNotifyEvent;
procedure SetFocus;
procedure KillFocus;
property Parent: TfpgWidget read FParent write FParent;
@@ -121,8 +135,7 @@ end;
procedure TfpgWidget.SetActiveWidget(const AValue: TfpgWidget);
begin
if FActiveWidget = AValue then
- Exit;
-
+ Exit; //==>
if FActiveWidget <> nil then
FActiveWidget.HandleKillFocus;
FActiveWidget := AValue;
@@ -133,9 +146,8 @@ end;
procedure TfpgWidget.SetVisible(const AValue: boolean);
begin
if FVisible = AValue then
- Exit;
+ Exit; //==>
FVisible := AValue;
-
if FOnScreen then
if FVisible then
HandleShow
@@ -157,7 +169,7 @@ begin
FTabOrder := 0;
FAnchors := [anLeft, anTop];
FAlign := alNone;
- OnKeyPress := nil;
+// OnKeyPress := nil;
if (aowner <> nil) and (aowner is TfpgWidget) then
FParent := TfpgWidget(aowner)
@@ -179,6 +191,8 @@ end;
procedure TfpgWidget.MsgPaint(var msg: TfpgMessageRec);
begin
HandlePaint;
+ if Assigned(FOnPaint) then
+ FOnPaint(Self, msg.Params.rect);
end;
procedure TfpgWidget.MsgKeyChar(var msg: TfpgMessageRec);
@@ -271,6 +285,10 @@ end;
procedure TfpgWidget.MsgMouseMove(var msg: TfpgMessageRec);
begin
HandleMouseMove(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.Buttons, msg.Params.mouse.shiftstate);
+ if Assigned(OnMouseMove) then
+ OnMouseMove(self,
+ GetKeyboardShiftState(msg.Params.mouse.shiftstate),
+ Point(msg.Params.mouse.x, msg.Params.mouse.y));
end;
procedure TfpgWidget.MsgDoubleClick(var msg: TfpgMessageRec);
@@ -281,11 +299,15 @@ end;
procedure TfpgWidget.MsgMouseEnter(var msg: TfpgMessageRec);
begin
HandleMouseEnter;
+ if Assigned(FOnMouseEnter) then
+ FOnMouseEnter(self);
end;
procedure TfpgWidget.MsgMouseExit(var msg: TfpgMessageRec);
begin
HandleMouseExit;
+ if Assigned(FOnMouseExit) then
+ FOnMouseExit(Self);
end;
procedure TfpgWidget.HandleShow;
@@ -345,21 +367,16 @@ begin
// descendants will implement this.
end;
-procedure TfpgWidget.HandleKeyPress(var keycode, shiftstate: word; var consumed: boolean);
-begin
- // descendants will implement this.
-end;
-
procedure TfpgWidget.HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean);
var
wg: TfpgWidget;
dir: integer;
begin
- if Assigned(OnKeyPress) then
- OnKeyPress(self, keycode, shiftstate, consumed);
+ //if Assigned(OnKeyPress) then
+ //OnKeyPress(self, keycode, shiftstate, consumed);
- if consumed then
- Exit;
+ //if consumed then
+ //Exit; //==>
dir := 0;
@@ -380,6 +397,7 @@ begin
dir := -1;
end;
+ {$Note Optimize this code. Constantly setting ActiveWidget causes RePaint to be called!}
if dir = 1 then
begin
// forward
@@ -421,6 +439,11 @@ begin
end;
end;
+procedure TfpgWidget.HandleKeyPress(var keycode: word; var shiftstate: word; var consumed: boolean);
+begin
+ // descendants will implement this.
+end;
+
procedure TfpgWidget.HandleKeyRelease(var keycode: word; var shiftstate: word; var consumed: boolean);
begin
// nothing yet.
diff --git a/prototypes/fpgui2/source/core/gfxbase.pas b/prototypes/fpgui2/source/core/gfxbase.pas
index 504f9996..e5bbfc78 100644
--- a/prototypes/fpgui2/source/core/gfxbase.pas
+++ b/prototypes/fpgui2/source/core/gfxbase.pas
@@ -231,6 +231,7 @@ type
function GetPixel(X, Y: integer): TfpgColor; virtual; abstract;
procedure SetPixel(X, Y: integer; const AValue: TfpgColor); virtual; abstract;
public
+ constructor Create; virtual;
procedure DrawRectangle(x, y, w, h: TfpgCoord); overload;
procedure DrawRectangle(r: TfpgRect); overload;
procedure DrawLine(x1, y1, x2, y2: TfpgCoord);
@@ -316,11 +317,43 @@ type
end;
+{ ******** Helper functions ******** }
+{ Keyboard }
+function GetKeyboardShiftState(AShiftState: word): TShiftState;
+function KeycodeToText(AKey: Word; AShiftState: TShiftState): string;
+
implementation
uses
fpgfx; // needed for fpgApplication
+function GetKeyboardShiftState(AShiftState: word): TShiftState;
+begin
+ Result := [];
+ if (AShiftState and ss_shift) <> 0 then
+ Include(result, ssShift);
+
+ if (AShiftState and ss_Control) <> 0 then
+ Include(result, ssCtrl);
+
+ if (AShiftState and ss_Alt) <> 0 then
+ Include(result, ssAlt);
+
+ if (AShiftState and ss_CapsLock) <> 0 then
+ Include(result, ssCaps);
+
+ if (AShiftState and ss_NumLock) <> 0 then
+ Include(result, ssNum);
+
+ if (AShiftState and ss_ScrollLock) <> 0 then
+ Include(result, ssScroll);
+end;
+
+function KeycodeToText(AKey: Word; AShiftState: TShiftState): string;
+begin
+ Result := 'not implemented yet';
+end;
+
{ TfpgRect }
procedure TfpgRect.SetRect(aleft, atop, awidth, aheight: TfpgCoord);
@@ -410,6 +443,11 @@ end;
{ TfpgCanvasBase }
+constructor TfpgCanvasBase.Create;
+begin
+ FBufferedDraw := True;
+end;
+
procedure TfpgCanvasBase.DrawRectangle(x, y, w, h: TfpgCoord);
begin
DoDrawRectangle(x, y, w, h);
diff --git a/prototypes/fpgui2/source/core/x11/gfx_x11.pas b/prototypes/fpgui2/source/core/x11/gfx_x11.pas
index 3c6dd83c..064f26ea 100644
--- a/prototypes/fpgui2/source/core/x11/gfx_x11.pas
+++ b/prototypes/fpgui2/source/core/x11/gfx_x11.pas
@@ -110,7 +110,7 @@ type
function GetPixel(X, Y: integer): TfpgColor; override;
procedure SetPixel(X, Y: integer; const AValue: TfpgColor); override;
public
- constructor Create;
+ constructor Create; override;
destructor Destroy; override;
end;
@@ -979,8 +979,8 @@ end;
function TfpgFontResourceImpl.GetHeight: integer;
begin
- // Not sure which one is better?
- Result := FFontData^.height; // GetAscent + GetDescent;
+ // Do NOT use FFontData^.height as it isn't as accurate
+ Result := GetAscent + GetDescent;
end;
function TfpgFontResourceImpl.GetTextWidth(const txt: string): integer;
@@ -1000,6 +1000,7 @@ end;
constructor TfpgCanvasImpl.Create;
begin
+ inherited;
FDrawing := False;
FDrawWindow := nil;
@@ -1193,7 +1194,7 @@ end;
procedure TfpgCanvasImpl.DoDrawString(x, y: TfpgCoord; const txt: string);
begin
if Length(txt) < 1 then
- Exit;
+ Exit; //==>
XftDrawStringUTF8(FXftDraw, FColorTextXft, FCurFontRes.Handle, x, y + FCurFontRes.GetAscent,
PChar(txt), Length(txt));
diff --git a/prototypes/fpgui2/source/gui/gui_button.pas b/prototypes/fpgui2/source/gui/gui_button.pas
index b93f154a..914aa479 100644
--- a/prototypes/fpgui2/source/gui/gui_button.pas
+++ b/prototypes/fpgui2/source/gui/gui_button.pas
@@ -188,6 +188,7 @@ var
lBtnFlags: TFButtonFlags;
begin
Canvas.BeginDraw;
+ inherited HandlePaint;
Canvas.Clear(clButtonFace);
Canvas.ClearClipRect;
diff --git a/prototypes/fpgui2/source/gui/gui_form.pas b/prototypes/fpgui2/source/gui/gui_form.pas
index 7866ec91..67e14f3c 100644
--- a/prototypes/fpgui2/source/gui/gui_form.pas
+++ b/prototypes/fpgui2/source/gui/gui_form.pas
@@ -15,6 +15,14 @@ type
TfpgForm = class(TfpgWidget)
+ private
+ FOnActivate: TNotifyEvent;
+ FOnClose: TNotifyEvent;
+ FOnCreate: TNotifyEvent;
+ FOnDeactivate: TNotifyEvent;
+ FOnDestroy: TNotifyEvent;
+ FOnHide: TNotifyEvent;
+ FOnShow: TNotifyEvent;
protected
FPrevModalForm: TfpgForm;
FModalResult: integer;
@@ -31,6 +39,10 @@ type
procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE;
procedure HandlePaint; override;
procedure HandleClose; virtual;
+ procedure HandleHide; override;
+ procedure HandleShow; override;
+ procedure AfterConstruction; override;
+ procedure BeforeDestruction; override;
public
constructor Create(aowner: TComponent); override;
procedure AfterCreate; virtual;
@@ -42,6 +54,15 @@ type
property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition;
property WindowTitle: string read FWindowTitle write SetWindowTitle;
property ModalResult: integer read FModalResult write FModalResult;
+ published
+ {$Note Refactor this to a TfpgCustomForm and only surface it here }
+ property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
+ property OnClose: TNotifyEvent read FOnClose write FOnClose;
+ property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
+ property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
+ property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
+ property OnHide: TNotifyEvent read FOnHide write FOnHide;
+ property OnShow: TNotifyEvent read FOnShow write FOnShow;
end;
@@ -86,9 +107,9 @@ end;
procedure TfpgForm.HandlePaint;
begin
- canvas.BeginDraw;
- canvas.Clear(FBackgroundColor);
- canvas.EndDraw(0, 0, FWidth, FHeight);
+ Canvas.BeginDraw;
+ Canvas.Clear(FBackgroundColor);
+ Canvas.EndDraw(0, 0, FWidth, FHeight);
end;
procedure TfpgForm.AdjustWindowStyle;
@@ -172,17 +193,23 @@ begin
else
ActiveWidget.SetFocus;
end;
+ if Assigned(FOnActivate) then
+ FOnActivate(self);
end;
procedure TfpgForm.MsgDeActivate(var msg: TfpgMessageRec);
begin
if ActiveWidget <> nil then
ActiveWidget.KillFocus;
+ if Assigned(FOnDeactivate) then
+ FOnDeactivate(self);
end;
procedure TfpgForm.MsgClose(var msg: TfpgMessageRec);
begin
HandleClose;
+ if Assigned(FOnClose) then
+ FOnClose(self);
end;
procedure TfpgForm.HandleClose;
@@ -190,6 +217,34 @@ begin
Close;
end;
+procedure TfpgForm.HandleHide;
+begin
+ inherited HandleHide;
+ if Assigned(FOnHide) then
+ FOnHide(self);
+end;
+
+procedure TfpgForm.HandleShow;
+begin
+ inherited HandleShow;
+ if Assigned(FOnShow) then
+ FOnShow(self);
+end;
+
+procedure TfpgForm.AfterConstruction;
+begin
+ inherited AfterConstruction;
+ if Assigned(FOnCreate) then
+ FOnCreate(self);
+end;
+
+procedure TfpgForm.BeforeDestruction;
+begin
+ inherited BeforeDestruction;
+ if Assigned(FOnDestroy) then
+ FOnDestroy(self);
+end;
+
procedure TfpgForm.Hide;
begin
if (fpgTopModalForm = self) then
diff --git a/prototypes/fpgui2/source/gui/gui_label.pas b/prototypes/fpgui2/source/gui/gui_label.pas
index cacd6f63..18e8b2ed 100644
--- a/prototypes/fpgui2/source/gui/gui_label.pas
+++ b/prototypes/fpgui2/source/gui/gui_label.pas
@@ -35,6 +35,7 @@ type
property FontDesc: string read GetFontDesc write SetFontDesc;
property Color: TfpgColor read FColor write SetColor;
property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
+ property OnMouseMove;
end;
TLabelClass = class of TfpgLabel;