Fix to make tree buttons use the right colour on OS X (PR #26004)

24 views
Skip to first unread message

RobertRoeb

unread,
Nov 30, 2025, 12:02:30 PM (2 days ago) Nov 30
to wx-...@googlegroups.com, Subscribed
  • This may not be the right fix, but I am not sure if changing wxRendererNative is right and what the consequences would be of changing ApplyMacControlFlags() in wxRenderer. This change only affects the tree button on OSX and it now looks correct in light and dark mode.

You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26004

Commit Summary

  • 1e9210e Fix to make tree buttons visible on OS X

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004@github.com>

VZ

unread,
Nov 30, 2025, 12:46:41 PM (2 days ago) Nov 30
to wx-...@googlegroups.com, Subscribed

@vadz requested changes on this pull request.

It's a pity to have to do this because wxRendererNative was created specifically in order to avoid platform-specific code in generic controls.

If the result of DrawTreeItemButton() without this flag is invisible (in some mode only?), then I really think it should use it by default. This would also fix wxPropertyGrid::DrawExpanderButton() which is presumably broken in the same way currently.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004/review/3521896118@github.com>

RobertRoeb

unread,
Nov 30, 2025, 3:18:48 PM (2 days ago) Nov 30
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#26004)

It is too bright in normal/light mode. Barely visible, but it is obviously wrong. There should be a cleaner way to alter wxRendererNative- that is what it us made for. But that code is hard to read. I don't know in which other cases ApplyMacControlFlags() is used. Maybe I can make it less ugly


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004/c3593282657@github.com>

VZ

unread,
Nov 30, 2025, 5:46:20 PM (2 days ago) Nov 30
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26004)

It is too bright in normal/light mode. Barely visible, but it is obviously wrong.

So you're saying that wxRendererMac::DrawTreeItemButton() is wrong and hence needs to be fixed.

There should be a cleaner way to alter wxRendererNative- that is what it us made for. But that code is hard to read. I don't know in which other cases ApplyMacControlFlags() is used. Maybe I can make it less ugly

Maybe, but in the meanwhile just doing

diff --git a/src/osx/cocoa/renderer.mm b/src/osx/cocoa/renderer.mm
index 666a0ac11a..2b385aac26 100644
--- a/src/osx/cocoa/renderer.mm
+++ b/src/osx/cocoa/renderer.mm
@@ -422,7 +422,7 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win,
     {
 #if wxOSX_USE_NSCELL_RENDERER
         NSControlStateValue stateValue = (flags & wxCONTROL_EXPANDED) ? NSControlStateValueOn : NSControlStateValueOff;
-        DrawMacCell(win, dc, GetDisclosureButtonCell(), rect, flags, stateValue);
+        DrawMacCell(win, dc, GetDisclosureButtonCell(), rect, flags | wxCONTROL_PRESSED, stateValue);
 #else
         // now the wxGCDC is using native transformations
         const wxCoord x = rect.x;

should be better than this PR AFAICS (with an appropriate comment explaining why we turn it on), shouldn't it?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004/c3593719765@github.com>

RobertRoeb

unread,
Dec 1, 2025, 4:01:15 AM (yesterday) Dec 1
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#26004)

Yes, I just came up with the same solution and that works


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004/c3595369020@github.com>

RobertRoeb

unread,
Dec 1, 2025, 4:03:54 AM (yesterday) Dec 1
to wx-...@googlegroups.com, Push

@RobertRoeb pushed 2 commits.

  • 1490f97 Remove white space
  • a8302dc Moved code to wxRendererNative::DrawTreeItemButton


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26004/before/1e9210e3e4c6b1db9c8368b5eea43587c4e6ad5d/after/a8302dc18c34dcd0298db46c7558471ffdd65348@github.com>

Reply all
Reply to author
Forward
0 new messages