X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd71308fc89eac2dd212b715eba68a993fa78f53..4d94751752c081c289a1d8f159405487dbbe4e68:/src/msw/listbox.cpp diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 711d73cf00..273b9a61be 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -198,35 +198,33 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, // Even with extended styles, need to combine with WS_BORDER // for them to look right. - if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) - || (m_windowStyle & wxRAISED_BORDER) - || (m_windowStyle & wxSUNKEN_BORDER) - || (m_windowStyle & wxDOUBLE_BORDER) ) { + if ( want3D || wxStyleHasBorder(m_windowStyle) ) + { wstyle |= WS_BORDER; } - HWND wx_list = CreateWindowEx(exStyle, "LISTBOX", NULL, + m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "LISTBOX", NULL, wstyle | WS_CHILD, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - m_hWnd = (WXHWND)wx_list; + wxCHECK_MSG( m_hWnd, FALSE, "Failed to create listbox" ); #if CTL3D if (want3D) { - Ctl3dSubclassCtl(wx_list); + Ctl3dSubclassCtl(hwnd); m_useCtl3D = TRUE; } #endif // Subclass again to catch messages - SubclassWin((WXHWND)wx_list); + SubclassWin(m_hWnd); size_t ui; for (ui = 0; ui < (size_t)n; ui++) { - SendMessage(wx_list, LB_ADDSTRING, 0, (LPARAM)(const char *)choices[ui]); + Append(choices[ui]); } #if wxUSE_OWNER_DRAWN @@ -236,19 +234,19 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, wxOwnerDrawn *pNewItem = CreateItem(ui); pNewItem->SetName(choices[ui]); m_aItems.Add(pNewItem); - ListBox_SetItemData(wx_list, ui, pNewItem); + ListBox_SetItemData(hwnd, ui, pNewItem); } } #endif - if ((m_windowStyle & wxLB_MULTIPLE) == 0) - SendMessage(wx_list, LB_SETCURSEL, 0, 0); + if ( (m_windowStyle & wxLB_MULTIPLE) == 0 ) + SendMessage(hwnd, LB_SETCURSEL, 0, 0); SetFont(* parent->GetFont()); SetSize(x, y, width, height); - ShowWindow(wx_list, SW_SHOW); + Show(TRUE); return TRUE; } @@ -296,7 +294,7 @@ void wxListBox::Append(const wxString& item) #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { - wxOwnerDrawn *pNewItem = CreateItem(-1); // dummy argument + wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument pNewItem->SetName(item); m_aItems.Add(pNewItem); ListBox_SetItemData(hwnd, index, pNewItem);