Difference between revisions of "Win32MenuStyler"
From Free Pascal wiki
Jump to navigationJump to search (→About) |
(→About) |
||
Line 4: | Line 4: | ||
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. | ||
− | About other OS | + | About other OS: GitHub repo has cross-platform "lazmenustyler" unit, but it don't give any effect on gtk2 demo app. And it should not work on macOS, macOS has very special theming and menu is located on the screen top. |
[[File:win32menustyler.png]] | [[File:win32menustyler.png]] |
Revision as of 18:03, 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.
About other OS: GitHub repo has cross-platform "lazmenustyler" unit, but it don't give any effect on gtk2 demo app. And it should not work on macOS, macOS has very special theming and menu is located on the screen top.
Author: Alexey Torgashin
License: MPL 2.0 or LGPL
Usage
- add "uses win32menustyler"
- in form's OnCreate, call this to theme form's MainMenu:
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;