LCL-CustomDrawn-Win: Implements GetAppHandle which fixes the showing of the taskbar

git-svn-id: trunk@36161 -
This commit is contained in:
sekelsenmat 2012-03-19 08:51:53 +00:00
parent 0d478ae9db
commit fee90e1913
6 changed files with 49 additions and 4 deletions

View File

@ -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;

View File

@ -720,6 +720,11 @@ begin
end;
end;
function TCDWidgetSet.GetAppHandle: THandle;
begin
Result := 0;
end;
{------------------------------------------------------------------------------
Method: TCDWidgetSet.Create
Params: None

View File

@ -24,6 +24,11 @@
{ TCDWidgetSet }
function TCDWidgetSet.GetAppHandle: THandle; override;
begin
Result := THandle(NSApp);
end;
{------------------------------------------------------------------------------
Method: TCDWidgetSet.AppInit
Params: ScreenInfo

View File

@ -85,6 +85,11 @@ begin
{$endif}
end;
function TCDWidgetSet.GetAppHandle: THandle;
begin
Result := FAppHandle;
end;
{------------------------------------------------------------------------------
Method: TCDWidgetSet.Create
Params: None

View File

@ -423,6 +423,11 @@ begin
end;
end;
function TCDWidgetSet.GetAppHandle: THandle;
begin
Result := THandle(FDisplay);
end;
(*
procedure TWinCEWidgetSet.CheckPipeEvents;
var

View File

@ -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);