Recent

Author Topic: Win32MenuStyler to theme TMainMenu  (Read 1065 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Win32MenuStyler to theme TMainMenu
« on: September 18, 2020, 05:07:40 pm »
Just created and posted to wiki:
https://wiki.freepascal.org/Win32MenuStyler

It is not much tested yet, so write issues to Github.

lainz

  • Hero Member
  • *****
  • Posts: 3807
  • Leandro Diaz
Re: Win32MenuStyler to theme TMainMenu
« Reply #1 on: September 18, 2020, 05:21:39 pm »
Thanks  :)
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

wp

  • Hero Member
  • *****
  • Posts: 7734
Re: Win32MenuStyler to theme TMainMenu
« Reply #2 on: September 18, 2020, 05:40:38 pm »
Is it really required to have unit Windows in the uses clause? Can't the custom drawing be done based on the MenuItem.OnDrawItem event using standard canvas or LCLIntf routines? This way the MenuStyler could become cross-platform.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #3 on: September 18, 2020, 05:50:22 pm »
But cross-platf version don't work on gtk2. (And must not work on Mac, not tested yet).
I made it- file lazmenustyler.pas in Github.

lainz

  • Hero Member
  • *****
  • Posts: 3807
  • Leandro Diaz
Re: Win32MenuStyler to theme TMainMenu
« Reply #4 on: September 18, 2020, 07:21:00 pm »
There is an option to disable it?
So we can enable/disable according to our theme is default or dark?
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

BeanzMaster

  • Sr. Member
  • ****
  • Posts: 270
Re: Win32MenuStyler to theme TMainMenu
« Reply #5 on: September 18, 2020, 08:20:42 pm »
Hi, cool  ! +1

It would be nice to do a component (in a small package perhaps) with the record as persistent class in it.
It also would be great to have an option or a method to apply the theme to popupmenu  ;)

Best regards

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #6 on: September 18, 2020, 09:32:34 pm »
- Added demo buttons to change the colors
- Added method ApplyToMenu for PopupMenu, demo shows this in action
Quote
to do a component (in a small package perhaps) with the record as persistent class
Code bloating...
« Last Edit: September 18, 2020, 09:34:39 pm by Alextp »

circular

  • Hero Member
  • *****
  • Posts: 3567
    • Personal webpage
Re: Win32MenuStyler to theme TMainMenu
« Reply #7 on: September 18, 2020, 10:31:02 pm »
In LazPaint, I've added an option to toggle dark mode. For the menu I could use your unit, that would only allow to turn it to dark mode, not to go back to normal.

Hence the question
There is an option to disable it?
So we can enable/disable according to our theme is default or dark?

like UnAppyToMenu method.
Conscience is the debugger of the mind

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #8 on: September 18, 2020, 11:01:43 pm »
Just added methods
- ResetMenu()
- ResetForm()

circular

  • Hero Member
  • *****
  • Posts: 3567
    • Personal webpage
Re: Win32MenuStyler to theme TMainMenu
« Reply #9 on: September 18, 2020, 11:16:58 pm »
Cool.

What about the SetMenuInfo, does it need to be cancelled or it doesn't have any effect afterwards?
Conscience is the debugger of the mind

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #10 on: September 18, 2020, 11:28:17 pm »
New Reset* methods do reset of SetMenuInfo color.

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #11 on: September 20, 2020, 11:37:00 am »

lainz

  • Hero Member
  • *****
  • Posts: 3807
  • Leandro Diaz
Re: Win32MenuStyler to theme TMainMenu
« Reply #12 on: October 12, 2020, 08:33:46 pm »
A final question. How it looks on Windows 7? If someone have that OS please show a screenshot.
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Win32MenuStyler to theme TMainMenu
« Reply #13 on: October 12, 2020, 08:38:56 pm »
AFAIK it works on Win7 like on all other Win32 OSes. It also works on Ubuntu on Wine.

 

TinyPortal © 2005-2018