GUI Enhancement: StylerDlg & URLCtrl

-  prefer SystemParametersInfo fonts over DEFAULT_GUI_FONT
-  optimize dark mode
-  fix override warnings

Fix #13705, close #13706
This commit is contained in:
ozone10 2023-05-25 17:56:36 +02:00 committed by Don Ho
parent 781709a022
commit 776a3fb945
7 changed files with 94 additions and 116 deletions

View File

@ -1809,18 +1809,6 @@ bool NppParameters::isInFontList(const generic_string& fontName2Search) const
return false; return false;
} }
HFONT NppParameters::getDefaultUIFont()
{
static HFONT g_defaultMessageFont = []() {
NONCLIENTMETRICS ncm{};
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
return CreateFontIndirect(&ncm.lfMessageFont);
}();
return g_defaultMessageFont;
}
LOGFONT NppParameters::getDefaultGUIFont(DefaultFontType type) LOGFONT NppParameters::getDefaultGUIFont(DefaultFontType type)
{ {
LOGFONT lf{}; LOGFONT lf{};
@ -1842,12 +1830,6 @@ LOGFONT NppParameters::getDefaultGUIFont(DefaultFontType type)
break; break;
} }
case DefaultFontType::message:
{
lf = ncm.lfMessageFont;
break;
}
case DefaultFontType::caption: case DefaultFontType::caption:
{ {
lf = ncm.lfCaptionFont; lf = ncm.lfCaptionFont;
@ -1860,16 +1842,15 @@ LOGFONT NppParameters::getDefaultGUIFont(DefaultFontType type)
break; break;
} }
// case DefaultFontType::none // case DefaultFontType::message:
default: default:
{ {
auto hf = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT)); lf = ncm.lfMessageFont;
::GetObject(hf, sizeof(LOGFONT), &lf);
break; break;
} }
} }
} }
else else // should not happen, fallback
{ {
auto hf = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT)); auto hf = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
::GetObject(hf, sizeof(LOGFONT), &lf); ::GetObject(hf, sizeof(LOGFONT), &lf);

View File

@ -1525,8 +1525,7 @@ public:
bool isInFontList(const generic_string& fontName2Search) const; bool isInFontList(const generic_string& fontName2Search) const;
const std::vector<generic_string>& getFontList() const { return _fontlist; } const std::vector<generic_string>& getFontList() const { return _fontlist; }
HFONT getDefaultUIFont(); enum class DefaultFontType { menu, status, message, caption, smcaption };
enum class DefaultFontType { none, menu, status, message, caption, smcaption };
static LOGFONT getDefaultGUIFont(DefaultFontType type = DefaultFontType::message); static LOGFONT getDefaultGUIFont(DefaultFontType type = DefaultFontType::message);
int getNbUserLang() const {return _nbUserLang;} int getNbUserLang() const {return _nbUserLang;}

View File

@ -17,6 +17,7 @@
#include "URLCtrl.h" #include "URLCtrl.h"
#include "NppDarkMode.h" #include "NppDarkMode.h"
#include "Parameters.h"
void URLCtrl::create(HWND itemHandle, const TCHAR * link, COLORREF linkColor) void URLCtrl::create(HWND itemHandle, const TCHAR * link, COLORREF linkColor)
@ -157,20 +158,16 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
::SetBkColor(hdc, getCtrlBgColor(GetParent(hwnd))); ///*::GetSysColor(COLOR_3DFACE)*/); ::SetBkColor(hdc, getCtrlBgColor(GetParent(hwnd))); ///*::GetSysColor(COLOR_3DFACE)*/);
// Create an underline font // Create an underline font
if (_hfUnderlined == nullptr) if (_hfUnderlined == nullptr)
{ {
// Get the default GUI font // Get the default GUI font
LOGFONT lf{}; LOGFONT lf{ NppParameters::getDefaultGUIFont() };
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); lf.lfUnderline = TRUE;
// Add UNDERLINE attribute // Create a new font
GetObject(hf, sizeof lf, &lf); _hfUnderlined = ::CreateFontIndirect(&lf);
lf.lfUnderline = TRUE; }
// Create a new font
_hfUnderlined = ::CreateFontIndirect(&lf);
}
HANDLE hOld = SelectObject(hdc, _hfUnderlined); HANDLE hOld = SelectObject(hdc, _hfUnderlined);

