Merge branch 'per-monitor-dpi-aware-controls-1' of https://github.com/MaartenBent/wxWidgets

Update the font of some buddy controls when the DPI changes. Fix the
position of the statusbar after a DPI change. Add some changes that were
suggested in https://github.com/wxWidgets/wxWidgets/pull/1499 but left
out from it.

Some sizes are cached to improve the speed of the library. These sizes
become incorrect when the DPI changes. And are incorrect when a window
is created on a display with a different DPI. Fix this by checking if
the current DPI is the same as the DPI that was used when calculating
the size, otherwise recalculate the size.

Closes https://github.com/wxWidgets/wxWidgets/pull/1530
This commit is contained in:
Vadim Zeitlin
2019-09-07 14:53:26 +02:00
31 changed files with 241 additions and 137 deletions

View File

@@ -179,11 +179,15 @@ public:
/**
Returns the default size for the buttons. It is advised to make all the dialog
buttons of the same size and this function allows retrieving the (platform and
current font dependent size) which should be the best suited for this.
Returns the default size for the buttons. It is advised to make all the
dialog buttons of the same size and this function allows retrieving the
(platform, and current font dependent) size which should be the best
suited for this.
The optional @a win argument is new since wxWidgets 3.1.3 and allows to
get a per-monitor DPI specific size.
*/
static wxSize GetDefaultSize();
static wxSize GetDefaultSize(wxWindow* win = NULL);
/**
Returns the string label for the button.

View File

@@ -3322,15 +3322,15 @@ public:
/**
@class wxDPIChangedEvent
Event sent when the resolution (measured in dots-per-inch, or DPI) of the
monitor a window is on changes.
Event sent when the display scale factor or pixel density (measured in
dots-per-inch, or DPI) of the monitor a window is on changes.
The event is sent to each wxTopLevelWindow affected by the change, and all
its children recursively. For example, this event is sent to the window
when it is moved, by the user, from a display using some DPI value to
another display using a different DPI value. It also sent to all program
windows on the given display if its DPI changes due to a change in the
system settings.
its children recursively (post-order traversal). For example, this event is
sent to the window when it is moved, by the user, from a display using some
DPI value to another display using a different DPI value. It also sent to
all program windows on the given display if its DPI changes due to a change
in the system settings.
Currently this event is generated by wxMSW port if only and only if the
MSW application runs under Windows 10 Creators Update (v1703) or later and
@@ -3359,15 +3359,11 @@ class wxDPIChangedEvent : public wxEvent
public:
/**
Returns the old DPI.
@since 3.1.3
*/
wxSize GetOldDPI() const;
/**
Returns the new DPI.
@since 3.1.3
*/
wxSize GetNewDPI() const;
};