mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 22:00:18 +02:00
Qt,Gtk2: added minimize/restore ability to get consistent behaviour on all platforms. Patch by Flavio Etrusco modified by me for qt. fixes #13919
git-svn-id: trunk@25407 -
This commit is contained in:
parent
dda71573f7
commit
2773d06487
@ -4,7 +4,6 @@ inherited MessagesView: TMessagesView
|
||||
Top = 640
|
||||
Width = 722
|
||||
ActiveControl = MessageTreeView
|
||||
BorderStyle = bsSizeToolWin
|
||||
Caption = 'MessagesView'
|
||||
ClientHeight = 79
|
||||
ClientWidth = 722
|
||||
|
@ -629,6 +629,11 @@ begin
|
||||
end;
|
||||
if OldState <> FWindowState then
|
||||
begin
|
||||
if (OldState = wsMinimized) and (Application.MainForm = Self)
|
||||
and (WidgetSet.GetLCLCapability(lcNeedMininimizeAppWithMainForm) <> LCL_CAPABILITY_NO) then
|
||||
begin
|
||||
Application.Restore;
|
||||
end;
|
||||
if Assigned(OnWindowStateChange) then
|
||||
OnWindowStateChange(Self);
|
||||
end;
|
||||
|
@ -64,6 +64,8 @@ type
|
||||
function LCLPlatform: TLCLPlatform; override;
|
||||
|
||||
procedure AppInit(var ScreenInfo: TScreenInfo); override;
|
||||
procedure AppMinimize; override;
|
||||
procedure AppRestore; override;
|
||||
function AppHandle: THandle; override;
|
||||
|
||||
procedure SetCallbackEx(const AMsg: LongInt; const AGTKObject: PGTKObject; const ALCLObject: TObject; Direct: Boolean);override;
|
||||
|
@ -598,6 +598,38 @@ begin
|
||||
{$ifend}
|
||||
end;
|
||||
|
||||
procedure TGtk2WidgetSet.AppMinimize;
|
||||
var
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
begin
|
||||
if Screen=nil then exit;
|
||||
for i:= 0 to Screen.CustomFormZOrderCount-1 do
|
||||
begin
|
||||
AForm := Screen.CustomFormsZOrdered[i];
|
||||
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||
not (AForm.BorderStyle in [bsNone]) then
|
||||
gtk_window_iconify(PGtkWindow(AForm.Handle));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtk2WidgetSet.AppRestore;
|
||||
var
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
begin
|
||||
if Screen=nil then exit;
|
||||
for i:= Screen.CustomFormZOrderCount-1 downto 0 do
|
||||
begin
|
||||
AForm:=Screen.CustomFormsZOrdered[i];
|
||||
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||
not (AForm.BorderStyle in [bsNone]) then
|
||||
gtk_window_deiconify(PGtkWindow(AForm.Handle));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGtk2WidgetSet.AppHandle: Thandle;
|
||||
begin
|
||||
{$ifdef windows}
|
||||
|
@ -216,15 +216,54 @@ begin
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AppMinimize;
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
for i := 0 to Screen.CustomFormZOrderCount-1 do
|
||||
begin
|
||||
AForm := Screen.CustomFormsZOrdered[i];
|
||||
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||
not (AForm.BorderStyle in [bsNone])
|
||||
then
|
||||
TQtMainWindow(AForm.Handle).ShowMinimized;
|
||||
end;
|
||||
{$ELSE}
|
||||
TQtMainWindow(Application.MainForm.Handle).ShowMinimized;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AppRestore;
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
if Screen = nil then exit;
|
||||
for i := Screen.CustomFormZOrderCount-1 downto 0 do
|
||||
begin
|
||||
AForm := Screen.CustomFormsZOrdered[i];
|
||||
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||
not (AForm.BorderStyle in [bsNone])
|
||||
then
|
||||
TQtMainWindow(AForm.Handle).ShowNormal;
|
||||
end;
|
||||
{$ELSE}
|
||||
TQtMainWindow(Application.MainForm.Handle).ShowNormal;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.AppBringToFront;
|
||||
@ -367,6 +406,8 @@ begin
|
||||
lcCanDrawOutsideOnPaint: Result := LCL_CAPABILITY_NO;
|
||||
lcDragDockStartOnTitleClick: Result :=
|
||||
{$ifdef MSWINDOWS} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
||||
lcNeedMininimizeAppWithMainForm: Result :=
|
||||
{$ifdef LINUX} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
||||
else
|
||||
Result := inherited GetLCLCapability(ACapability);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user