add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control

git-svn-id: trunk@5026 -
This commit is contained in:
micha 2004-01-07 18:05:46 +00:00
parent eab820a09e
commit 0b23f54b34
2 changed files with 36 additions and 18 deletions

View File

@ -975,6 +975,7 @@ type
FControls: TList; FControls: TList;
FDefWndProc: Pointer; FDefWndProc: Pointer;
//FDockSite: Boolean; //FDockSite: Boolean;
FDoubleBuffered: Boolean;
FClientWidth: Integer; FClientWidth: Integer;
FClientHeight: Integer; FClientHeight: Integer;
FDockManager: TDockManager; FDockManager: TDockManager;
@ -1120,6 +1121,7 @@ type
property DockClients[Index: Integer]: TControl read GetDockClients; property DockClients[Index: Integer]: TControl read GetDockClients;
property DockSite: Boolean read FDockSite write SetDockSite default False; property DockSite: Boolean read FDockSite write SetDockSite default False;
property DockManager: TDockManager read FDockManager write FDockManager; property DockManager: TDockManager read FDockManager write FDockManager;
property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered;
property IsResizing: Boolean read GetIsResizing; property IsResizing: Boolean read GetIsResizing;
property OnDockDrop: TDockDropEvent read FOnDockDrop write FOnDockDrop; property OnDockDrop: TDockDropEvent read FOnDockDrop write FOnDockDrop;
property OnDockOver: TDockOverEvent read FOnDockOver write FOnDockOver; property OnDockOver: TDockOverEvent read FOnDockOver write FOnDockOver;
@ -1857,6 +1859,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.167 2004/01/07 18:05:46 micha
add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control
Revision 1.166 2004/01/03 23:14:59 mattias Revision 1.166 2004/01/03 23:14:59 mattias
default font can now change height and fixed gtk crash default font can now change height and fixed gtk crash

View File

@ -179,32 +179,42 @@ Var
// create a paint message // create a paint message
AWinControl := TWinControl(OwnerObject); AWinControl := TWinControl(OwnerObject);
DC := Windows.GetDC(0); if AWinControl.DoubleBuffered then
GetWindowSize(Window, MemWidth, MemHeight); begin
MemBitmap := Windows.CreateCompatibleBitmap(DC, MemWidth, MemHeight); DC := Windows.GetDC(0);
Windows.ReleaseDC(0, DC); GetWindowSize(Window, MemWidth, MemHeight);
MemDC := Windows.CreateCompatibleDC(0); MemBitmap := Windows.CreateCompatibleBitmap(DC, MemWidth, MemHeight);
OldBitmap := Windows.SelectObject(MemDC, MemBitmap); Windows.ReleaseDC(0, DC);
MemDC := Windows.CreateCompatibleDC(0);
OldBitmap := Windows.SelectObject(MemDC, MemBitmap);
PaintMsg.DC := MemDC;
end;
GetLclClientOriginOffset(AWinControl.Handle, LeftOffset, TopOffset); GetLclClientOriginOffset(AWinControl.Handle, LeftOffset, TopOffset);
try try
DC := Windows.BeginPaint(Window, @PS); DC := Windows.BeginPaint(Window, @PS);
AWinControl.EraseBackground(MemDC);
PaintMsg.Msg := LM_PAINT; PaintMsg.Msg := LM_PAINT;
PaintMsg.DC := MemDC;
PaintMsg.PaintStruct := @PS; PaintMsg.PaintStruct := @PS;
MoveWindowOrgEx(MemDC, LeftOffset, TopOffset); if not AWinControl.DoubleBuffered then
PaintMsg.DC := DC;
AWinControl.EraseBackground(PaintMsg.DC);
MoveWindowOrgEx(PaintMsg.DC, LeftOffset, TopOffset);
DeliverMessage(OwnerObject, PaintMsg); DeliverMessage(OwnerObject, PaintMsg);
MoveWindowOrgEx(MemDC, -LeftOffset, -TopOffset); MoveWindowOrgEx(PaintMsg.DC, -LeftOffset, -TopOffset);
Windows.BitBlt(DC, 0, 0, MemWidth, MemHeight, MemDC, 0, 0, SRCCOPY); if AWinControl.DoubleBuffered then
Windows.BitBlt(DC, 0, 0, MemWidth, MemHeight, MemDC, 0, 0, SRCCOPY);
Windows.EndPaint(Window, @PS); Windows.EndPaint(Window, @PS);
finally finally
SelectObject(MemDC, OldBitmap); if AWinControl.DoubleBuffered then
Windows.OpenClipboard(0); begin
Windows.EmptyClipboard; SelectObject(MemDC, OldBitmap);
Windows.SetClipboardData(CF_BITMAP, MemBitmap); // for debugging purposes: copy rendered bitmap to clipboard
Windows.CloseClipboard; // Windows.OpenClipboard(0);
DeleteDC(MemDC); // Windows.EmptyClipboard;
DeleteObject(MemBitmap); // Windows.SetClipboardData(CF_BITMAP, MemBitmap);
// Windows.CloseClipboard;
DeleteDC(MemDC);
DeleteObject(MemBitmap);
end;
end; end;
end; end;
@ -928,6 +938,9 @@ end;
{ {
$Log$ $Log$
Revision 1.86 2004/01/07 18:05:46 micha
add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control
Revision 1.85 2004/01/03 21:06:06 micha Revision 1.85 2004/01/03 21:06:06 micha
- fix win32/checklistbox - fix win32/checklistbox
- implement proper lcl to interface move/size notify via setwindowpos - implement proper lcl to interface move/size notify via setwindowpos