2021-02-22 14:55:45 +01:00
# pragma once
# include <Windows.h>
2021-05-10 04:32:35 +02:00
constexpr COLORREF HEXRGB ( DWORD rrggbb ) {
// from 0xRRGGBB like natural #RRGGBB
// to the little-endian 0xBBGGRR
return
( ( rrggbb & 0xFF0000 ) > > 16 ) |
( ( rrggbb & 0x00FF00 ) ) |
( ( rrggbb & 0x0000FF ) < < 16 ) ;
}
2021-02-22 14:55:45 +01:00
namespace NppDarkMode
{
struct Options
{
bool enable = false ;
bool enableExperimental = false ;
bool enableMenubar = false ;
bool enableScrollbarHack = false ;
} ;
2021-06-07 19:47:24 +02:00
enum class ToolTipsType
{
tooltip ,
toolbar ,
listview ,
treeview
} ;
2021-02-22 14:55:45 +01:00
void initDarkMode ( ) ; // pulls options from NppParameters
void refreshDarkMode ( HWND hwnd , bool forceRefresh = false ) ; // attempts to apply new options from NppParameters, sends NPPM_INTERNAL_REFRESHDARKMODE to hwnd's top level parent
bool isEnabled ( ) ;
bool isDarkMenuEnabled ( ) ;
bool isExperimentalEnabled ( ) ;
bool isScrollbarHackEnabled ( ) ;
COLORREF invertLightness ( COLORREF c ) ;
COLORREF invertLightnessSofter ( COLORREF c ) ;
COLORREF getBackgroundColor ( ) ;
COLORREF getSofterBackgroundColor ( ) ;
COLORREF getHotBackgroundColor ( ) ;
2021-05-10 04:32:35 +02:00
COLORREF getDarkerBackgroundColor ( ) ;
COLORREF getErrorBackgroundColor ( ) ;
2021-02-22 14:55:45 +01:00
COLORREF getTextColor ( ) ;
COLORREF getDarkerTextColor ( ) ;
2021-05-28 21:40:28 +02:00
COLORREF getDisabledTextColor ( ) ;
2021-02-22 14:55:45 +01:00
COLORREF getEdgeColor ( ) ;
HBRUSH getBackgroundBrush ( ) ;
2021-05-10 04:32:35 +02:00
HBRUSH getDarkerBackgroundBrush ( ) ;
2021-02-22 14:55:45 +01:00
HBRUSH getSofterBackgroundBrush ( ) ;
HBRUSH getHotBackgroundBrush ( ) ;
HBRUSH getErrorBackgroundBrush ( ) ;
// handle events
2021-04-26 08:15:16 +02:00
void handleSettingChange ( HWND hwnd , LPARAM lParam ) ;
2021-02-22 14:55:45 +01:00
// processes messages related to UAH / custom menubar drawing.
// return true if handled, false to continue with normal processing in your wndproc
bool runUAHWndProc ( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam , LRESULT * lr ) ;
2021-06-10 02:13:10 +02:00
void drawUAHMenuNCBottomLine ( HWND hWnd ) ;
2021-02-22 14:55:45 +01:00
// from DarkMode.h
2021-04-26 08:15:16 +02:00
void initExperimentalDarkMode ( bool fixDarkScrollbar , bool dark ) ;
2021-02-22 14:55:45 +01:00
void allowDarkModeForApp ( bool allow ) ;
bool allowDarkModeForWindow ( HWND hWnd , bool allow ) ;
2021-04-26 08:15:16 +02:00
void setTitleBarThemeColor ( HWND hWnd , bool dark ) ;
2021-02-22 14:55:45 +01:00
// enhancements to DarkMode.h
void enableDarkScrollBarForWindowAndChildren ( HWND hwnd ) ;
void subclassButtonControl ( HWND hwnd ) ;
2021-04-23 23:41:11 +02:00
void subclassGroupboxControl ( HWND hwnd ) ;
2021-02-22 14:55:45 +01:00
void subclassToolbarControl ( HWND hwnd ) ;
2021-04-23 23:41:11 +02:00
void subclassTabControl ( HWND hwnd ) ;
2021-04-26 08:15:16 +02:00
void autoSubclassAndThemeChildControls ( HWND hwndParent , bool subclass = true , bool theme = true ) ;
void autoThemeChildControls ( HWND hwndParent ) ;
2021-02-22 14:55:45 +01:00
2021-06-17 16:02:14 +02:00
void setDarkTitleBar ( HWND hwnd ) ;
2021-06-07 19:47:24 +02:00
void setDarkTooltips ( HWND hwnd , ToolTipsType type ) ;
2021-06-20 23:54:24 +02:00
void setDarkLineAbovePanelToolbar ( HWND hwnd ) ;
2021-06-22 14:44:53 +02:00
2021-06-23 02:33:15 +02:00
void setExplorerTheme ( HWND hwnd , bool doEnable ) ;
2021-06-07 19:47:24 +02:00
}