From: Vadim Zeitlin Date: Fri, 19 Nov 2004 19:40:31 +0000 (+0000) Subject: replaced OnCtlColor(7 params) with MSWControlColor(1 param) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/48fa6bd38ac743f4067e74d4168168ae3a4a068e replaced OnCtlColor(7 params) with MSWControlColor(1 param) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index 15b1bb818e..5348fd5e26 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -84,8 +84,7 @@ public: // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH MSWControlColor(WXHDC hDC); protected: virtual void DoMoveWindow(int x, int y, int width, int height); diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index 5d1a96acb1..c9eb4dcbe8 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -104,9 +104,6 @@ public: bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - WXHWND GetEditHWND() const; protected: diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index aae10aa23e..81a00606e0 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -82,11 +82,6 @@ public: // Windows callbacks WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); -#if wxUSE_CTL3D - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); -#endif // wxUSE_CTL3D - // obsolete methods // ---------------- diff --git a/include/wx/msw/scrolbar.h b/include/wx/msw/scrolbar.h index 032f6a1d7f..b41c9e04cd 100644 --- a/include/wx/msw/scrolbar.h +++ b/include/wx/msw/scrolbar.h @@ -54,8 +54,6 @@ public: void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWOnScroll(int orientation, WXWORD wParam, WXWORD pos, WXHWND control); diff --git a/include/wx/msw/slider95.h b/include/wx/msw/slider95.h index 14a1f9dc7c..a47175afb5 100644 --- a/include/wx/msw/slider95.h +++ b/include/wx/msw/slider95.h @@ -78,8 +78,6 @@ public: virtual bool ContainsHWND(WXHWND hWnd) const; void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWOnScroll(int orientation, WXWORD wParam, WXWORD pos, WXHWND control); diff --git a/include/wx/msw/slidrmsw.h b/include/wx/msw/slidrmsw.h index 9409797ccc..9edfa755bb 100644 --- a/include/wx/msw/slidrmsw.h +++ b/include/wx/msw/slidrmsw.h @@ -73,8 +73,6 @@ public: virtual bool ContainsHWND(WXHWND hWnd) const; void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWOnScroll(int orientation, WXWORD wParam, WXWORD pos, WXHWND control); diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index db47342cb0..4c6b18e668 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -148,8 +148,7 @@ public: virtual void Command(wxCommandEvent& event); virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH MSWControlColor(WXHDC hDC); #if wxUSE_RICHEDIT virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); diff --git a/include/wx/msw/wince/textctrlce.h b/include/wx/msw/wince/textctrlce.h index c328911a42..bad7dda85a 100644 --- a/include/wx/msw/wince/textctrlce.h +++ b/include/wx/msw/wince/textctrlce.h @@ -139,8 +139,6 @@ public: virtual void Command(wxCommandEvent& event); virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual void AdoptAttributesFromHWND(); diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 996e063f8a..27041df751 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -305,12 +305,7 @@ public: bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleCtlColor(WXHBRUSH *hBrush, - WXHDC hdc, - WXHWND hWnd, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); + bool HandleCtlColor(WXHBRUSH *hBrush, WXHDC hdc, WXHWND hWnd); bool HandlePaletteChanged(WXHWND hWndPalChange); bool HandleQueryNewPalette(); @@ -369,14 +364,6 @@ public: // with or 0 for the default brush virtual WXHBRUSH MSWControlColor(WXHDC hDC); - // deprecated, for compatibility only: override MSWControlColor instead - virtual WXHBRUSH OnCtlColor(WXHDC hDC, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - // Responds to colour changes: passes event on to children. void OnSysColourChanged(wxSysColourChangedEvent& event); diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 7d293875c9..362f98ccb7 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -582,8 +582,10 @@ WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) WXHWND hwnd; UnpackCtlColor(wParam, lParam, &hdc, &hwnd); - return (WXLRESULT)OnCtlColor(hdc, hwnd, 0, - nMsg, wParam, lParam); + WXHBRUSH hbr = MSWControlColor((WXHDC)hdc); + if ( hbr ) + return (WXLRESULT)hbr; + //else: fall through to default window proc } } @@ -615,24 +617,13 @@ bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return true; } -WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) - ) +WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC) { - HDC hdc = (HDC)pDC; - wxColour colBack = GetBackgroundColour(); + if ( !IsEnabled() ) + return MSWControlColorDisabled(hDC); - if (!IsEnabled()) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - - return (WXHBRUSH)brush->GetResourceHandle(); + return wxChoiceBase::MSWControlColorSolid(hDC); } #endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__) + diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 9fb4b7ffe2..c14341c001 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -213,27 +213,6 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam); } -WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, - WXHWND WXUNUSED(pWnd), - WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam)) -{ - HDC hdc = (HDC)pDC; - wxColour colBack = GetBackgroundColour(); - - if (!IsEnabled()) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - - return (WXHBRUSH)brush->GetResourceHandle(); -} - // ---------------------------------------------------------------------------- // wxComboBox callbacks // ---------------------------------------------------------------------------- @@ -244,16 +223,6 @@ WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara // colour correctly (to be the same as our own one) switch ( nMsg ) { - // we have to handle both: one for the normal case and the other for - // wxCB_READONLY - case WM_CTLCOLOREDIT: - case WM_CTLCOLORSTATIC: - WXHDC hdc; - WXHWND hwnd; - UnpackCtlColor(wParam, lParam, &hdc, &hwnd); - - return (WXLRESULT)OnCtlColor(hdc, hwnd, 0, nMsg, wParam, lParam); - case CB_SETCURSEL: // Selection was set with SetSelection. Update the value too. if ((int)wParam > GetCount()) @@ -261,7 +230,6 @@ WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara else m_value = GetString(wParam); break; - } return wxChoice::MSWWindowProc(nMsg, wParam, lParam); diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 829a5503d9..d496764602 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -530,18 +530,3 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar return rc; } -#if wxUSE_CTL3D - -// Define for each class of dialog and control -WXHBRUSH wxDialog::OnCtlColor(WXHDC WXUNUSED(pDC), - WXHWND WXUNUSED(pWnd), - WXUINT WXUNUSED(nCtlColor), - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam) -{ - return (WXHBRUSH)Ctl3dCtlColorEx(message, wParam, lParam); -} - -#endif // wxUSE_CTL3D - diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index d789c490a7..ef305d4e54 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -363,13 +363,6 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS #endif } - -WXHBRUSH wxScrollBar::OnCtlColor(WXHDC WXUNUSED(pDC), WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam)) -{ - return 0; -} - void wxScrollBar::Command(wxCommandEvent& event) { SetThumbPosition(event.m_commandInt); diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 4187123630..b6c68e1628 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -722,20 +722,6 @@ void wxSlider95::SetRange(int minValue, int maxValue) } } -WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ -#ifndef __WXWINCE__ - if ( nCtlColor == CTLCOLOR_SCROLLBAR ) - return 0; -#else - if ( nCtlColor != CTLCOLOR_STATIC ) - return 0; -#endif - // Otherwise, it's a static - return wxControl::OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); -} - // For trackbars only void wxSlider95::SetTickFreq(int n, int pos) { diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 09e384bc7a..45879e284c 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -481,16 +481,6 @@ void wxSliderMSW::SetRange(int minValue, int maxValue) } } -WXHBRUSH wxSliderMSW::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) -{ - if ( nCtlColor == CTLCOLOR_SCROLLBAR ) - return 0; - - // Otherwise, it's a static - return wxControl::OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam); -} - void wxSliderMSW::SetPageSize(int pageSize) { m_pageSize = pageSize; diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 113994facc..6cbd982bc6 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1856,38 +1856,12 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return true; } -WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), -#if wxUSE_CTL3D - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam -#else - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) -#endif - ) +WXHBRUSH wxTextCtrl::MSWControlColor(WXHDC hDC) { -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif // wxUSE_CTL3D - - HDC hdc = (HDC)pDC; - wxColour colBack = GetBackgroundColour(); - - if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + if ( !IsEnabled() && !HasFlag(wxTE_MULTILINE) ) + return MSWControlColorDisabled(hDC); - return (WXHBRUSH)brush->GetResourceHandle(); + return wxTextCtrlBase::MSWControlColorSolid(hDC); } bool wxTextCtrl::AdjustSpaceLimit() diff --git a/src/msw/wince/textctrlce.cpp b/src/msw/wince/textctrlce.cpp index 9fe3ce6394..2732c41a99 100644 --- a/src/msw/wince/textctrlce.cpp +++ b/src/msw/wince/textctrlce.cpp @@ -1040,40 +1040,6 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return true; } -WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), -#if wxUSE_CTL3D - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam -#else - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam) -#endif - ) -{ -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif // wxUSE_CTL3D - - HDC hdc = (HDC)pDC; - wxColour colBack = GetBackgroundColour(); - - if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - - return (WXHBRUSH)brush->GetResourceHandle(); -} - bool wxTextCtrl::AdjustSpaceLimit() { unsigned int limit = ::SendMessage(GetBuddyHwnd(), EM_GETLIMITTEXT, 0, 0); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index ec18e90f25..be1e77d539 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2706,12 +2706,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l WXHWND hwnd; UnpackCtlColor(wParam, lParam, &hdc, &hwnd); - processed = HandleCtlColor(&rc.hBrush, - (WXHDC)hdc, - (WXHWND)hwnd, - message, - wParam, - lParam); + processed = HandleCtlColor(&rc.hBrush, (WXHDC)hdc, (WXHWND)hwnd); } break; #endif // !__WXMICROWIN__ @@ -3740,17 +3735,12 @@ bool wxWindowMSW::HandleDisplayChange() #ifndef __WXMICROWIN__ -bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, - WXHDC pDC, - WXHWND pWnd, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam) +bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC pDC, WXHWND pWnd) { #if wxUSE_CONTROLS - wxControl *item = (wxControl *)FindItemByHWND(pWnd, true); + wxWindow *item = FindItemByHWND(pWnd, true); if ( item ) - *brush = item->OnCtlColor(pDC, pWnd, 0, message, wParam, lParam); + *brush = item->MSWControlColor(pDC); else #endif // wxUSE_CONTROLS *brush = NULL; @@ -3760,17 +3750,6 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, #endif // __WXMICROWIN__ -// Define for each class of dialog and control -WXHBRUSH wxWindowMSW::OnCtlColor(WXHDC hDC, - WXHWND WXUNUSED(hWnd), - WXUINT WXUNUSED(nCtlColor), - WXUINT WXUNUSED(message), - WXWPARAM WXUNUSED(wParam), - WXLPARAM WXUNUSED(lParam)) -{ - return MSWControlColor(hDC); -} - WXHBRUSH wxWindowMSW::MSWControlColor(WXHDC WXUNUSED(hDC)) { return (WXHBRUSH)0;