Hi @vadz
Could you advise me on whether adding files to darkmode.cpp and darkmode.h is better, or creating separate files for dark mode taskdialog ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa commented on this pull request.
> @@ -44,6 +44,13 @@ #include "wx/msw/private/darkmode.h" +#include <uiautomation.h> +#include <vssym32.h> +#include <commctrl.h> +#include <atlbase.h> // CComPtr, CComBSTR
If use wxCOMPtr and wxBasicString look good now?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
> + case TDLG_EXPANDOTEXT: return TDDarkCol::kTextExpando;
+ case TDLG_VERIFICATIONTEXT: return TDDarkCol::kTextVerify;
+ case TDLG_FOOTNOTEPANE: return TDDarkCol::kTextFootnote;
+ case TDLG_EXPANDEDFOOTERAREA: return TDDarkCol::kTextFtrExp;
+ case TDLG_RADIOBUTTONPANE: return TDDarkCol::kTextRadio;
+ default: return TDDarkCol::kTextNormal;
+ }
+}
+
+// ============================================================================
+// Icon loading
+// ============================================================================
+
+static HICON TDLoadStockIcon(const TASKDIALOGCONFIG* cfg, bool isMain)
+{
+ if (!cfg) return nullptr;
If style look good now.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
> #include <memory> #if wxUSE_LOG_TRACE static const char* TRACE_DARKMODE = "msw-darkmode"; #endif // wxUSE_LOG_TRACE +#include <atlwin.h>
removed
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa commented on this pull request.
> + // (The old code used TDN_DIALOG_CONSTRUCTED which fires too early + // for UI Automation to walk the child windows reliably.)
This not copy-pasted from wxMessageDialog from wxMessageDialog.
it's my old comment for don't use AllowForTaskDialog at TDN_DIALOG_CONSTRUCTED it's need TDN_CREATE
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
Thanks for the updates, but there are still some build problems. They look easy to fix (WINAPI missing in one place, just fix formatting — or, preferably, switch to using wxUxThemeHandle — in another) and I'll try to review this once again and merge as soon as this is done. Or I could just fix them myself if you prefer, please let me know.
> + ct == UIA_ScrollBarControlTypeId || ct == UIA_PaneControlTypeId)
+ {
+ HWND hBtn = nullptr;
+ pChild->get_CurrentNativeWindowHandle(reinterpret_cast<UIA_HWND*>(&hBtn));
+ if (hBtn)
+ {
+ BSTR bId; pChild->get_CurrentAutomationId(&bId);
+ const std::wstring id(bId ? static_cast<LPCWSTR>(bId) : L"");
+ HWND hP = GetParent(hBtn);
+
+ if (ct == UIA_ProgressBarControlTypeId)
+ {
+ HTHEME hCE = OpenThemeData(nullptr, L"DarkMode_CopyEngine::Progress");
+ HTHEME hBase = OpenThemeData(nullptr, L"Progress");
+ bool hasCE = (hCE && hCE != hBase);
+ if (hCE) CloseThemeData(hCE); if (hBase) CloseThemeData(hBase);
This statement provokes gcc error in one of the CI builds. As mentioned before, this could be avoided entirely by using wxUxThemeHandle instead of manual open/close theme data calls.
> @@ -24,6 +24,7 @@ // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/module.h"
Was this moved intentionally? Not really a problem, of course, but just looks weird.
> +
+ EndBufferedPaint(hbp, TRUE);
+}
+
+// ============================================================================
+// Subclass procedures
+// ============================================================================
+
+static LRESULT CALLBACK TDPageSubclassProc(
+ HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
+ UINT_PTR uId, DWORD_PTR)
+{
+ switch (msg)
+ {
+ case WM_ERASEBKGND:
+ return 1;
Minor, but this should be
⬇️ Suggested change- return 1; + return TRUE;
> + FillRect(hdc, &rc, reinterpret_cast<HBRUSH>(dwRef)); return 1;
+ }
+ break;
+ case WM_CTLCOLORMSGBOX:
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORLISTBOX:
+ case WM_CTLCOLORBTN:
+ case WM_CTLCOLORDLG:
+ case WM_CTLCOLORSCROLLBAR:
+ case WM_CTLCOLORSTATIC:
+ {
+ HDC hdc = reinterpret_cast<HDC>(wParam);
+ COLORREF bg = TDDarkCol::kSecondary;
+ if (dwRef) { LOGBRUSH lb = {}; GetObject(reinterpret_cast<HBRUSH>(dwRef), sizeof(lb), &lb); if (lb.lbStyle == BS_SOLID) bg = lb.lbColor; }
+ SetBkColor(hdc, bg); SetTextColor(hdc, TDDarkCol::kTextNormal);
+ return reinterpret_cast<LRESULT>(dwRef ? reinterpret_cast<HBRUSH>(dwRef) : CreateSolidBrush(TDDarkCol::kSecondary));
Isn't this brush leaked?
> + // Mouse interaction (message-driven, no polling)
+ bool tracking = false;
+ bool pressing = false;
+ int hotIdx = -1;
+
+ // Logical dialog state
+ bool isExpanded = false;
+ bool isChecked = false;
+ bool defExpanded = false;
+ bool defChecked = false;
+
+ const TASKDIALOGCONFIG* pCfg = nullptr;
+
+ void CloseThemes()
+ {
+ if (hTD) { CloseThemeData(hTD); hTD = nullptr; }
It would be really nice to avoid putting more than one statement per line, this improves readability a lot, in general, e.g.
⬇️ Suggested change- if (hTD) { CloseThemeData(hTD); hTD = nullptr; }
+ if (hTD)
+ {
+ CloseThemeData(hTD);
+ hTD = nullptr;
+ }
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
You are receiving this because you are subscribed to this thread.![]()