X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/05be97a86687be701a2da9661aa104e9a493dfb9..88932ec82d048d006cdc81bd309f5e59aee799ac:/src/msw/colordlg.cpp?ds=sidebyside diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index 5994521841..688ca17380 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -27,6 +27,7 @@ #if wxUSE_COLOURDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) #include "wx/colordlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -34,8 +35,6 @@ #include "wx/colour.h" #include "wx/gdicmn.h" #include "wx/utils.h" - #include "wx/dialog.h" - #include "wx/cmndata.h" #include "wx/math.h" #endif @@ -77,11 +76,11 @@ wxColourDialogHookProc(HWND hwnd, { CHOOSECOLOR *pCC = (CHOOSECOLOR *)lParam; wxColourDialog * const - dialog = wx_reinterpret_cast(wxColourDialog *, pCC->lCustData); + dialog = reinterpret_cast(pCC->lCustData); const wxString title = dialog->GetTitle(); if ( !title.empty() ) - ::SetWindowText(hwnd, title.wx_str()); + ::SetWindowText(hwnd, title.t_str()); dialog->MSWOnInitDone((WXHWND)hwnd); } @@ -116,6 +115,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // initialize the struct used by Windows CHOOSECOLOR chooseColorStruct; memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR)); @@ -126,8 +127,8 @@ int wxColourDialog::ShowModal() COLORREF custColours[16]; for ( i = 0; i < WXSIZEOF(custColours); i++ ) { - if ( m_colourData.m_custColours[i].IsOk() ) - custColours[i] = wxColourToRGB(m_colourData.m_custColours[i]); + if ( m_colourData.GetCustomColour(i).IsOk() ) + custColours[i] = wxColourToRGB(m_colourData.GetCustomColour(i)); else custColours[i] = RGB(255,255,255); } @@ -135,7 +136,7 @@ int wxColourDialog::ShowModal() chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR); if ( m_parent ) chooseColorStruct.hwndOwner = GetHwndOf(m_parent); - chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.m_dataColour); + chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.GetColour()); chooseColorStruct.lpCustColors = custColours; chooseColorStruct.Flags = CC_RGBINIT | CC_ENABLEHOOK; @@ -152,7 +153,9 @@ int wxColourDialog::ShowModal() // occurred const DWORD err = CommDlgExtendedError(); if ( err ) + { wxLogError(_("Colour selection dialog failed with error %0lx."), err); + } return wxID_CANCEL; } @@ -164,7 +167,7 @@ int wxColourDialog::ShowModal() wxRGBToColour(m_colourData.m_custColours[i], custColours[i]); } - wxRGBToColour(m_colourData.m_dataColour, chooseColorStruct.rgbResult); + wxRGBToColour(m_colourData.GetColour(), chooseColorStruct.rgbResult); // this doesn't seem to work (contrary to what MSDN implies) on current // Windows versions: CC_FULLOPEN is never set on return if it wasn't