Bug 562043 - [Win32][Dark Theme] Tables have no selection nor hover highlights

Dark Theme in Windows is not yet official and has to rely upon
undocumented APIs.

There are two possible approaches:
1) Use SetWindowTheme("DarkMode_Explorer")
2) Use a combination of:
   SetPreferredAppMode() to allow dark theme per-process
   AllowDarkModeForWindow() to allow it for a window
   SetWindowTheme("Explorer") to activate it for a window

In Bug 444560, approach (1) was selected due to relative simplicity of
implementation. Windows itself uses approach (2) for select applications
where Dark Theme is supported, such as Windows Explorer.

Turns out, approach (1) is flawed.
For 'Table' (based on native 'ListView' control), as of Win10 v2004,
'DarkMode_Explorer::ListView' is not yet present. This causes ListView
to not recognize the theme, which in turn causes it to have default
theme. At the same time, for many years now, it used "Explorer" theme.

With approach (1), it is not possible to both have dark scrollbars and
"Explorer" theme, at least I wasn't able to find such way after quite
some research.

Therefore, let's switch to approach 2.

The upsides are:
* it fixes the problem in Bug 562043
* it is closer to how Windows does things
* when API is public, the code will probably not need many changes.

The downsides are:
* it's more complicated to make sure that APIs are still there.
* supporting Win10 v1809 will require verifying yet another API.
  I decided that for simplicity, I'd simply declare it as unsupported.

This patch discards previous code (no longer needed) from at least:
* Bug 444560 - various parts of approach (1)
* Bug 562330 - 'Table.darkExplorerTheme'. The real problem there was
  that Table reverted to default theme.

Changes I observed:
* Bug 562043 if fixed.
* Table's header now highlights sort column.

Change-Id: Ic93fcafe80569921f796e4d8ab0fd6f9b6a6f027
Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
12 files changed
tree: 1815a82cda37f4e036c84a7e3ad8521d42783cec
  1. bundles/
  2. container/
  3. examples/
  4. features/
  5. local-build/
  6. tests/
  7. .gitignore
  8. CONTRIBUTING
  9. LICENSE
  10. NOTICE
  11. pom.xml
  12. README.md
README.md

Contributing to SWT

Thanks for your interest in this project.

Developer resources:

See the following description for how to contribute a feature or a bug fix to SWT.

Information regarding source code management, builds, coding standards, and more and be found under the following link.

Contributor License Agreement:

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).

Contact:

Contact the project developers via the project's “dev” list.

Search for bugs:

This project uses Bugzilla to track ongoing development and issues.

Create a new bug:

Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!