View File

@ -24,7 +24,7 @@ class URLCtrl : public Window {
public: public:
void create(HWND itemHandle, const TCHAR * link, COLORREF linkColor = RGB(0,0,255)); void create(HWND itemHandle, const TCHAR * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, int cmd, HWND msgDest = NULL); void create(HWND itemHandle, int cmd, HWND msgDest = NULL);
void destroy(); void destroy() override;
private: private:
HCURSOR& loadHandCursor(); HCURSOR& loadHandCursor();
void action(); void action();

View File

@ -31,10 +31,10 @@ LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Messag
{ {
case WM_PAINT: case WM_PAINT:
{ {
RECT rect; RECT rect{};
::GetClientRect(hwnd, &rect); ::GetClientRect(hwnd, &rect);
PAINTSTRUCT ps; PAINTSTRUCT ps{};
HDC hdc = ::BeginPaint(hwnd, &ps); HDC hdc = ::BeginPaint(hwnd, &ps);
::SetTextColor(hdc, _colour); ::SetTextColor(hdc, _colour);
@ -45,17 +45,17 @@ LRESULT CALLBACK ColourStaticTextHooker::colourStaticProc(HWND hwnd, UINT Messag
} }
// Get the default GUI font // Get the default GUI font
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT); LOGFONT lf{ NppParameters::getDefaultGUIFont() };
HFONT hf = ::CreateFontIndirect(&lf);
HANDLE hOld = SelectObject(hdc, hf); HANDLE hOld = SelectObject(hdc, hf);
// Draw the text! // Draw the text!
TCHAR text[MAX_PATH]; TCHAR text[MAX_PATH]{};
::GetWindowText(hwnd, text, MAX_PATH); ::GetWindowText(hwnd, text, MAX_PATH);
::DrawText(hdc, text, -1, &rect, DT_LEFT); ::DrawText(hdc, text, -1, &rect, DT_LEFT);
::SelectObject(hdc, hOld); ::DeleteObject(::SelectObject(hdc, hOld));
::EndPaint(hwnd, &ps); ::EndPaint(hwnd, &ps);
return TRUE; return TRUE;
@ -159,44 +159,30 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf); NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
goToCenter(); goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
return TRUE; return TRUE;
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{ {
if (NppDarkMode::isEnabled()) auto hdcStatic = reinterpret_cast<HDC>(wParam);
auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
if (dlgCtrlID == IDC_USER_EXT_EDIT || dlgCtrlID == IDC_USER_KEYWORDS_EDIT)
{ {
HWND hwnd = reinterpret_cast<HWND>(lParam); return NppDarkMode::onCtlColorSofter(hdcStatic);
if (hwnd == ::GetDlgItem(_hSelf, IDC_USER_EXT_EDIT) || hwnd == ::GetDlgItem(_hSelf, IDC_USER_KEYWORDS_EDIT))
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
else
{
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
}
} }
break; return NppDarkMode::onCtlColor(hdcStatic);
} }
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{ {
if (NppDarkMode::isEnabled()) return NppDarkMode::onCtlColorListbox(wParam, lParam);
{
return NppDarkMode::onCtlColorListbox(wParam, lParam);
}
break;
} }
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{ {
if (NppDarkMode::isEnabled()) return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
} }
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
@ -240,15 +226,11 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled()) if (dlgCtrlID == IDC_DEF_EXT_EDIT || dlgCtrlID == IDC_DEF_KEYWORDS_EDIT)
{ {
if (dlgCtrlID == IDC_DEF_EXT_EDIT || dlgCtrlID == IDC_DEF_KEYWORDS_EDIT) return NppDarkMode::onCtlColor(hdcStatic);
{
return NppDarkMode::onCtlColor(hdcStatic);
}
return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE; return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
@ -697,8 +679,8 @@ void WordStyleDlg::updateFontSize()
if (iFontSizeSel != 0) if (iFontSizeSel != 0)
{ {
const size_t intStrLen = 3; constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]; TCHAR intStr[intStrLen]{};
auto lbTextLen = ::SendMessage(_hFontSizeCombo, CB_GETLBTEXTLEN, iFontSizeSel, 0); auto lbTextLen = ::SendMessage(_hFontSizeCombo, CB_GETLBTEXTLEN, iFontSizeSel, 0);
if (static_cast<size_t>(lbTextLen) >= intStrLen) if (static_cast<size_t>(lbTextLen) >= intStrLen)
@ -710,7 +692,7 @@ void WordStyleDlg::updateFontSize()
style._fontSize = STYLE_NOT_USED; style._fontSize = STYLE_NOT_USED;
else else
{ {
TCHAR *finStr; TCHAR *finStr = nullptr;
style._fontSize = wcstol(intStr, &finStr, 10); style._fontSize = wcstol(intStr, &finStr, 10);
if (*finStr != '\0') if (*finStr != '\0')
style._fontSize = STYLE_NOT_USED; style._fontSize = STYLE_NOT_USED;
@ -722,8 +704,8 @@ void WordStyleDlg::updateFontSize()
void WordStyleDlg::updateExtension() void WordStyleDlg::updateExtension()
{ {
const int NB_MAX = 256; constexpr int NB_MAX = 256;
TCHAR ext[NB_MAX]; TCHAR ext[NB_MAX]{};
::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, reinterpret_cast<LPARAM>(ext)); ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_GETTEXT, NB_MAX, reinterpret_cast<LPARAM>(ext));
_lsArray.getLexerFromIndex(_currentLexerIndex - 1).setLexerUserExt(ext); _lsArray.getLexerFromIndex(_currentLexerIndex - 1).setLexerUserExt(ext);
} }
@ -795,7 +777,7 @@ void WordStyleDlg::switchToTheme()
if (_isThemeDirty) if (_isThemeDirty)
{ {
TCHAR themeFileName[MAX_PATH]; TCHAR themeFileName[MAX_PATH]{};
wcscpy_s(themeFileName, prevThemeName.c_str()); wcscpy_s(themeFileName, prevThemeName.c_str());
PathStripPath(themeFileName); PathStripPath(themeFileName);
PathRemoveExtension(themeFileName); PathRemoveExtension(themeFileName);
@ -1077,24 +1059,21 @@ void WordStyleDlg::setVisualFromStyleList()
InvalidateRect(_hBgColourStaticText, NULL, FALSE); InvalidateRect(_hBgColourStaticText, NULL, FALSE);
//-- font name //-- font name
LRESULT iFontName; LRESULT iFontName = 0;
if (!style._fontName.empty()) if (!style._fontName.empty())
{ {
iFontName = ::SendMessage(_hFontNameCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(style._fontName.c_str())); iFontName = ::SendMessage(_hFontNameCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(style._fontName.c_str()));
if (iFontName == CB_ERR) if (iFontName == CB_ERR)
iFontName = 0; iFontName = 0;
} }
else
{
iFontName = 0;
}
::SendMessage(_hFontNameCombo, CB_SETCURSEL, iFontName, 0); ::SendMessage(_hFontNameCombo, CB_SETCURSEL, iFontName, 0);
::EnableWindow(_hFontNameCombo, style._isFontEnabled); ::EnableWindow(_hFontNameCombo, style._isFontEnabled);
InvalidateRect(_hFontNameStaticText, NULL, FALSE); InvalidateRect(_hFontNameStaticText, NULL, FALSE);
//-- font size //-- font size
const size_t intStrLen = 3; constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]; TCHAR intStr[intStrLen]{};
LRESULT iFontSize = 0; LRESULT iFontSize = 0;
if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits
{ {

View File

@ -61,11 +61,7 @@ class WordStyleDlg : public StaticDialog
public : public :
WordStyleDlg() = default; WordStyleDlg() = default;
void init(HINSTANCE hInst, HWND parent) { void create(int dialogID, bool isRTL = false, bool msgDestParent = true) override;
Window::init(hInst, parent);
};
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
void doDialog(bool isRTL = false) { void doDialog(bool isRTL = false) {
if (!isCreated()) if (!isCreated())
@ -87,13 +83,13 @@ public :
_gOverride2restored = (NppParameters::getInstance()).getGlobalOverrideStyle(); _gOverride2restored = (NppParameters::getInstance()).getGlobalOverrideStyle();
}; };
virtual void redraw(bool forceUpdate = false) const { void redraw(bool forceUpdate = false) const override {
_pFgColour->redraw(forceUpdate); _pFgColour->redraw(forceUpdate);
_pBgColour->redraw(forceUpdate); _pBgColour->redraw(forceUpdate);
::InvalidateRect(_hStyleInfoStaticText, NULL, TRUE); ::InvalidateRect(_hStyleInfoStaticText, NULL, TRUE);
::UpdateWindow(_hStyleInfoStaticText); ::UpdateWindow(_hStyleInfoStaticText);
}; };
void restoreGlobalOverrideValues() { void restoreGlobalOverrideValues() {
GlobalOverride & gOverride = (NppParameters::getInstance()).getGlobalOverrideStyle(); GlobalOverride & gOverride = (NppParameters::getInstance()).getGlobalOverrideStyle();
gOverride = _gOverride2restored; gOverride = _gOverride2restored;
@ -151,7 +147,7 @@ private :
bool _isShownGOCtrls = false; bool _isShownGOCtrls = false;
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
Style & getCurrentStyler() { Style & getCurrentStyler() {

View File

@ -49,10 +49,16 @@ void StatusBar::init(HINSTANCE, HWND)
struct StatusBarSubclassInfo struct StatusBarSubclassInfo
{ {
HTHEME hTheme = nullptr; HTHEME hTheme = nullptr;
HFONT _hFont = nullptr;
StatusBarSubclassInfo() = default;
StatusBarSubclassInfo(const HFONT& hFont)
: _hFont(hFont) {}
~StatusBarSubclassInfo() ~StatusBarSubclassInfo()
{ {
closeTheme(); closeTheme();
destroyFont();
} }
bool ensureTheme(HWND hwnd) bool ensureTheme(HWND hwnd)
@ -72,6 +78,21 @@ struct StatusBarSubclassInfo
hTheme = nullptr; hTheme = nullptr;
} }
} }
void setFont(const HFONT& hFont)
{
destroyFont();
_hFont = hFont;
}
void destroyFont()
{
if (_hFont != nullptr)
{
::DeleteObject(_hFont);
_hFont = nullptr;
}
}
}; };
@ -80,8 +101,6 @@ constexpr UINT_PTR g_statusBarSubclassID = 42;
LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{ {
UNREFERENCED_PARAMETER(uIdSubclass);
StatusBarSubclassInfo* pStatusBarInfo = reinterpret_cast<StatusBarSubclassInfo*>(dwRefData); StatusBarSubclassInfo* pStatusBarInfo = reinterpret_cast<StatusBarSubclassInfo*>(dwRefData);
switch (uMsg) switch (uMsg)
@ -90,10 +109,10 @@ LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{ {
if (!NppDarkMode::isEnabled()) if (!NppDarkMode::isEnabled())
{ {
return DefSubclassProc(hWnd, uMsg, wParam, lParam); break;
} }
RECT rc; RECT rc{};
GetClientRect(hWnd, &rc); GetClientRect(hWnd, &rc);
FillRect((HDC)wParam, &rc, NppDarkMode::getBackgroundBrush()); FillRect((HDC)wParam, &rc, NppDarkMode::getBackgroundBrush());
return TRUE; return TRUE;
@ -103,28 +122,28 @@ LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{ {
if (!NppDarkMode::isEnabled()) if (!NppDarkMode::isEnabled())
{ {
return DefSubclassProc(hWnd, uMsg, wParam, lParam); break;
} }
struct { struct {
int horizontal; int horizontal = 0;
int vertical; int vertical = 0;
int between; int between = 0;
} borders = {}; } borders{};
SendMessage(hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); SendMessage(hWnd, SB_GETBORDERS, 0, (LPARAM)&borders);
DWORD style = GetWindowLong(hWnd, GWL_STYLE); const auto style = ::GetWindowLongPtr(hWnd, GWL_STYLE);
bool isSizeGrip = style & SBARS_SIZEGRIP; bool isSizeGrip = style & SBARS_SIZEGRIP;
PAINTSTRUCT ps; PAINTSTRUCT ps{};
HDC hdc = BeginPaint(hWnd, &ps); HDC hdc = BeginPaint(hWnd, &ps);
auto holdPen = static_cast<HPEN>(::SelectObject(hdc, NppDarkMode::getEdgePen())); auto holdPen = static_cast<HPEN>(::SelectObject(hdc, NppDarkMode::getEdgePen()));
HFONT holdFont = (HFONT)::SelectObject(hdc, NppParameters::getInstance().getDefaultUIFont()); auto holdFont = static_cast<HFONT>(::SelectObject(hdc, pStatusBarInfo->_hFont));
RECT rcClient; RECT rcClient{};
GetClientRect(hWnd, &rcClient); GetClientRect(hWnd, &rcClient);
FillRect(hdc, &ps.rcPaint, NppDarkMode::getBackgroundBrush()); FillRect(hdc, &ps.rcPaint, NppDarkMode::getBackgroundBrush());
@ -133,9 +152,9 @@ LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
std::wstring str; std::wstring str;
for (int i = 0; i < nParts; ++i) for (int i = 0; i < nParts; ++i)
{ {
RECT rcPart = {}; RECT rcPart{};
SendMessage(hWnd, SB_GETRECT, i, (LPARAM)&rcPart); SendMessage(hWnd, SB_GETRECT, i, (LPARAM)&rcPart);
RECT rcIntersect = {}; RECT rcIntersect{};
if (!IntersectRect(&rcIntersect, &rcPart, &ps.rcPaint)) if (!IntersectRect(&rcIntersect, &rcPart, &ps.rcPaint))
{ {
continue; continue;
@ -200,7 +219,7 @@ LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (isSizeGrip) if (isSizeGrip)
{ {
pStatusBarInfo->ensureTheme(hWnd); pStatusBarInfo->ensureTheme(hWnd);
SIZE gripSize = {}; SIZE gripSize{};
GetThemePartSize(pStatusBarInfo->hTheme, hdc, SP_GRIPPER, 0, &rcClient, TS_DRAW, &gripSize); GetThemePartSize(pStatusBarInfo->hTheme, hdc, SP_GRIPPER, 0, &rcClient, TS_DRAW, &gripSize);
RECT rc = rcClient; RECT rc = rcClient;
rc.left = rc.right - gripSize.cx; rc.left = rc.right - gripSize.cx;
@ -212,16 +231,22 @@ LRESULT CALLBACK StatusBarSubclass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
::SelectObject(hdc, holdPen); ::SelectObject(hdc, holdPen);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
return FALSE; return 0;
} }
case WM_NCDESTROY: case WM_NCDESTROY:
RemoveWindowSubclass(hWnd, StatusBarSubclass, g_statusBarSubclassID); {
::RemoveWindowSubclass(hWnd, StatusBarSubclass, uIdSubclass);
break; break;
}
case WM_THEMECHANGED: case WM_THEMECHANGED:
{
pStatusBarInfo->closeTheme(); pStatusBarInfo->closeTheme();
LOGFONT lf{ NppParameters::getDefaultGUIFont(NppParameters::DefaultFontType::status) };
pStatusBarInfo->setFont(::CreateFontIndirect(&lf));
break; break;
}
} }
return DefSubclassProc(hWnd, uMsg, wParam, lParam); return DefSubclassProc(hWnd, uMsg, wParam, lParam);
} }
@ -244,7 +269,8 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
if (!_hSelf) if (!_hSelf)
throw std::runtime_error("StatusBar::init : CreateWindowEx() function return null"); throw std::runtime_error("StatusBar::init : CreateWindowEx() function return null");
StatusBarSubclassInfo* pStatusBarInfo = new StatusBarSubclassInfo(); LOGFONT lf{ NppParameters::getDefaultGUIFont(NppParameters::DefaultFontType::status) };
StatusBarSubclassInfo* pStatusBarInfo = new StatusBarSubclassInfo(::CreateFontIndirect(&lf));
_pStatusBarInfo = pStatusBarInfo; _pStatusBarInfo = pStatusBarInfo;
SetWindowSubclass(_hSelf, StatusBarSubclass, g_statusBarSubclassID, reinterpret_cast<DWORD_PTR>(pStatusBarInfo)); SetWindowSubclass(_hSelf, StatusBarSubclass, g_statusBarSubclassID, reinterpret_cast<DWORD_PTR>(pStatusBarInfo));
@ -257,7 +283,7 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
if (_partWidthArray.size()) if (_partWidthArray.size())
_lpParts = new int[_partWidthArray.size()]; _lpParts = new int[_partWidthArray.size()];
RECT rc; RECT rc{};
::GetClientRect(_hParent, &rc); ::GetClientRect(_hParent, &rc);
adjustParts(rc.right); adjustParts(rc.right);
} }