X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/381dd4bfa29889c54640a61a99b9764309a53f57..f4cc15cd73753bccecfc845328be3caf955b0864:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 547dd8b7b4..20ce47a197 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -182,7 +182,7 @@ bool wxRadioBox::Create(wxWindow *parent, { // initialize members m_selectedButton = -1; - m_noItems = n; + m_noItems = 0; m_majorDim = majorDim == 0 ? n : majorDim; m_noRowsOrCols = majorDim; @@ -196,6 +196,7 @@ bool wxRadioBox::Create(wxWindow *parent, return FALSE; // and now create the buttons + m_noItems = n; #if RADIOBTN_PARENT_IS_RADIOBOX HWND hwndParent = GetHwnd(); #else @@ -658,7 +659,7 @@ bool wxRadioBox::ContainsHWND(WXHWND hWnd) const return FALSE; } -void wxRadioBox::Command (wxCommandEvent & event) +void wxRadioBox::Command(wxCommandEvent & event) { SetSelection (event.m_commandInt); ProcessCommand (event); @@ -687,6 +688,44 @@ void wxRadioBox::SendNotificationEvent() ProcessCommand(event); } +bool wxRadioBox::SetFont(const wxFont& font) +{ + if ( !wxControl::SetFont(font) ) + { + // nothing to do + return FALSE; + } + + // also set the font of our radio buttons + WXHFONT hfont = wxFont(font).GetResourceHandle(); + for ( int n = 0; n < m_noItems; n++ ) + { + ::SendMessage((HWND)m_radioButtons[n], WM_SETFONT, (WPARAM)hfont, 0L); + } + + return TRUE; +} + +long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + // This is required for the radiobox to be sensitive to mouse input, + // e.g. for Dialog Editor. + if (nMsg == 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; + } + + return wxControl::MSWWindowProc(nMsg, wParam, lParam); +} + // --------------------------------------------------------------------------- // window proc for radio buttons // ---------------------------------------------------------------------------