mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-23 19:26:07 +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;
|
||||
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;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -352,6 +352,7 @@ begin
|
||||
else
|
||||
begin
|
||||
inherited SetVisible(Value);
|
||||
Application.UpdateVisible;
|
||||
end;
|
||||
//DebugLn(['[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',Visible]);
|
||||
end;
|
||||
|
@ -55,7 +55,10 @@ end;
|
||||
|
||||
procedure TWidgetSet.AppSetTitle(const ATitle: string);
|
||||
begin
|
||||
Debugln('TWidgetSet.AppSetTitle is not implemented by ', ClassName);
|
||||
end;
|
||||
|
||||
procedure TWidgetSet.AppSetVisible(const AVisible: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
function TWidgetSet.GetLCLCapability(ACapability: TLCLCapability): PtrUInt;
|
||||
|
@ -409,13 +409,14 @@ var
|
||||
begin
|
||||
FCustomForms.Add(AForm);
|
||||
FCustomFormsZOrdered.Add(AForm);
|
||||
if AForm is TForm then begin
|
||||
if AForm is TForm then
|
||||
begin
|
||||
FFormList.Add(AForm);
|
||||
Application.UpdateVisible;
|
||||
end;
|
||||
i:=FScreenHandlers[snFormAdded].Count;
|
||||
i := FScreenHandlers[snFormAdded].Count;
|
||||
while FScreenHandlers[snFormAdded].NextDownIndex(i) do
|
||||
TScreenFormEvent(FScreenHandlers[snFormAdded][i])(Self,AForm);
|
||||
TScreenFormEvent(FScreenHandlers[snFormAdded][i])(Self, AForm);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -493,9 +494,9 @@ procedure TScreen.RemoveForm(AForm: TCustomForm);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i:=FScreenHandlers[snRemoveForm].Count;
|
||||
i := FScreenHandlers[snRemoveForm].Count;
|
||||
while FScreenHandlers[snRemoveForm].NextDownIndex(i) do
|
||||
TScreenFormEvent(FScreenHandlers[snRemoveForm][i])(Self,AForm);
|
||||
TScreenFormEvent(FScreenHandlers[snRemoveForm][i])(Self, AForm);
|
||||
FCustomForms.Remove(AForm);
|
||||
FCustomFormsZOrdered.Remove(AForm);
|
||||
FFormList.Remove(AForm);
|
||||
|
@ -98,6 +98,7 @@ type
|
||||
procedure AppBringToFront; virtual; abstract;
|
||||
procedure AppSetIcon(const Small, Big: HICON); virtual;
|
||||
procedure AppSetTitle(const ATitle: string); virtual;
|
||||
procedure AppSetVisible(const AVisible: Boolean); virtual;
|
||||
|
||||
function LCLPlatform: TLCLPlatform; virtual; abstract;
|
||||
function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; virtual;
|
||||
|
@ -187,6 +187,7 @@ type
|
||||
procedure AppTerminate; override;
|
||||
procedure AppSetIcon(const Small, Big: HICON); override;
|
||||
procedure AppSetTitle(const ATitle: string); override;
|
||||
procedure AppSetVisible(const AVisible: Boolean); override;
|
||||
|
||||
function InitHintFont(HintFont: TObject): Boolean; Override;
|
||||
procedure AttachMenuToWindow(AMenuObject: TComponent); Override;
|
||||
|
@ -440,6 +440,14 @@ begin
|
||||
{$endif}
|
||||
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;
|
||||
begin
|
||||
Result:= lpWin32;
|
||||
|
Loading…
Reference in New Issue
Block a user