diff options
author | Lakshmi Shanmugam | 2019-07-23 10:49:23 +0000 |
---|---|---|
committer | Lakshmi Shanmugam | 2019-08-05 10:04:30 +0000 |
commit | ef55fab390e3fdd8fba59a3541336ac5c7f8ac1f (patch) | |
tree | ce6a7d56f0d47c26f653823b903f1afe23a05429 | |
parent | 66ca6a1630ac2dff01571775a0c1c985b3debfef (diff) | |
download | eclipse.platform.swt-ef55fab390e3fdd8fba59a3541336ac5c7f8ac1f.tar.gz eclipse.platform.swt-ef55fab390e3fdd8fba59a3541336ac5c7f8ac1f.tar.xz eclipse.platform.swt-ef55fab390e3fdd8fba59a3541336ac5c7f8ac1f.zip |
Bug 549451 - [API]Query the current system setting for dark mode
Added isSystemDarkTheme() API with implementation for Mac. Returns false
on Windows and GTK.
Change-Id: I39d9cba08546513f87ddb3ad544718a8c6055532
3 files changed, 33 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index a9f216f109..c62c72031c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -1652,6 +1652,17 @@ public Point [] getIconSizes () { new Point (64, 64), new Point (128, 128)}; } +/** + * Returns true if the current OS theme has a dark appearance, else returns false. + * + * @return true if the OS theme is dark else false + * + * @since 3.112 + */ +public static boolean isSystemDarkTheme () { + return OS.isSystemDarkAppearance(); +} + int getLastEventTime () { NSEvent event = application != null ? application.currentEvent() : null; if (event == null) return 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index 013074eb13..0374db6cf3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -2422,6 +2422,17 @@ public Point [] getIconSizes () { return new Point [] {new Point (16, 16), new Point (32, 32)}; } +/** + * Returns true if the current OS theme has a dark appearance, else returns false. + * + * @return true if the OS theme is dark else false + * + * @since 3.112 + */ +public static boolean isSystemDarkTheme () { + return false; +} + int getLastEventTime () { return lastEventTime; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 297e562d67..97ab6d40d9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -2013,6 +2013,17 @@ ImageList getImageListToolBarHot (int style, int width, int height) { return list; } +/** + * Returns true if the current OS theme has a dark appearance, else returns false. + * + * @return true if the current OS theme is dark else false + * + * @since 3.112 + */ +public static boolean isSystemDarkTheme () { + return false; +} + int getLastEventTime () { return OS.GetMessageTime (); } |