mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-25 07:18:08 +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
|
protected
|
||||||
{function CreateThemeServices: TThemeServices; override;}
|
{function CreateThemeServices: TThemeServices; override;}
|
||||||
{function GetAppHandle: THandle; override;
|
function GetAppHandle: THandle; override; //BackendSpecific
|
||||||
procedure SetAppHandle(const AValue: THandle); override;}
|
//procedure SetAppHandle(const AValue: THandle); override;
|
||||||
//
|
//
|
||||||
procedure BackendCreate;
|
procedure BackendCreate;
|
||||||
procedure BackendDestroy;
|
procedure BackendDestroy;
|
||||||
|
|||||||
@ -720,6 +720,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAppHandle: THandle;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCDWidgetSet.Create
|
Method: TCDWidgetSet.Create
|
||||||
Params: None
|
Params: None
|
||||||
|
|||||||
@ -24,6 +24,11 @@
|
|||||||
|
|
||||||
{ TCDWidgetSet }
|
{ TCDWidgetSet }
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAppHandle: THandle; override;
|
||||||
|
begin
|
||||||
|
Result := THandle(NSApp);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCDWidgetSet.AppInit
|
Method: TCDWidgetSet.AppInit
|
||||||
Params: ScreenInfo
|
Params: ScreenInfo
|
||||||
|
|||||||
@ -85,6 +85,11 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAppHandle: THandle;
|
||||||
|
begin
|
||||||
|
Result := FAppHandle;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCDWidgetSet.Create
|
Method: TCDWidgetSet.Create
|
||||||
Params: None
|
Params: None
|
||||||
|
|||||||
@ -423,6 +423,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDWidgetSet.GetAppHandle: THandle;
|
||||||
|
begin
|
||||||
|
Result := THandle(FDisplay);
|
||||||
|
end;
|
||||||
|
|
||||||
(*
|
(*
|
||||||
procedure TWinCEWidgetSet.CheckPipeEvents;
|
procedure TWinCEWidgetSet.CheckPipeEvents;
|
||||||
var
|
var
|
||||||
|
|||||||
@ -624,13 +624,38 @@ end;
|
|||||||
|
|
||||||
class procedure TCDWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
class procedure TCDWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
|
||||||
const AValue: TShowInTaskbar);
|
const AValue: TShowInTaskbar);
|
||||||
|
var
|
||||||
|
OldStyle, NewStyle: DWord;
|
||||||
|
Visible, Active: Boolean;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
|
if not WSCheckHandleAllocated(AForm, 'SetShowInTaskbar') then
|
||||||
Exit;
|
Exit;
|
||||||
if (Application <> nil) and (AForm = Application.MainForm) then
|
if Assigned(Application) and (AForm = Application.MainForm) then
|
||||||
Exit;
|
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;
|
end;
|
||||||
|
|
||||||
class procedure TCDWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
class procedure TCDWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user