]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/radiobox.cpp
wxPaletteBase introduction. wxPalette::GetColoursCount() in interface of all platform...
[wxWidgets.git] / src / msw / radiobox.cpp
index 877146bb80f14b61259b461afb2eaa636029127b..d583c4f33710ff238969ff5d8fab8ae359f771ac 100644 (file)
     #include "wx/tooltip.h"
 #endif // wxUSE_TOOLTIPS
 
+#if defined(__WXWINCE__) && !defined(WS_EX_TRANSPARENT)
+#define WS_EX_TRANSPARENT 0
+#endif
+
 // TODO: wxCONSTRUCTOR
 #if 0 // wxUSE_EXTENDED_RTTI
 WX_DEFINE_FLAGS( wxRadioBoxStyle )
@@ -276,7 +280,7 @@ bool wxRadioBox::Create(wxWindow *parent,
 
     // create the static box
     if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
-                           pos, size, title, 0) )
+                           pos, size, title, WS_EX_TRANSPARENT) )
         return false;
 
     // and now create the buttons
@@ -831,81 +835,27 @@ bool wxRadioBox::SetFont(const wxFont& font)
 
 WXLRESULT wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 {
+#if RADIOBTN_PARENT_IS_RADIOBOX
     switch ( nMsg )
     {
-#ifdef __WIN32__
+        // handle this message to set correct colours for our buttons here
         case WM_CTLCOLORSTATIC:
-            // set the colour of the radio buttons to be the same as ours
-            {
-                HDC hdc = (HDC)wParam;
-
-                const wxColour& colBack = GetBackgroundColour();
-                ::SetBkColor(hdc, wxColourToRGB(colBack));
-                ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
-
-                wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
-
-                return (WXLRESULT)brush->GetResourceHandle();
-            }
-#endif // Win32
-
-        // VZ: this code breaks radiobox redrawing under Windows XP, don't use
-        //     it. If you need to get messages from the static controls,
-        //     create them as a child of another (non static) window
-#if 0
-        // This is required for the radiobox to be sensitive to mouse input,
-        // e.g. for Dialog Editor.
-        case WM_NCHITTEST:
             {
-                int xPos = LOWORD(lParam);  // horizontal position of cursor
-                int yPos = HIWORD(lParam);  // vertical position of cursor
-
-                ScreenToClient(&xPos, &yPos);
-
-                // Make sure you can drag by the top of the groupbox, but let
-                // other (enclosed) controls get mouse events also
-                if (yPos < 10)
-                    return (long)HTCLIENT;
+                WXHDC hdc;
+                WXHWND hwnd;
+                UnpackCtlColor(wParam, lParam, &hdc, &hwnd);
+
+                WXHBRUSH hbr = MSWControlColor((WXHDC)hdc);
+                if ( hbr )
+                    return (WXLRESULT)hbr;
+                //else: fall through to default window proc
             }
-            break;
-#endif // 0
     }
+#endif // RADIOBTN_PARENT_IS_RADIOBOX
 
     return wxControl::MSWWindowProc(nMsg, wParam, lParam);
 }
 
-WXHBRUSH wxRadioBox::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();
-
-    ::SetBkColor(hdc, wxColourToRGB(colBack));
-    ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
-
-    wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
-
-    return (WXHBRUSH)brush->GetResourceHandle();
-}
-
-
 // ---------------------------------------------------------------------------
 // window proc for radio buttons
 // ---------------------------------------------------------------------------