Factor out wxProgressDialog::GetTaskDialogRect()

No real changes, just prepare for implementing DoGetSize() in this class
by extracting the common part between the existing DoGetPosition() and
it in a new function.
This commit is contained in:
Vadim Zeitlin
2017-10-29 19:45:35 +01:00
parent df2a0eb67e
commit ffe84cfb99
2 changed files with 22 additions and 6 deletions

View File

@@ -68,6 +68,10 @@ private:
// been entered.
void UpdateExpandedInformation(int value);
// Get the task dialog geometry when using the native dialog.
wxRect GetTaskDialogRect() const;
wxProgressDialogTaskRunner *m_taskDialogRunner;
wxProgressDialogSharedData *m_sharedData;

View File

@@ -803,17 +803,29 @@ void wxProgressDialog::DoMoveWindow(int x, int y, int width, int height)
wxGenericProgressDialog::DoMoveWindow(x, y, width, height);
}
wxRect wxProgressDialog::GetTaskDialogRect() const
{
wxRect r;
#ifdef wxHAS_MSW_TASKDIALOG
if ( m_sharedData )
{
wxCriticalSectionLocker locker(m_sharedData->m_cs);
r = wxRectFromRECT(wxGetWindowRect(m_sharedData->m_hwnd));
}
#else // !wxHAS_MSW_TASKDIALOG
wxFAIL_MSG( "unreachable" );
#endif // wxHAS_MSW_TASKDIALOG/!wxHAS_MSW_TASKDIALOG
return r;
}
void wxProgressDialog::DoGetPosition(int *x, int *y) const
{
#ifdef wxHAS_MSW_TASKDIALOG
if ( HasNativeTaskDialog() )
{
wxRect r;
if ( m_sharedData )
{
wxCriticalSectionLocker locker(m_sharedData->m_cs);
r = wxRectFromRECT(wxGetWindowRect(m_sharedData->m_hwnd));
}
const wxRect r = GetTaskDialogRect();
if (x)
*x = r.x;
if (y)