mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:39:23 +02:00
implement overlay window for designer
git-svn-id: trunk@5050 -
This commit is contained in:
parent
77217ed9fa
commit
1903f6fc4f
@ -73,6 +73,43 @@ Begin
|
|||||||
Assert(False, 'Trace:PropEnumProc - Exit');
|
Assert(False, 'Trace:PropEnumProc - Exit');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Function: OverlayWindowProc
|
||||||
|
Params: Window - The window that receives a message
|
||||||
|
Msg - The message received
|
||||||
|
WParam - Word parameter
|
||||||
|
LParam - Long-integer parameter
|
||||||
|
Returns: 0 if Msg is handled; non-zero long-integer result otherwise
|
||||||
|
|
||||||
|
Handles messages specifically for the window used by GetDesignerDC
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function OverlayWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
|
||||||
|
LParam: Windows.LParam): LResult; stdcall;
|
||||||
|
var
|
||||||
|
PS: PAINTSTRUCT;
|
||||||
|
PrevWndProc: Pointer;
|
||||||
|
begin
|
||||||
|
case Msg of
|
||||||
|
WM_ERASEBKGND:
|
||||||
|
begin
|
||||||
|
Result := 1;
|
||||||
|
end;
|
||||||
|
WM_PAINT:
|
||||||
|
begin
|
||||||
|
Windows.BeginPaint(Window, @PS);
|
||||||
|
Windows.EndPaint(Window, @PS);
|
||||||
|
Result := 1;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
// default handling of message
|
||||||
|
PrevWndProc := GetProp(Window, 'DefWndProc');
|
||||||
|
if PrevWndProc = nil then
|
||||||
|
Result := Windows.DefWindowProc(Window, Msg, WParam, LParam)
|
||||||
|
else
|
||||||
|
Result := Windows.CallWindowProc(Windows.WNDPROC(PrevWndProc), Window, Msg, WParam, LParam);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: WindowProc
|
Function: WindowProc
|
||||||
Params: Window - The window that receives a message
|
Params: Window - The window that receives a message
|
||||||
@ -733,10 +770,9 @@ Begin
|
|||||||
Unused := WParam;
|
Unused := WParam;
|
||||||
WindowPos := PWindowPos(LParam);
|
WindowPos := PWindowPos(LParam);
|
||||||
End;
|
End;
|
||||||
// GetClientRect(Window, R);
|
// cross-interface compatible: complete invalidate on resize
|
||||||
// SendMessage(Window, WM_MOVE, 0, MakeLParam(PWindowPos(LParam)^.x, PWindowPos(LParam)^.y));
|
if (PWindowPos(LParam)^.flags and SWP_NOSIZE) = 0 then
|
||||||
// SendMessage(Window, WM_SIZE, 0, MakeLParam(R.right-R.left, R.bottom-R.top));
|
Windows.InvalidateRect(Window, nil, true);
|
||||||
// WinProcess:=false;
|
|
||||||
End;
|
End;
|
||||||
WM_MEASUREITEM:
|
WM_MEASUREITEM:
|
||||||
Begin
|
Begin
|
||||||
@ -938,6 +974,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.87 2004/01/12 08:20:50 micha
|
||||||
|
implement overlay window for designer
|
||||||
|
|
||||||
Revision 1.86 2004/01/07 18:05:46 micha
|
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
|
add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control
|
||||||
|
|
||||||
|
@ -1364,8 +1364,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32Object.GetDesignerDC(WindowHandle: HWND): HDC;
|
function TWin32Object.GetDesignerDC(WindowHandle: HWND): HDC;
|
||||||
|
var
|
||||||
|
OverlayWindow: HWND;
|
||||||
|
ARect: Windows.RECT;
|
||||||
begin
|
begin
|
||||||
Result := Windows.GetDC(0);
|
OverlayWindow := HWND(Windows.GetProp(WindowHandle, 'Overlay'));
|
||||||
|
if OverlayWindow = HWND(nil) then
|
||||||
|
begin
|
||||||
|
// create 'overlay' window
|
||||||
|
Windows.GetClientRect(WindowHandle, @ARect);
|
||||||
|
OverlayWindow := Windows.CreateWindowEx(WS_EX_TRANSPARENT,
|
||||||
|
'STATIC', '', WS_CHILD or WS_VISIBLE,
|
||||||
|
ARect.Left, ARect.Top, ARect.Right, ARect.Bottom,
|
||||||
|
WindowHandle, HMENU(nil), HInstance, nil);
|
||||||
|
Windows.SetProp(OverlayWindow, 'DefWndProc', Windows.SetWindowLong(
|
||||||
|
OverlayWindow, GWL_WNDPROC, LongInt(@OverlayWindowProc)));
|
||||||
|
Windows.SetProp(WindowHandle, 'Overlay', OverlayWindow);
|
||||||
|
end;
|
||||||
|
Result := Windows.GetDC(OverlayWindow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32Object.GetDeviceSize(DC: HDC; var P: TPoint): Boolean;
|
function TWin32Object.GetDeviceSize(DC: HDC; var P: TPoint): Boolean;
|
||||||
@ -2320,7 +2336,7 @@ End;
|
|||||||
Function TWin32Object.ReleaseDesignerDC(HWnd: HWND; DC: HDC): Integer;
|
Function TWin32Object.ReleaseDesignerDC(HWnd: HWND; DC: HDC): Integer;
|
||||||
Begin
|
Begin
|
||||||
Assert(False, Format('Trace:> [TWin32Object.ReleaseDC] DC:0x%x', [DC]));
|
Assert(False, Format('Trace:> [TWin32Object.ReleaseDC] DC:0x%x', [DC]));
|
||||||
Result := Windows.ReleaseDC(0, DC);
|
Result := Windows.ReleaseDC(HWnd, DC);
|
||||||
Assert(False, Format('Trace:< [TWin32Object.ReleaseDC] DC:0x%x', [DC]));
|
Assert(False, Format('Trace:< [TWin32Object.ReleaseDC] DC:0x%x', [DC]));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -2887,6 +2903,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.92 2004/01/12 08:20:50 micha
|
||||||
|
implement overlay window for designer
|
||||||
|
|
||||||
Revision 1.91 2004/01/03 21:06:06 micha
|
Revision 1.91 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
|
||||||
|
Loading…
Reference in New Issue
Block a user