X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4438caf41af49f00f3c8137ac801871f59cce386..12db77cab1054d288a2b3e2d07e58ad1d6386a53:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index f0ab1b8a2d..48666d0859 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -110,7 +110,7 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) } } - wxASSERT_MSG( selectedButton != -1, _T("click from alien button?") ); + wxASSERT_MSG( selectedButton != -1, wxT("click from alien button?") ); if ( selectedButton != m_selectedButton ) { @@ -253,11 +253,11 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, (WPARAM)font.GetResourceHandle(), 0L); } - m_subControls.Append((wxObject *)(WXWORD)newId); + m_subControls.Append((wxObject *)(WXDWORD)(WXWORD)newId); } // Create a dummy radio control to end the group. - (void)CreateWindowEx(0, RADIO_CLASS, _T(""), WS_GROUP | RADIO_FLAGS, + (void)CreateWindowEx(0, RADIO_CLASS, wxT(""), WS_GROUP | RADIO_FLAGS, 0, 0, 0, 0, hwndParent, (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -289,14 +289,14 @@ wxRadioBox::~wxRadioBox() wxString wxRadioBox::GetLabel(int item) const { - wxCHECK_MSG( item >= 0 && item < m_noItems, _T(""), _T("invalid radiobox index") ); + wxCHECK_MSG( item >= 0 && item < m_noItems, wxT(""), wxT("invalid radiobox index") ); return wxGetWindowText(m_radioButtons[item]); } void wxRadioBox::SetLabel(int item, const wxString& label) { - wxCHECK_RET( item >= 0 && item < m_noItems, _T("invalid radiobox index") ); + wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") ); m_radioWidth[item] = m_radioHeight[item] = -1; SetWindowText((HWND)m_radioButtons[item], label.c_str()); @@ -308,7 +308,7 @@ void wxRadioBox::SetLabel(int item, wxBitmap *bitmap) m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN; m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN; */ - wxFAIL_MSG(_T("not implemented")); + wxFAIL_MSG(wxT("not implemented")); } int wxRadioBox::FindString(const wxString& s) const @@ -324,7 +324,7 @@ int wxRadioBox::FindString(const wxString& s) const void wxRadioBox::SetSelection(int N) { - wxCHECK_RET( (N >= 0) && (N < m_noItems), _T("invalid radiobox index") ); + wxCHECK_RET( (N >= 0) && (N < m_noItems), wxT("invalid radiobox index") ); // Following necessary for Win32s, because Win32s translate BM_SETCHECK if (m_selectedButton >= 0 && m_selectedButton < m_noItems) @@ -353,6 +353,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); + int widthOld, heightOld; + GetSize(&widthOld, &heightOld); + int xx = x; int yy = y; @@ -418,21 +421,36 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) int extraHeight = cy1; -#if !CTL3D +#if defined(CTL3D) && !CTL3D // Requires a bigger group box in plain Windows extraHeight *= 3; extraHeight /= 2; #endif - MoveWindow(GetHwnd(), x_offset, y_offset, - totWidth+cx1, totHeight+extraHeight, - TRUE); + // only change our width/height if asked for + if ( width == -1 ) + { + if ( sizeFlags & wxSIZE_AUTO_WIDTH ) + width = totWidth + cx1; + else + width = widthOld; + } + + if ( height == -1 ) + { + if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) + height = totHeight + extraHeight; + else + height = heightOld; + } + + MoveWindow(GetHwnd(), x_offset, y_offset, width, height, TRUE); x_offset += cx1; y_offset += cy1; } -#if (!CTL3D) +#if defined(CTL3D) && (!CTL3D) y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label // JACS 2/12/93. CTL3D draws group label quite high. #endif @@ -573,7 +591,7 @@ bool wxRadioBox::Show(bool show) void wxRadioBox::Enable(int item, bool enable) { wxCHECK_RET( item >= 0 && item < m_noItems, - _T("invalid item in wxRadioBox::Enable()") ); + wxT("invalid item in wxRadioBox::Enable()") ); ::EnableWindow((HWND) m_radioButtons[item], enable); } @@ -594,7 +612,7 @@ bool wxRadioBox::Enable(bool enable) void wxRadioBox::Show(int item, bool show) { wxCHECK_RET( item >= 0 && item < m_noItems, - _T("invalid item in wxRadioBox::Show()") ); + wxT("invalid item in wxRadioBox::Show()") ); ::ShowWindow((HWND)m_radioButtons[item], show ? SW_SHOW : SW_HIDE); } @@ -664,37 +682,6 @@ void wxRadioBox::Command (wxCommandEvent & event) ProcessCommand (event); } -long wxRadioBox::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) -{ - long rc = 0; - bool processed = FALSE; - - switch ( msg ) - { - 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 ) - { - rc = HTCLIENT; - processed = TRUE; - } - } - break; - } - - if ( !processed ) - rc = wxControl::MSWWindowProc(msg, wParam, lParam); - - return rc; -} - void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn) { #ifdef __WIN32__ @@ -713,6 +700,7 @@ void wxRadioBox::SendNotificationEvent() { wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId); event.SetInt( m_selectedButton ); + event.SetString( GetString(m_selectedButton) ); event.SetEventObject( this ); ProcessCommand(event); } @@ -730,13 +718,13 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, { bool processed = TRUE; if ( msg != WM_KEYDOWN ) - processed = FALSE; + processed = FALSE; if ( processed ) { wxRadioBox *radiobox = (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA); - wxCHECK_MSG( radiobox, 0, _T("radio button without radio box?") ); + wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); int sel = radiobox->GetSelection(); @@ -771,7 +759,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, // fall through default: - processed = FALSE; + processed = FALSE; } if ( processed )