X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a23fd0e1d1329a4a258b4defb3e0b0001b700c6e..bfac8499858dbb52ae4e712b718dcd08e777b4c2:/src/msw/listbox.cpp diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 4ca6a3955b..869a9116b5 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -20,35 +20,64 @@ #pragma hdrstop #endif +#include "wx/window.h" +#include "wx/msw/private.h" + #ifndef WX_PRECOMP - #include "wx/listbox.h" - #include "wx/settings.h" - #include "wx/brush.h" - #include "wx/font.h" - #include "wx/dc.h" +#include "wx/listbox.h" +#include "wx/settings.h" +#include "wx/brush.h" +#include "wx/font.h" +#include "wx/dc.h" #endif -#include "wx/msw/private.h" - -#include #include -#ifndef __TWIN32__ - #ifdef __GNUWIN32__ - #include - #endif +#ifdef __WXWINE__ + #if defined(GetWindowStyle) + #undef GetWindowStyle + #endif #endif -#ifdef GetCharWidth - #undef GetCharWidth -#endif +#include "wx/dynarray.h" +#include "wx/log.h" #if wxUSE_OWNER_DRAWN #include "wx/ownerdrw.h" #endif -#include "wx/dynarray.h" -#include "wx/log.h" +#ifndef __TWIN32__ + #if defined(__GNUWIN32__) + #include + #endif +#endif + +#ifdef __WXWINE__ + #ifndef ListBox_SetItemData + #define ListBox_SetItemData(hwndCtl, index, data) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_SETITEMDATA, (WPARAM)(int)(index), (LPARAM)(data))) + #endif + #ifndef ListBox_GetHorizontalExtent + #define ListBox_GetHorizontalExtent(hwndCtl) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_GETHORIZONTALEXTENT, 0L, 0L)) + #endif + #ifndef ListBox_GetSelCount + #define ListBox_GetSelCount(hwndCtl) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_GETSELCOUNT, 0L, 0L)) + #endif + #ifndef ListBox_GetSelItems + #define ListBox_GetSelItems(hwndCtl, cItems, lpItems) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_GETSELITEMS, (WPARAM)(int)(cItems), (LPARAM)(int *)(lpItems))) + #endif + #ifndef ListBox_GetTextLen + #define ListBox_GetTextLen(hwndCtl, index) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_GETTEXTLEN, (WPARAM)(int)(index), 0L)) + #endif + #ifndef ListBox_GetText + #define ListBox_GetText(hwndCtl, index, lpszBuffer) \ + ((int)(DWORD)SendMessage((hwndCtl), LB_GETTEXT, (WPARAM)(int)(index), (LPARAM)(LPCTSTR)(lpszBuffer))) + #endif +#endif #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) @@ -165,7 +194,8 @@ bool wxListBox::Create(wxWindow *parent, int height = size.y; m_windowStyle = style; - DWORD wstyle = WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY | LBS_HASSTRINGS; + DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | + LBS_NOTIFY | LBS_HASSTRINGS; if (m_windowStyle & wxLB_MULTIPLE) wstyle |= LBS_MULTIPLESEL; else if (m_windowStyle & wxLB_EXTENDED) @@ -295,7 +325,7 @@ void wxListBox::Append(const wxString& item) SetHorizontalExtent(item); } -void wxListBox::Append(const wxString& item, char *Client_data) +void wxListBox::Append(const wxString& item, void *Client_data) { int index = ListBox_AddString(GetHwnd(), item); m_noItems ++; @@ -314,7 +344,7 @@ void wxListBox::Append(const wxString& item, char *Client_data) SetHorizontalExtent(item); } -void wxListBox::Set(int n, const wxString *choices, char** clientData) +void wxListBox::Set(int n, const wxString *choices, void** clientData) { ShowWindow(GetHwnd(), SW_HIDE); ListBox_ResetContent(GetHwnd()); @@ -412,7 +442,7 @@ void wxListBox::Deselect(int N) SendMessage(GetHwnd(), LB_SETSEL, FALSE, N); } -char *wxListBox::GetClientData(int N) const +void *wxListBox::GetClientData(int N) const { wxCHECK_MSG( N >= 0 && N < m_noItems, NULL, "invalid index in wxListBox::GetClientData" ); @@ -420,7 +450,7 @@ char *wxListBox::GetClientData(int N) const return (char *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0); } -void wxListBox::SetClientData(int N, char *Client_data) +void wxListBox::SetClientData(int N, void *Client_data) { wxCHECK_RET( N >= 0 && N < m_noItems, "invalid index in wxListBox::SetClientData" ); @@ -627,7 +657,7 @@ void wxListBox::SetString(int N, const wxString& s) if (!(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED)) sel = GetSelection(); - char *oldData = (char *)wxListBox::GetClientData(N); + void *oldData = wxListBox::GetClientData(N); SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);