Difference between revisions of "Win32MenuStyler"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "=About= This is helper unit win32menustyler, which helper to theme TMainMenu for Lazarus Windows apps. Sometimes app has dark theme, so it's needed to make TMainMenu also dar...")
 
Line 1: Line 1:
 
=About=
 
=About=
  
This is helper unit win32menustyler, which helper to theme TMainMenu for Lazarus Windows apps.
+
This is helper unit win32menustyler, which helps to theme TMainMenu for Lazarus Windows apps.
 
Sometimes app has dark theme, so it's needed to make TMainMenu also dark.
 
Sometimes app has dark theme, so it's needed to make TMainMenu also dark.
  
Usage:
+
Author: Alexey Torgashin
 +
 
 +
License: MPL 2.0 or LGPL
 +
 
 +
=Usage=
  
 
* add "uses win32menustyler"
 
* add "uses win32menustyler"
Line 15: Line 19:
 
end;
 
end;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Unit gives global var to change all theming details:
 +
 +
<syntaxhighlight lang="pascal">
 +
type
 +
  TWin32MenuStylerTheme = record
 +
    ColorBk: TColor;
 +
    ColorBkSelected: TColor;
 +
    ColorFont: TColor;
 +
    ColorFontDisabled: TColor;
 +
    CharCheckmark: Widechar;
 +
    CharRadiomark: Widechar;
 +
    FontName: string;
 +
    FontSize: integer;
 +
    IndentX: integer;
 +
    IndentX2: integer;
 +
    IndentY: integer;
 +
  end;
 +
var
 +
  MenuStylerTheme: TWin32MenuStylerTheme;
 +
</syntaxhighlight>
 +
 +
=Download=
 +
 +
GitHub: https://github.com/Alexey-T/Win32MenuStyler

Revision as of 16:46, 18 September 2020

About

This is helper unit win32menustyler, which helps to theme TMainMenu for Lazarus Windows apps. Sometimes app has dark theme, so it's needed to make TMainMenu also dark.

Author: Alexey Torgashin

License: MPL 2.0 or LGPL

Usage

  • add "uses win32menustyler"
  • in form's OnCreate, call
procedure TForm1.FormCreate(Sender: TObject);
begin
  MenuStyler.ApplyToForm(Self);
end;

Unit gives global var to change all theming details:

type
  TWin32MenuStylerTheme = record
    ColorBk: TColor;
    ColorBkSelected: TColor;
    ColorFont: TColor;
    ColorFontDisabled: TColor;
    CharCheckmark: Widechar;
    CharRadiomark: Widechar;
    FontName: string;
    FontSize: integer;
    IndentX: integer;
    IndentX2: integer;
    IndentY: integer;
  end;
var
  MenuStylerTheme: TWin32MenuStylerTheme;

Download

GitHub: https://github.com/Alexey-T/Win32MenuStyler