From 15e35a5e7c9a12ebffb6fe3c66f3e55ab5a3f181 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 27 Sep 2021 18:57:12 +0100 Subject: [PATCH] Document that FromDIP() is not needed with SetToolBitmapSize() wxMSW wxToolBar adjusts the bitmap size to DPI automatically. --- interface/wx/toolbar.h | 5 +++++ samples/toolbar/toolbar.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/interface/wx/toolbar.h b/interface/wx/toolbar.h index 6961be25bd..35474cf509 100644 --- a/interface/wx/toolbar.h +++ b/interface/wx/toolbar.h @@ -860,6 +860,11 @@ public: Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels. + Note that @a size does @e not need to be multiplied by the + DPI-dependent factor even under MSW, where it would normally be + necessary, as the toolbar adjusts this size to the current DPI + automatically. + @param size The size of the bitmaps in the toolbar. diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index cc4e489deb..8429d6ecce 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -410,6 +410,9 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar) h *= 2; } + // Note that there is no need for FromDIP() here, wxMSW will adjust the + // size on its own and under the other platforms there is no need for + // scaling the coordinates anyhow. toolBar->SetToolBitmapSize(wxSize(w, h)); toolBar->AddTool(wxID_NEW, "New",