Sign in Join
Wiki copytemporary

Win32MenuStyler

(Windows only)

About

This is unit win32menustyler, which helps to theme TMainMenu/TPopupMenu 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

Detailed info

What it paints for menu items:

What is not supported:

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.

Usage

Unit gives global var to change all theming details:

pascal
type
  TWin32MenuStylerTheme = record
    ColorBk: TColor;
    ColorBkSelected: TColor;
    ColorBkSelectedDisabled: TColor; //used only if <>clNone
    ColorSelBorder: TColor; //used only if <>clNone
    ColorFont: TColor;
    ColorFontSelected: TColor; //used only if <>clNone
    ColorFontDisabled: TColor;
    ColorFontShortcut: TColor;
    CharCheckmark: WideChar;
    CharRadiomark: WideChar;
    CharSubmenu: WideChar;
    FontName: string;
    FontSize: integer;
    //indents in percents of average char width
    IndentMinPercents: integer; //indent from edges to separator line
    IndentBigPercents: integer; //indent from left edge to caption
    IndentIconPercents: integer; //indents around the icon
    IndentRightPercents: integer; //indent from right edge to end of shortcut text
    IndentSubmenuArrowPercents: integer; //indent from right edge to submenu '>' char
  end;

var
  MenuStylerTheme: TWin32MenuStylerTheme;

Download

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


From the Free Pascal wiki, page "Win32MenuStyler", as it stood on 2022-06-08 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.