Don't use wxGenericProgressDialog::m_windowStyle for wxPD_XXX styles.

Storing progress dialog styles in the normal window style didn't work because
they clashed with the TLW styles. The original progress dialog implementation
worked around this by using separate m_has{Abort,Skip}Button variables instead
of relying on wxPD_CAN_{ABORT,SKIP} style bits but this didn't work for the
other styles and was unclear so the new native MSW implementation blithely
used m_windowStyle to test or them and other bits which didn't work at all,
see #12416.

Solve this by using a separate m_pdStyle variable for storing the progress
dialog styles and use it for all wxPD_XXX tests in both the generic and MSW
code. This fixes some bugs (although not all of them yet) and allows to get
rid of m_has{Abort,Skip}Button.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-09-10 17:25:28 +00:00
parent 827833e2e2
commit e77570de2e
3 changed files with 50 additions and 57 deletions

View File

@@ -82,6 +82,14 @@ protected:
static wxString GetRemainingLabel() { return _("Remaining time:"); }
// Similar to wxWindow::HasFlag() but tests for a presence of a wxPD_XXX
// flag in our (separate) flags instead of using m_windowStyle.
bool HasPDFlag(int flag) const { return (m_pdStyle & flag) != 0; }
// Return the progress dialog style. Prefer to use HasPDFlag() if possible.
int GetPDStyle() const { return m_pdStyle; }
// Updates estimated times from a given progress bar value and stores the
// results in provided arguments.
void UpdateTimeEstimates(int value,
@@ -170,6 +178,12 @@ private:
// parent top level window (may be NULL)
wxWindow *m_parentTop;
// Progress dialog styles: this is not the same as m_windowStyle because
// wxPD_XXX constants clash with the existing TLW styles so to be sure we
// don't have any conflicts we just use a separate variable for storing
// them.
int m_pdStyle;
// skip some portion
bool m_skip;
@@ -192,9 +206,6 @@ private:
int m_ctdelay;
unsigned long m_display_estimated;
bool m_hasAbortButton,
m_hasSkipButton;
// for wxPD_APP_MODAL case
wxWindowDisabler *m_winDisabler;