From a8eccd21c7902c223392c472f7a6ca61bde97863 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Oct 2017 19:46:52 +0100 Subject: [PATCH] Implement wxProgressDialog::DoGetSize() for the native dialog too DoGetPosition() was done in 1ef1f8fda6d48594809e11c18194184ba9372b0f, implement DoGetSize() too now in order to give a chance Centre() (which needs both position and size to work). See #17768. --- include/wx/msw/progdlg.h | 1 + src/msw/progdlg.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/wx/msw/progdlg.h b/include/wx/msw/progdlg.h index 08495c8e46..6db08be01d 100644 --- a/include/wx/msw/progdlg.h +++ b/include/wx/msw/progdlg.h @@ -44,6 +44,7 @@ public: virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; virtual void DoGetPosition(int *x, int *y) const wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; virtual void Fit() wxOVERRIDE; virtual bool Show( bool show = true ) wxOVERRIDE; diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index feba07ea9b..2cf0fac97b 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -838,6 +838,24 @@ void wxProgressDialog::DoGetPosition(int *x, int *y) const wxGenericProgressDialog::DoGetPosition(x, y); } +void wxProgressDialog::DoGetSize(int *width, int *height) const +{ +#ifdef wxHAS_MSW_TASKDIALOG + if ( HasNativeTaskDialog() ) + { + const wxRect r = GetTaskDialogRect(); + if ( width ) + *width = r.width; + if ( height ) + *height = r.height; + + return; + } +#endif // wxHAS_MSW_TASKDIALOG + + wxGenericProgressDialog::DoGetSize(width, height); +} + void wxProgressDialog::Fit() { #ifdef wxHAS_MSW_TASKDIALOG