mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 06:35:59 +02:00
lcl: implement TApplication.UpdateVisible, add TWidgetset.AppSetVisible (defined only for win32 at moment) (mantis #0010544)
git-svn-id: trunk@18403 -
This commit is contained in:
parent
40a9bce6a9
commit
fefaf6be1a
@ -824,8 +824,24 @@ end;
|
|||||||
procedure TApplication.UpdateVisible;
|
procedure TApplication.UpdateVisible;
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TApplication.UpdateVisible;
|
procedure TApplication.UpdateVisible;
|
||||||
begin
|
|
||||||
|
|
||||||
|
function HasVisibleForms: Boolean;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
for i := 0 to Screen.CustomFormCount - 1 do
|
||||||
|
if Screen.CustomForms[i].Visible and (Screen.CustomForms[i].Parent = nil) then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// if there are visible forms then application task bar item must be visible too
|
||||||
|
// else hide it
|
||||||
|
WidgetSet.AppSetVisible(HasVisibleForms);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -352,6 +352,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
inherited SetVisible(Value);
|
inherited SetVisible(Value);
|
||||||
|
Application.UpdateVisible;
|
||||||
end;
|
end;
|
||||||
//DebugLn(['[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',Visible]);
|
//DebugLn(['[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',Visible]);
|
||||||
end;
|
end;
|
||||||
|
@ -55,7 +55,10 @@ end;
|
|||||||
|
|
||||||
procedure TWidgetSet.AppSetTitle(const ATitle: string);
|
procedure TWidgetSet.AppSetTitle(const ATitle: string);
|
||||||
begin
|
begin
|
||||||
Debugln('TWidgetSet.AppSetTitle is not implemented by ', ClassName);
|
end;
|
||||||
|
|
||||||
|
procedure TWidgetSet.AppSetVisible(const AVisible: Boolean);
|
||||||
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWidgetSet.GetLCLCapability(ACapability: TLCLCapability): PtrUInt;
|
function TWidgetSet.GetLCLCapability(ACapability: TLCLCapability): PtrUInt;
|
||||||
|
@ -409,13 +409,14 @@ var
|
|||||||
begin
|
begin
|
||||||
FCustomForms.Add(AForm);
|
FCustomForms.Add(AForm);
|
||||||
FCustomFormsZOrdered.Add(AForm);
|
FCustomFormsZOrdered.Add(AForm);
|
||||||
if AForm is TForm then begin
|
if AForm is TForm then
|
||||||
|
begin
|
||||||
FFormList.Add(AForm);
|
FFormList.Add(AForm);
|
||||||
Application.UpdateVisible;
|
Application.UpdateVisible;
|
||||||
end;
|
end;
|
||||||
i:=FScreenHandlers[snFormAdded].Count;
|
i := FScreenHandlers[snFormAdded].Count;
|
||||||
while FScreenHandlers[snFormAdded].NextDownIndex(i) do
|
while FScreenHandlers[snFormAdded].NextDownIndex(i) do
|
||||||
TScreenFormEvent(FScreenHandlers[snFormAdded][i])(Self,AForm);
|
TScreenFormEvent(FScreenHandlers[snFormAdded][i])(Self, AForm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -493,9 +494,9 @@ procedure TScreen.RemoveForm(AForm: TCustomForm);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
i:=FScreenHandlers[snRemoveForm].Count;
|
i := FScreenHandlers[snRemoveForm].Count;
|
||||||
while FScreenHandlers[snRemoveForm].NextDownIndex(i) do
|
while FScreenHandlers[snRemoveForm].NextDownIndex(i) do
|
||||||
TScreenFormEvent(FScreenHandlers[snRemoveForm][i])(Self,AForm);
|
TScreenFormEvent(FScreenHandlers[snRemoveForm][i])(Self, AForm);
|
||||||
FCustomForms.Remove(AForm);
|
FCustomForms.Remove(AForm);
|
||||||
FCustomFormsZOrdered.Remove(AForm);
|
FCustomFormsZOrdered.Remove(AForm);
|
||||||
FFormList.Remove(AForm);
|
FFormList.Remove(AForm);
|
||||||
|
@ -98,6 +98,7 @@ type
|
|||||||
procedure AppBringToFront; virtual; abstract;
|
procedure AppBringToFront; virtual; abstract;
|
||||||
procedure AppSetIcon(const Small, Big: HICON); virtual;
|
procedure AppSetIcon(const Small, Big: HICON); virtual;
|
||||||
procedure AppSetTitle(const ATitle: string); virtual;
|
procedure AppSetTitle(const ATitle: string); virtual;
|
||||||
|
procedure AppSetVisible(const AVisible: Boolean); virtual;
|
||||||
|
|
||||||
function LCLPlatform: TLCLPlatform; virtual; abstract;
|
function LCLPlatform: TLCLPlatform; virtual; abstract;
|
||||||
function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; virtual;
|
function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; virtual;
|
||||||
|
@ -187,6 +187,7 @@ type
|
|||||||
procedure AppTerminate; override;
|
procedure AppTerminate; override;
|
||||||
procedure AppSetIcon(const Small, Big: HICON); override;
|
procedure AppSetIcon(const Small, Big: HICON); override;
|
||||||
procedure AppSetTitle(const ATitle: string); override;
|
procedure AppSetTitle(const ATitle: string); override;
|
||||||
|
procedure AppSetVisible(const AVisible: Boolean); override;
|
||||||
|
|
||||||
function InitHintFont(HintFont: TObject): Boolean; Override;
|
function InitHintFont(HintFont: TObject): Boolean; Override;
|
||||||
procedure AttachMenuToWindow(AMenuObject: TComponent); Override;
|
procedure AttachMenuToWindow(AMenuObject: TComponent); Override;
|
||||||
|
@ -440,6 +440,14 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWin32WidgetSet.AppSetVisible(const AVisible: Boolean);
|
||||||
|
begin
|
||||||
|
if AVisible then
|
||||||
|
ShowWindow(FAppHandle, SW_SHOW)
|
||||||
|
else
|
||||||
|
ShowWindow(FAppHandle, SW_HIDE);
|
||||||
|
end;
|
||||||
|
|
||||||
function TWin32WidgetSet.LCLPlatform: TLCLPlatform;
|
function TWin32WidgetSet.LCLPlatform: TLCLPlatform;
|
||||||
begin
|
begin
|
||||||
Result:= lpWin32;
|
Result:= lpWin32;
|
||||||
|
Loading…
Reference in New Issue
Block a user