]> git.saurik.com Git - wxWidgets.git/commitdiff
replaced OnCtlColor(7 params) with MSWControlColor(1 param)
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Nov 2004 19:40:31 +0000 (19:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Nov 2004 19:40:31 +0000 (19:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

18 files changed:
include/wx/msw/choice.h
include/wx/msw/combobox.h
include/wx/msw/dialog.h
include/wx/msw/scrolbar.h
include/wx/msw/slider95.h
include/wx/msw/slidrmsw.h
include/wx/msw/textctrl.h
include/wx/msw/wince/textctrlce.h
include/wx/msw/window.h
src/msw/choice.cpp
src/msw/combobox.cpp
src/msw/dialog.cpp
src/msw/scrolbar.cpp
src/msw/slider95.cpp
src/msw/slidrmsw.cpp
src/msw/textctrl.cpp
src/msw/wince/textctrlce.cpp
src/msw/window.cpp

index 15b1bb818e4808536873e2b32ae4f05ffb34b2f7..5348fd5e26e067c1a42f65e749c7cf1be292bd6a 100644 (file)
@@ -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);
index 5d1a96acb17143195b2cd32b0e1824d83cd9ae57..c9eb4dcbe8ae9d5301c6cd2abd29f7c2750fac4d 100644 (file)
@@ -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:
index aae10aa23edfc8e2c9f073732136fc8a974d9bfb..81a00606e04fd028a6c001c514aa6c68501cfe81 100644 (file)
@@ -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
     // ----------------
 
index 032f6a1d7f8dee6ef23736fe231449a249307faa..b41c9e04cd799ec064cdf95ba0f0cce24ac6ba31 100644 (file)
@@ -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);
 
index 14a1f9dc7c6f18b3fdd1cd5c83da2979b7a4af66..a47175afb527dd93c680afdcad6762a3f9be7d6e 100644 (file)
@@ -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);
 
index 9409797ccc30e557636956f004ac61d1a07bc134..9edfa755bb872f3c543e21b45440ffc410ea4d3a 100644 (file)
@@ -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);
 
index db47342cb0eb56d0c7f762d690053bce0c8fca53..4c6b18e6681503ed387958ed51e933070881c29f 100644 (file)
@@ -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);
index c328911a424429d2b94b0d92828e4e6e1a3ea78a..bad7dda85ad7909b7293bd9e105f23747212ba82 100644 (file)
@@ -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();
 
index 996e063f8a4b2e856ff86691ee952988a4c70541..27041df751ee591750a71bf589c37c78e64c0409 100644 (file)
@@ -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);
 
index 7d293875c9e926948ef45fa5bde3533fa357fb57..362f98ccb71f7b3fad21fcad4d0289b140554f2f 100644 (file)
@@ -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__)
+
index 9fb4b7ffe2d2f2958a14be0c2cd447cea7b8d8ed..c14341c0019261ce5aa98854ebc55e38687cbf77 100644 (file)
@@ -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);
index 829a5503d96230b50e10f54064146bdadbcf3322..d4967646023e40e4f017e6378602733ea8dba2d2 100644 (file)
@@ -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
-
index d789c490a7687afdf01e85e9199c50bf2d96b3f3..ef305d4e54e056c2131cd90a1c79f02c4ebba756 100644 (file)
@@ -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);
index 4187123630beb5b457efb5adef6683f749bc04a3..b6c68e1628cb4f4f22e9b859882c88ef2d02e34c 100644 (file)
@@ -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)
 {
index 09e384bc7ad5b6945a3b480e8a668dfb8524fef4..45879e284c40c3a6e08c8ace1cde985d98cd3cd6 100644 (file)
@@ -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;
index 113994facce2382911e21a744c1624f0e183c8aa..6cbd982bc684e6faa740111205d32068e8a8bf13 100644 (file)
@@ -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()
index 9fe3ce639450606385246d340bfd5e4df027ac88..2732c41a99492d7c842314d1c1c15ac0aa92d6e5 100644 (file)
@@ -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);
index ec18e90f2558c0fa658a94de16bdd4e76978a00e..be1e77d539a9468673443e837199e82e8ed6f7c5 100644 (file)
@@ -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;