]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/radiobut.cpp
fixed memory allocation code of wxStreamBuffer to not realloc() new[]ed memory any...
[wxWidgets.git] / src / msw / radiobut.cpp
index d63f27cc79aa4e7fe43c689b05049254785f15d2..a9a7705f6011ac1c4c4f23783c61941047a1e4e6 100644 (file)
 #include <stdio.h>
 #include "wx/setup.h"
 #include "wx/radiobut.h"
+#include "wx/settings.h"
 #include "wx/brush.h"
 #endif
 
 #include "wx/msw/private.h"
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 // IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
-#endif
 
 bool wxRadioButton::MSWCommand(WXUINT param, WXWORD id)
 {
@@ -40,6 +39,7 @@ bool wxRadioButton::MSWCommand(WXUINT param, WXWORD id)
   {
     wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId);
     event.SetEventObject( this );
+    event.SetInt( GetValue() );
     ProcessCommand(event);
     return TRUE;
   }
@@ -54,7 +54,9 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
            const wxString& name)
 {
   SetName(name);
+#if wxUSE_VALIDATORS
   SetValidator(validator);
+#endif // wxUSE_VALIDATORS
 
   if (parent) parent->AddChild(this);
 
@@ -78,7 +80,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
     groupStyle = WS_GROUP;
 
 //  long msStyle = groupStyle | RADIO_FLAGS;
-  long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE ;
+  long msStyle = groupStyle | BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE /* | WS_CLIPSIBLINGS */;
 
   bool want3D;
   WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
@@ -163,6 +165,37 @@ void wxRadioButton::Command (wxCommandEvent & event)
   ProcessCommand (event);
 }
 
+WXHBRUSH wxRadioButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
+                               WXUINT message,
+                               WXWPARAM wParam,
+                               WXLPARAM lParam)
+{
+#if wxUSE_CTL3D
+    if ( m_useCtl3D )
+    {
+        HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
+        return (WXHBRUSH) hbrush;
+    }
+#endif // wxUSE_CTL3D
+
+    HDC hdc = (HDC)pDC;
+    if (GetParent()->GetTransparentBackground())
+        SetBkMode(hdc, TRANSPARENT);
+    else
+        SetBkMode(hdc, OPAQUE);
+
+    wxColour colBack = GetBackgroundColour();
+
+    if (!IsEnabled())
+        colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+
+    ::SetBkColor(hdc, wxColourToRGB(colBack));
+    ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+
+    wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
+
+    return (WXHBRUSH)brush->GetResourceHandle();
+}
 
 // Not implemented
 #if 0