From df6adcbeddabd8bb3642e0629f7629d8e2a937d2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Mar 2024 01:24:22 +0100 Subject: [PATCH] Avoid showing bogus tooltips in macOS wxDataViewCtrl Cells using custom renderers showed useless tooltips with the debug representation of wxCustomRendererObject, which were worse than useless, so avoid showing them. Contrary to what might be expected, this can't be done by overriding the specific tooltip-related delegate method, because these tooltips come from NSTextFieldCell itself, so we need to prevent it from showing them. Closes #24370. --- src/osx/cocoa/dataview.mm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 37c82e49a2..ab274191cc 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -1111,6 +1111,20 @@ outlineView:(NSOutlineView*)outlineView return cellFrame; } +-(NSRect)expansionFrameWithFrame:(NSRect)cellFrame + inView:(NSView*)view +{ + // We override the default behaviour to avoid showing nonsensical tooltips + // for the custom cells: if we don't do this, NSTextFieldCell would show a + // tooltip with the debug representation of wxCustomRendererObject which is + // not very useful. + // + // Note: override outlineView:toolTipForCell:rect:tableColumn:item:mouseLocation: + // in NSOutlineViewDelegate if we ever want to support per-cell tooltips + // instead of just suppressing them. + return NSZeroRect; +} + @end // ============================================================================