ADD: Highlight active tab (issue #1351)

(cherry picked from commit 6429138092)
This commit is contained in:
Alexander Koblov 2023-12-15 21:45:02 +03:00
commit d3ec32c29a

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
This unit contains TFileViewPage and TFileViewNotebook objects.
Copyright (C) 2016-2022 Alexander Koblov (alexx2000@mail.ru)
Copyright (C) 2016-2023 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -138,6 +138,9 @@ type
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
{$IF DEFINED(LCLWIN32)}
procedure PaintWindow(DC: HDC); override;
{$ENDIF}
public
constructor Create(ParentControl: TWinControl;
@ -193,7 +196,8 @@ uses
{$IF DEFINED(LCLGTK2)}
, Glib2, Gtk2
{$ELSEIF DEFINED(LCLWIN32)}
, Win32Proc
, Win32Proc, Win32Themes, UxTheme, Graphics
, Themes {$IF DEFINED(DARKWIN)}, uDarkStyle {$ENDIF}
{$ENDIF}
{$IF DEFINED(MSWINDOWS)}
, Windows, Messages
@ -548,6 +552,25 @@ begin
Message.Result := 1;
end;
{$IF DEFINED(LCLWIN32)}
procedure TFileViewNotebook.PaintWindow(DC: HDC);
var
ARect: TRect;
begin
inherited PaintWindow(DC);
{$IF DEFINED(DARKWIN)}
if g_darkModeEnabled then Exit;
{$ENDIF}
if (Win32MajorVersion >= 10) and (PageIndex > -1) then
begin
ARect:= TabRect(PageIndex);
IntersectClipRect(DC, ARect.Left, ARect.Top, ARect.Right, ARect.Top + 2);
InflateRect(ARect, ScaleX(8, 96), 0);
DrawThemeBackground(TWin32ThemeServices(ThemeServices).Theme[teToolBar], DC, TP_BUTTON, TS_CHECKED, ARect, nil);
end;
end;
{$ENDIF}
procedure TFileViewNotebook.DestroyAllPages;
var
i: Integer;
@ -792,6 +815,11 @@ procedure TFileViewNotebook.DoChange;
begin
inherited DoChange;
ActivePage.DoActivate;
{$IF DEFINED(LCLWIN32)}
if (Win32MajorVersion >= 10)
{$IF DEFINED(DARKWIN)} and (not g_darkModeEnabled){$ENDIF} then
Invalidate;
{$ENDIF}
end;
function TFileViewNotebook.GetPageClass: TCustomPageClass;