diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-05-15 08:13:27 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-05-15 08:13:27 +0000 |
commit | 71ddb1d624ac22d25503ab2a3031c342c5ff06e0 (patch) | |
tree | 0ee5b182e833b2100d6a1daf9b2740a003b5ed3b | |
parent | bd10afa35cac4c87cd1a3476b84f4132c34ed5af (diff) | |
download | fpGUI-71ddb1d624ac22d25503ab2a3031c342c5ff06e0.tar.xz |
* Applied patch from Luiz Americo optimising the ListView painting calls and events.
-rw-r--r-- | src/gui/gui_listview.pas | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas index d82f022d..90980bff 100644 --- a/src/gui/gui_listview.pas +++ b/src/gui/gui_listview.pas @@ -223,6 +223,7 @@ type procedure DoColumnClick(Column: TfpgLVColumn; Button: Integer); procedure HandleHeaderMouseMove(x, y: Integer; btnstate: word; Shiftstate: TShiftState); protected + procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT; procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override; procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override; procedure HandleRMouseDown(x, y: integer; shiftstate: TShiftState); override; @@ -274,7 +275,7 @@ type { TfpgLVItems } -function Min(AInt, BInt: Integer): INteger; +function Min(AInt, BInt: Integer): Integer; begin if AInt < Bint then Result := AInt @@ -865,6 +866,14 @@ begin end; +procedure TfpgListView.MsgPaint(var msg: TfpgMessageRec); +begin + // Optimises painting and prevents Begin[End]Draw and OnPaint event firing + // in not needed. + if FUpdateCount = 0 then + inherited MsgPaint(msg); +end; + procedure TfpgListView.HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); var @@ -1191,23 +1200,16 @@ begin end; - procedure TfpgListView.HandlePaint; var ClipRect: TfpgRect; begin - if FUpdateCount > 0 then - Exit; - - Canvas.BeginDraw; - UpdateScrollBarPositions; - fpgStyle.DrawControlFrame(Canvas, 0, 0, Width, Height); - ClipRect.Top := 2; - ClipRect.Left := 2; - ClipRect.Width := Width -4; + ClipRect.Top := 2; + ClipRect.Left := 2; + ClipRect.Width := Width -4; ClipRect.Height := Height -4; if ShowHeaders then @@ -1235,16 +1237,12 @@ begin Dec(ClipRect.Height, FhScrollBar.Height); Canvas.SetClipRect(ClipRect); - PaintItems; - - Canvas.EndDraw; end; procedure TfpgListView.HandleResize(awidth, aheight: TfpgCoord); begin inherited HandleResize(awidth, aheight); - UpdateScrollBarPositions; end; @@ -1600,7 +1598,7 @@ begin if bVisible and tVisible then Exit; - if (iBottom >= FVScrollBar.Position + GetItemAreaHeight) then + if (iBottom >= FVScrollBar.Position + GetItemAreaHeight) then FVScrollBar.Position := iBottom - GetItemAreaHeight else FVScrollBar.Position := iTop; |