diff options
author | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-11 21:49:28 +0000 |
---|---|---|
committer | sekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-11 21:49:28 +0000 |
commit | 8bf4f37e3b99775cf9f6253077217ac0174771e0 (patch) | |
tree | f48ba67ceb633d7135b5c69bf7adacdad450b557 | |
parent | 9f5b0fc182530301b211d3aae3731c50ddcde369 (diff) | |
download | fpGUI-8bf4f37e3b99775cf9f6253077217ac0174771e0.tar.xz |
Changed Invalidate to have no parameters. Now button down kind of works on the new multihandle
-rw-r--r-- | gfx/gdi/gfx_gdi.pas | 12 | ||||
-rw-r--r-- | gfx/gfxbase.pas | 2 | ||||
-rw-r--r-- | prototypes/newmultihandle/gui_button.inc | 81 |
3 files changed, 73 insertions, 22 deletions
diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas index a6107d24..64622ab8 100644 --- a/gfx/gdi/gfx_gdi.pas +++ b/gfx/gdi/gfx_gdi.pas @@ -200,7 +200,7 @@ type procedure SetClientSize(const ASize: TSize); override; procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override; procedure Show; override; - procedure Invalidate(const ARect: TRect); override; + procedure Invalidate; override; procedure PaintInvalidRegion; override; procedure CaptureMouse; override; procedure ReleaseMouse; override; @@ -1512,15 +1512,9 @@ begin end; -procedure TGDIWindow.Invalidate(const ARect: TRect); -var - Rect: Windows.Rect; +procedure TGDIWindow.Invalidate; begin - Rect.Left := ARect.Left; - Rect.Top := ARect.Top; - Rect.Right := ARect.Right; - Rect.Bottom := ARect.Bottom; - Windows.InvalidateRect(Handle, Rect, False); + Windows.InvalidateRect(Handle, nil, True); end; diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas index 80362d35..4d9c2e90 100644 --- a/gfx/gfxbase.pas +++ b/gfx/gfxbase.pas @@ -523,7 +523,7 @@ type procedure SetClientSize(const ASize: TSize); virtual; procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); virtual; procedure Show; virtual; abstract; - procedure Invalidate(const ARect: TRect); virtual; abstract; + procedure Invalidate; virtual; abstract; procedure PaintInvalidRegion; virtual; abstract; procedure CaptureMouse; virtual; abstract; procedure ReleaseMouse; virtual; abstract; diff --git a/prototypes/newmultihandle/gui_button.inc b/prototypes/newmultihandle/gui_button.inc index 997faee9..e79b8748 100644 --- a/prototypes/newmultihandle/gui_button.inc +++ b/prototypes/newmultihandle/gui_button.inc @@ -7,12 +7,21 @@ type { TFButton } TFButton = class(TFWidget) + private + FIsPressed: Boolean; public Text: string; constructor Create(AParent: TFCustomWindow); override; constructor Create(ACaption: string; AParent: TFCustomWindow); - procedure EvPaint; override; + procedure EvFocusIn; override; + procedure EvFocusOut; override; + procedure EvKeyPressed(AKey: Word); override; + procedure EvKeyReleased(AKey: Word); override; + procedure EvMouseEnter(const AMousePos: TPoint); override; + procedure EvMouseLeave; override; + procedure EvMousePressed(AButton: TMouseButton; const AMousePos: TPoint); override; procedure EvMouseReleased(AButton: TMouseButton; const AMousePos: TPoint); override; + procedure EvPaint; override; end; @@ -34,11 +43,67 @@ begin Text := ACaption; end; +procedure TFButton.EvFocusIn; +begin + inherited EvFocusIn; +end; + +procedure TFButton.EvFocusOut; +begin + inherited EvFocusOut; +end; + +procedure TFButton.EvKeyPressed(AKey: Word); +begin + inherited EvKeyPressed(AKey); +end; + +procedure TFButton.EvKeyReleased(AKey: Word); +begin + inherited EvKeyReleased(AKey); +end; + +procedure TFButton.EvMouseEnter(const AMousePos: TPoint); +begin + inherited EvMouseEnter(AMousePos); +end; + +procedure TFButton.EvMouseLeave; +begin + FIsPressed := False; + + Invalidate; + + inherited EvMouseLeave; +end; + +procedure TFButton.EvMousePressed(AButton: TMouseButton; const AMousePos: TPoint + ); +begin + FIsPressed := True; + + Invalidate; + + inherited EvMousePressed(AButton, AMousePos); +end; + +procedure TFButton.EvMouseReleased(AButton: TMouseButton; + const AMousePos: TPoint); +begin + FIsPressed := False; + + Invalidate; + + inherited EvMouseReleased(AButton, AMousePos); +end; + procedure TFButton.EvPaint; var rt: TRect; Flags: TFButtonFlags; begin + WriteLn('Paint event'); + rt.Left := 0; rt.Top := 0; rt.Right := Width; @@ -48,10 +113,10 @@ begin Flags := []; - { if FDown then - Include(lBtnFlags, btnIsPressed); + if FIsPressed then + Include(Flags, fbfIsPressed); - if FFocused and (not FEmbedded) then +{ if FFocused and (not FEmbedded) then Include(lBtnFlags, btnHasFocus); if FEmbedded then @@ -64,13 +129,5 @@ begin inherited EvPaint(); end; -procedure TFButton.EvMouseReleased(AButton: TMouseButton; - const AMousePos: TPoint); -begin - WriteLn('Mouse released on child window'); - - inherited EvMouseReleased(AButton, AMousePos); -end; - {$endif} |