X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cb0afb266214f827417c42474168c7edda7c953e..4b1ae1539c549eb612e5d2b6876124138ce9cb4e:/src/msw/radiobox.cpp?ds=inline diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 58d056fa61..4b8f7161b9 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -294,7 +294,7 @@ bool wxRadioBox::Create(wxWindow *parent, m_radioHeight = new int[n]; WXHFONT hfont = 0; - wxFont& font = GetFont(); + wxFont font = GetFont(); if ( font.Ok() ) { hfont = font.GetResourceHandle(); @@ -346,12 +346,30 @@ bool wxRadioBox::Create(wxWindow *parent, (HMENU)NewControlId(), wxGetInstance(), NULL); SetSelection(0); - SetSize(pos.x, pos.y, size.x, size.y); + // Now that we have items determine what is the best size and set it. + SetBestSize(size); + return TRUE; } +bool wxRadioBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim, + long style, + const wxValidator& val, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + wxRadioBox::~wxRadioBox() { m_isBeingDeleted = TRUE; @@ -448,7 +466,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const { // the radiobox should be big enough for its buttons int cx1, cy1; - wxGetCharSize(m_hWnd, &cx1, &cy1, &GetFont()); + wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont()); int extraHeight = cy1; @@ -507,7 +525,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) #endif int cx1, cy1; - wxGetCharSize(m_hWnd, &cx1, &cy1, & GetFont()); + wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont()); // Attempt to have a look coherent with other platforms: We compute the // biggest toggle dim, then we align all items according this value. @@ -766,10 +784,10 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn) HWND hwndBtn = (HWND)hWndBtn; if ( !s_wndprocRadioBtn ) - s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC); + s_wndprocRadioBtn = (WXFARPROC)wxGetWindowProc(hwndBtn); - ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc); - ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this); + wxSetWindowProc(hwndBtn, wxRadioBtnWndProc); + wxSetWindowUserData(hwndBtn, this); } void wxRadioBox::SendNotificationEvent() @@ -807,7 +825,7 @@ bool wxRadioBox::SetFont(const wxFont& font) // our window proc // ---------------------------------------------------------------------------- -long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +WXLRESULT wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { switch ( nMsg ) { @@ -823,7 +841,7 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - return (WXHBRUSH)brush->GetResourceHandle(); + return (WXLRESULT)brush->GetResourceHandle(); } #endif // Win32 @@ -875,9 +893,6 @@ WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSE HDC hdc = (HDC)pDC; wxColour colBack = GetBackgroundColour(); - if (!IsEnabled()) - colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); - ::SetBkColor(hdc, wxColourToRGB(colBack)); ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); @@ -917,8 +932,8 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, NMHDR* hdr = (NMHDR *)lParam; if ( hdr->code == TTN_NEEDTEXT ) { - wxRadioBox *radiobox = (wxRadioBox *) - ::GetWindowLong(hwnd, GWL_USERDATA); + wxRadioBox * + radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); @@ -939,8 +954,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, case WM_KEYDOWN: { - wxRadioBox *radiobox = (wxRadioBox *) - ::GetWindowLong(hwnd, GWL_USERDATA); + wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); @@ -999,8 +1013,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, case WM_SETFOCUS: case WM_KILLFOCUS: { - wxRadioBox *radiobox = (wxRadioBox *) - ::GetWindowLong(hwnd, GWL_USERDATA); + wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); @@ -1018,8 +1031,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, #ifdef __WIN32__ case WM_HELP: { - wxRadioBox *radiobox = (wxRadioBox *) - ::GetWindowLong(hwnd, GWL_USERDATA); + wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );