mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-21 23:31:43 +02:00
LCL-CustomDrawn-Win: Implements GetAppHandle which fixes the showing of the taskbar
git-svn-id: trunk@36161 -
This commit is contained in:
parent
0d478ae9db
commit
fee90e1913
@ -217,8 +217,8 @@ type
|
||||
//
|
||||
protected
|
||||
{function CreateThemeServices: TThemeServices; override;}
|
||||
{function GetAppHandle: THandle; override;
|
||||
procedure SetAppHandle(const AValue: THandle); override;}
|
||||
function GetAppHandle: THandle; override; //BackendSpecific
|
||||
//procedure SetAppHandle(const AValue: THandle); override;
|
||||
//
|
||||
procedure BackendCreate;
|
||||
procedure BackendDestroy;
|
||||
|
@ -720,6 +720,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCDWidgetSet.GetAppHandle: THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWidgetSet.Create
|
||||
Params: None
|
||||
|
@ -24,6 +24,11 @@
|
||||
|
||||
{ TCDWidgetSet }
|
||||
|
||||
function TCDWidgetSet.GetAppHandle: THandle; override;
|
||||
begin
|
||||
Result := THandle(NSApp);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWidgetSet.AppInit
|
||||
Params: ScreenInfo
|
||||
|
@ -85,6 +85,11 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function TCDWidgetSet.GetAppHandle: THandle;
|
||||
begin
|
||||
Result := FAppHandle;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCDWidgetSet.Create
|
||||
Params: None
|
||||
|
@ -423,6 +423,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCDWidgetSet.GetAppHandle: THandle;
|
||||
begin
|
||||
Result := THandle(FDisplay);
|
||||
end;
|
||||
|
||||
(*
|
||||
procedure TWinCEWidgetSet.CheckPipeEvents;
|
||||
var
|
||||
|
@ -624,13 +624,38 @@ end;
|
||||
|
||||
class procedure TCDWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||
const AValue: TShowInTaskbar);
|
||||
var
|
||||
OldStyle, NewStyle: DWord;
|
||||
Visible, Active: Boolean;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
|
||||
Exit;
|
||||
if (Application <> nil) and (AForm = Application.MainForm) then
|
||||
if Assigned(Application) and (AForm = Application.MainForm) then
|
||||
Exit;
|
||||
|
||||
RecreateWnd(AForm);
|
||||
OldStyle := GetWindowLong(AForm.Handle, GWL_EXSTYLE);
|
||||
NewStyle := OldStyle;
|
||||
if AValue = stAlways then
|
||||
NewStyle := NewStyle or WS_EX_APPWINDOW
|
||||
else
|
||||
NewStyle := NewStyle and not WS_EX_APPWINDOW;
|
||||
if OldStyle = NewStyle then exit;
|
||||
|
||||
// to apply this changes we need either to hide window or recreate it. Hide is
|
||||
// less difficult
|
||||
Visible := IsWindowVisible(AForm.Handle);
|
||||
Active := GetForegroundWindow = AForm.Handle;
|
||||
if Visible then
|
||||
ShowWindow(AForm.Handle, SW_HIDE);
|
||||
|
||||
SetWindowLong(AForm.Handle, GWL_EXSTYLE, NewStyle);
|
||||
|
||||
// now we need to restore window visibility with saving focus
|
||||
if Visible then
|
||||
if Active then
|
||||
ShowWindow(AForm.Handle, SW_SHOW)
|
||||
else
|
||||
ShowWindow(AForm.Handle, SW_SHOWNA);
|
||||
end;
|
||||
|
||||
class procedure TCDWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
||||
|
Loading…
Reference in New Issue
Block a user