Bug 576680

Summary: Owner-drawn Table/Tree: provide flag for drawing rollover tooltip
Product: [Eclipse Project] Platform Reporter: Thomas Singer <ts-swt>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: alexandr.miloslavskiy, ts-swt, twolf
Version: 4.22   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Thomas Singer CLA 2021-10-17 09:43:57 EDT
If a table cell is too short or a tree cell wider than the visible area, Windows draws a "tooltip" for the whole content. Side note: a selected cell is drawn unselected. From the flags that are passed to the EraseItem or PaintItem event listener it is not clear at all whether the cell is painted in the tree/table or in the tooltip/overlay. My request is to add such a flag.
Comment 1 Thomas Wolf CLA 2021-10-17 10:10:42 EDT
I ran into this in the EGit StagingView recently. See [1].

My findings were that the GC in the paint listener is clipped when drawing in the table, and is not clipped when drawing in that native hover. So I used

  tree.addListener(SWT.PaintItem, event -> {
    boolean inHover = !event.gc.isClipped();
    // Do whatever needs to be done, depending on inHover
  }

[1] https://git.eclipse.org/r/c/egit/egit/+/182394
Comment 2 Thomas Singer CLA 2021-10-18 08:39:12 EDT
Hi Thomas,

Thanks for this hint. It looks like this rollover tooltip only exists on Windows, so it probably makes not much sense to implement that globally.
Comment 3 Thomas Wolf CLA 2021-10-18 09:40:30 EDT
On OS X there is such a hover, too.
Comment 4 Thomas Singer CLA 2021-10-18 09:54:01 EDT
Err, you are right. I was not waiting long enough.