diff options
author | drewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-09 01:12:47 +0000 |
---|---|---|
committer | drewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-09 01:12:47 +0000 |
commit | 03e2be3d9c130b02d5cc605de884aa2fe2162db9 (patch) | |
tree | 408f825d4269c279eb51783a9c35e685eb75f579 | |
parent | 4e85bd67c3e3e65dd66c2f44594394d86d204d72 (diff) | |
download | fpGUI-03e2be3d9c130b02d5cc605de884aa2fe2162db9.tar.xz |
* moved FastDoubleBuffer to TfpgCanvasBase
* implemented FastDoubleBuffer for gdi - not tested
* start of listview resiazable headers
-rw-r--r-- | examples/gui/listviewtest/listviewtest.lpr | 1 | ||||
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 42 | ||||
-rw-r--r-- | src/corelib/gfxbase.pas | 5 | ||||
-rw-r--r-- | src/corelib/x11/gfx_x11.pas | 4 | ||||
-rw-r--r-- | src/gui/gui_listview.pas | 17 |
5 files changed, 49 insertions, 20 deletions
diff --git a/examples/gui/listviewtest/listviewtest.lpr b/examples/gui/listviewtest/listviewtest.lpr index ccce9e20..7f551a2e 100644 --- a/examples/gui/listviewtest/listviewtest.lpr +++ b/examples/gui/listviewtest/listviewtest.lpr @@ -109,6 +109,7 @@ begin LVColumn.Caption := 'Column 1'; LVColumn.Width := 150; LVColumn.Height := 50; + LVColumn.Resizable := True; FListView.Columns.Add(LVColumn); FTmpListView.Columns.Add(LVColumn); diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index 2dcade7e..de097c02 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -69,12 +69,15 @@ type end; + { TfpgCanvasImpl } + TfpgCanvasImpl = class(TfpgCanvasBase) private FDrawing: boolean; FBufferBitmap: HBitmap; FDrawWindow: TfpgWindowImpl; - Fgc: TfpgGContext; + Fgc, + fBufgc: TfpgGContext; FWinGC: TfpgGContext; FBackgroundColor: TfpgColor; FCurFontRes: TfpgFontResourceImpl; @@ -85,6 +88,9 @@ type FPen: HPEN; FClipRegion: HRGN; FIntLineStyle: integer; + FBufWidth, + FBufHeight: Integer; + procedure TryFreeBackBuffer; protected procedure DoSetFontRes(fntres: TfpgFontResourceBase); override; procedure DoSetTextColor(cl: TfpgColor); override; @@ -1120,6 +1126,7 @@ destructor TfpgCanvasImpl.Destroy; begin if FDrawing then DoEndDraw; + TryFreeBackBuffer; inherited; end; @@ -1146,10 +1153,14 @@ begin if buffered then begin - DoGetWinRect(ARect); - FBufferBitmap := Windows.CreateCompatibleBitmap(FWinGC, (ARect.Right-ARect.Left+1), (ARect.Bottom-ARect.Top+1)); - Fgc := CreateCompatibleDC(FWinGC); - SelectObject(Fgc, FBufferBitmap); + if (FastDoubleBuffer = False) or (FBufferBitmap = 0) or (FBufWidth <> w) or (FBufHeight <> h) then begin + TryFreeBackBuffer; + DoGetWinRect(ARect); + FBufferBitmap := Windows.CreateCompatibleBitmap(FWinGC, (ARect.Right-ARect.Left+1), (ARect.Bottom-ARect.Top+1)); + FBufgc := CreateCompatibleDC(FWinGC); + Fgc := FBufgc; + end; + SelectObject(FBufgc, FBufferBitmap); end else begin @@ -1181,13 +1192,9 @@ begin DeleteObject(FPen); DeleteObject(FClipRegion); - if FBufferBitmap > 0 then - DeleteObject(FBufferBitmap); - FBufferBitmap := 0; - - if Fgc <> FWinGC then - DeleteDC(Fgc); - + if FastDoubleBuffer = False then + TryFreeBackBuffer; + Windows.ReleaseDC(FDrawWindow.FWinHandle, FWingc); FDrawing := False; @@ -1404,6 +1411,17 @@ begin Windows.SetTextColor(Fgc, fpgColorToWin(cl)); end; +procedure TfpgCanvasImpl.TryFreeBackBuffer; +begin + if FBufferBitmap > 0 then + DeleteObject(FBufferBitmap); + FBufferBitmap := 0; + + if FBufgc > 0 then + DeleteDC(FBufgc); + FBufgc := 0; +end; + procedure TfpgCanvasImpl.DoSetFontRes(fntres: TfpgFontResourceBase); begin if fntres = nil then diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index b668277e..8ab864c7 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -217,8 +217,11 @@ type end; + { TfpgCanvasBase } + TfpgCanvasBase = class(TObject) private + FFastDoubleBuffer: Boolean; FInterpolation: TfpgCustomInterpolation; procedure SetInterpolation(const AValue: TfpgCustomInterpolation); protected @@ -293,6 +296,7 @@ type property Font: TfpgFontBase read FFont write SetFont; property Pixels[X, Y: integer]: TfpgColor read GetPixel write SetPixel; property InterpolationFilter: TfpgCustomInterpolation read FInterpolation write SetInterpolation; + property FastDoubleBuffer: Boolean read FFastDoubleBuffer write FFastDoubleBuffer; end; @@ -742,6 +746,7 @@ end; constructor TfpgCanvasBase.Create; begin FBufferedDraw := True; + FFastDoubleBuffer := True; end; destructor TfpgCanvasBase.Destroy; diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index e26550c3..03f3c945 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -88,7 +88,6 @@ type FDrawWindow: TfpgWindowImpl; FBufferPixmap: TPixmap; FDrawHandle: TXID; - FFastDoubleBuffer: Boolean; Fgc: TfpgGContext; FCurFontRes: TfpgFontResourceImpl; FClipRect: TfpgRect; @@ -127,7 +126,7 @@ type public constructor Create; override; destructor Destroy; override; - property FastDoubleBuffer: Boolean read FFastDoubleBuffer write FFastDoubleBuffer; + end; @@ -1250,7 +1249,6 @@ begin Fgc := nil; FXftDraw := nil; FClipRegion := nil; - FFastDoubleBuffer := True; end; destructor TfpgCanvasImpl.Destroy; diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas index 97157f2e..7f9544b7 100644 --- a/src/gui/gui_listview.pas +++ b/src/gui/gui_listview.pas @@ -703,12 +703,14 @@ begin Continue; if Column.Resizable then begin - if X - (cLeft + Column.Width) > 2 then + if (X < cLeft + Column.Width) and ((cLeft + Column.Width) - X < 3) then begin - // Mouse.Cursor := mcIBeam;? - //xc - end; + MouseCursor := mcSizeEW; + end + else + if MouseCursor <> mcDefault then MouseCursor := mcDefault; end; + Inc(cLeft, Column.Width); end; end; @@ -884,7 +886,12 @@ begin if Y < (cRect.Top + HeaderHeight) then begin HandleHeaderMouseMove(x, y, btnstate, shiftstate); - end; + end + else + if MouseCursor <> mcDefault then MouseCursor := mcDefault; + + + //if FVScrollBar.Visible then Dec(cRect.Width, FVScrollBar.Width); //if FHScrollBar.Visible then Dec(cRect.Height, FHScrollBar.Height); |