From c5feccca5321dcd244bbf147192582b30048030d Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Sun, 20 Sep 2020 00:32:23 +0100 Subject: [PATCH] Add stub functions in KIPLATFORM to detect dark mode These haven't been written yet, but current code can be adapted to use these now. --- libs/kiplatform/gtk/ui.cpp | 8 ++++++++ libs/kiplatform/include/kiplatform/ui.h | 7 +++++++ libs/kiplatform/msw/ui.cpp | 8 ++++++++ libs/kiplatform/osx/ui.mm | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/libs/kiplatform/gtk/ui.cpp b/libs/kiplatform/gtk/ui.cpp index 28c34c08bf..83d4734220 100644 --- a/libs/kiplatform/gtk/ui.cpp +++ b/libs/kiplatform/gtk/ui.cpp @@ -23,6 +23,14 @@ #include #include + +bool KIPLATFORM::UI::IsDarkTheme() +{ + // TODO(ISM): Write this function + return false; +} + + void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow ) { aWindow->SetFocus(); diff --git a/libs/kiplatform/include/kiplatform/ui.h b/libs/kiplatform/include/kiplatform/ui.h index cfb367c697..d9558435ed 100644 --- a/libs/kiplatform/include/kiplatform/ui.h +++ b/libs/kiplatform/include/kiplatform/ui.h @@ -28,6 +28,13 @@ namespace KIPLATFORM { namespace UI { + /** + * Determine if the desktop interface is currently using a dark theme or a light theme. + * + * @return true if a dark theme is being used. + */ + bool IsDarkTheme(); + /** * Pass the current focus to the window. On OSX this will forcefully give the focus to * the desired window, while on MSW and GTK it will simply call the wxWidgets SetFocus() diff --git a/libs/kiplatform/msw/ui.cpp b/libs/kiplatform/msw/ui.cpp index 28c34c08bf..83d4734220 100644 --- a/libs/kiplatform/msw/ui.cpp +++ b/libs/kiplatform/msw/ui.cpp @@ -23,6 +23,14 @@ #include #include + +bool KIPLATFORM::UI::IsDarkTheme() +{ + // TODO(ISM): Write this function + return false; +} + + void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow ) { aWindow->SetFocus(); diff --git a/libs/kiplatform/osx/ui.mm b/libs/kiplatform/osx/ui.mm index 840733a987..4de0e5bf7b 100644 --- a/libs/kiplatform/osx/ui.mm +++ b/libs/kiplatform/osx/ui.mm @@ -26,6 +26,14 @@ #include #include + +bool KIPLATFORM::UI::IsDarkTheme() +{ + // TODO(ISM): Write this function + return false; +} + + void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow ) { // On OSX we need to forcefully give the focus to the window