mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 20:42:05 +02:00
win32: implement dock image using alpha-transparent window for windows >= vista (issue #0016782)
git-svn-id: trunk@26309 -
This commit is contained in:
parent
1ad23b7d4a
commit
7ddd34c18c
@ -79,7 +79,9 @@ var
|
||||
GetMenuBarInfo: function(hwnd: HWND; idObject: LONG; idItem: LONG; pmbi: PMENUBARINFO): BOOL; stdcall;
|
||||
GetWindowInfo: function(hwnd: HWND; pwi: PWINDOWINFO): BOOL; stdcall;
|
||||
SetLayout: function(dc: HDC; l: DWord): DWord; stdcall;
|
||||
SetLayeredWindowAttributes: function (HWND:hwnd;crKey :COLORREF;bAlpha : byte;dwFlags : DWORD):WINBOOL; stdcall;
|
||||
SetLayeredWindowAttributes: function (HWND: hwnd; crKey: COLORREF; bAlpha: byte; dwFlags: DWORD): BOOL; stdcall;
|
||||
UpdateLayeredWindow: function(hWnd: HWND; hdcDst: HDC; pptDst: PPoint; psize: PSize;
|
||||
hdcSrc: HDC; pptSrc: PPoint; crKey: COLORREF; pblend: PBlendFunction; dwFlags: DWORD): BOOL; stdcall;
|
||||
|
||||
const
|
||||
// ComCtlVersions
|
||||
@ -546,7 +548,13 @@ begin
|
||||
Result := GDI_ERROR;
|
||||
end;
|
||||
|
||||
function _SetLayeredWindowAttributes(HWND:hwnd;crKey :COLORREF;bAlpha : byte;dwFlags : DWORD):WINBOOL; stdcall;
|
||||
function _SetLayeredWindowAttributes(HWND: hwnd; crKey: COLORREF; bAlpha: byte; dwFlags: DWORD): BOOL; stdcall;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function _UpdateLayeredWindow(hWnd: HWND; hdcDst: HDC; pptDst: PPoint; psize: PSize;
|
||||
hdcSrc: HDC; pptSrc: PPoint; crKey: COLORREF; pblend: PBlendFunction; dwFlags: DWORD): BOOL; stdcall;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
@ -602,6 +610,7 @@ begin
|
||||
Pointer(GetMenuBarInfo) := @_GetMenuBarInfo;
|
||||
Pointer(GetWindowInfo) := @_GetWindowInfo;
|
||||
Pointer(SetLayeredWindowAttributes) := @_SetLayeredWindowAttributes;
|
||||
Pointer(UpdateLayeredWindow) := @_UpdateLayeredWindow;
|
||||
|
||||
user32handle := LoadLibrary(user32lib);
|
||||
if user32handle <> 0 then
|
||||
@ -621,6 +630,10 @@ begin
|
||||
p := GetProcAddress(user32handle, 'SetLayeredWindowAttributes');
|
||||
if p <> nil
|
||||
then Pointer(SetLayeredWindowAttributes) := p;
|
||||
|
||||
p := GetProcAddress(user32handle, 'UpdateLayeredWindow');
|
||||
if p <> nil
|
||||
then Pointer(UpdateLayeredWindow) := p;
|
||||
end;
|
||||
|
||||
// Defaults
|
||||
|
@ -122,7 +122,8 @@ type
|
||||
// The parent of all windows, represents the button of the taskbar
|
||||
// This window is also the owner of the clipboard.
|
||||
// Assoc. windowproc also acts as handler for popup menus
|
||||
FAppHandle: HWND;
|
||||
FAppHandle,
|
||||
FDockWndHandle: HWND;
|
||||
FCommonControlsVersion: DWord;
|
||||
|
||||
FMetrics: TNonClientMetrics;
|
||||
|
@ -331,10 +331,30 @@ const
|
||||
end;
|
||||
|
||||
begin
|
||||
if AOperation in [disMove, disHide] then
|
||||
DefaultDockImage(AOldRect);
|
||||
if AOperation in [disMove, disShow] then
|
||||
DefaultDockImage(ANewRect);
|
||||
if WindowsVersion >= wvVista then
|
||||
begin
|
||||
case AOperation of
|
||||
disShow:
|
||||
begin
|
||||
FDockWndHandle := CreateWindowEx(WS_EX_LAYERED or WS_EX_TRANSPARENT or WS_EX_TOPMOST or WS_EX_TOOLWINDOW,
|
||||
ClsName, 'LazDockWnd', WS_POPUP or WS_VISIBLE,
|
||||
ANewRect.Left, ANewRect.Top, ANewRect.Right - ANewRect.Left, ANewRect.Bottom - ANewRect.Top, 0, 0, HINSTANCE, nil);
|
||||
|
||||
SetLayeredWindowAttributes(FDockWndHandle, 0, $30, LWA_ALPHA);
|
||||
end;
|
||||
disHide: DestroyWindow(FDockWndHandle);
|
||||
disMove:
|
||||
with ANewRect do
|
||||
SetWindowPos(FDockWndHandle, 0, Left, Top, Right - Left, Bottom - Top, SWP_NOZORDER or SWP_NOACTIVATE);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if AOperation in [disMove, disHide] then
|
||||
DefaultDockImage(AOldRect);
|
||||
if AOperation in [disMove, disShow] then
|
||||
DefaultDockImage(ANewRect);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWin32WidgetSet.DrawGrid(DC: HDC; const R: TRect; DX, DY: Integer);
|
||||
|
Loading…
Reference in New Issue
Block a user