// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "listbox.h"
#endif
#include "wx/ownerdrw.h"
#endif
-#ifndef __TWIN32__
- #ifdef __GNUWIN32_OLD__
- #include "wx/msw/gnuwin32/extra.h"
- #endif
+#ifdef __GNUWIN32_OLD__
+ #include "wx/msw/gnuwin32/extra.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+/*
+TODO PROPERTIES
+ selection
+ content
+ item
+*/
+
// ============================================================================
// list box item declaration and implementation
// ============================================================================
int height = size.y;
m_windowStyle = style;
- DWORD wstyle = WS_VISIBLE | WS_VSCROLL | WS_TABSTOP |
- LBS_NOTIFY | LBS_HASSTRINGS /* | WS_CLIPSIBLINGS */;
+ DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_TABSTOP |
+ LBS_NOTIFY | LBS_HASSTRINGS ;
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
_T("only one of listbox selection modes can be specified") );
if (m_windowStyle & wxLB_SORT)
wstyle |= LBS_SORT;
-#if wxUSE_OWNER_DRAWN
+#if wxUSE_OWNER_DRAWN && !defined(__WXWINCE__)
if ( m_windowStyle & wxLB_OWNERDRAW ) {
// we don't support LBS_OWNERDRAWVARIABLE yet
wstyle |= LBS_OWNERDRAWFIXED;
// doesn't work properly
wstyle |= LBS_NOINTEGRALHEIGHT;
- bool want3D;
- WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
-
- // Even with extended styles, need to combine with WS_BORDER for them to
- // look right.
- if ( want3D || wxStyleHasBorder(m_windowStyle) )
- {
- wstyle |= WS_BORDER;
- }
+ WXDWORD exStyle = 0;
+ (void) MSWGetStyle(m_windowStyle, & exStyle) ;
m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("LISTBOX"), NULL,
- wstyle | WS_CHILD,
+ wstyle ,
0, 0, 0, 0,
(HWND)parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create listbox") );
-#if wxUSE_CTL3D
- if (want3D)
- {
- Ctl3dSubclassCtl(GetHwnd());
- m_useCtl3D = TRUE;
- }
-#endif
-
// Subclass again to catch messages
SubclassWin(m_hWnd);
// +1 for terminating NUL
wxString result;
- ListBox_GetText(GetHwnd(), N, result.GetWriteBuf(len + 1));
- result.UngetWriteBuf();
+ ListBox_GetText(GetHwnd(), N, wxStringBuffer(result, len + 1));
return result;
}
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
GetTextMetrics(dc, &lpTextMetric);
- int i;
- for (i = 0; i < m_noItems; i++)
+
+ // FIXME: buffer overflow!!
+ wxChar buf[1024];
+ for (int i = 0; i < m_noItems; i++)
{
- int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer);
- wxBuffer[len] = 0;
+ int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LPARAM)buf);
+ buf[len] = 0;
SIZE extentXY;
- ::GetTextExtentPoint(dc, (LPTSTR)wxBuffer, len, &extentXY);
+ ::GetTextExtentPoint(dc, buf, len, &extentXY);
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
if (extentX > largestExtent)
largestExtent = extentX;
MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
+#ifdef __WXWINCE__
+ HDC hdc = GetDC(NULL);
+#else
HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0);
+#endif
wxDC dc;
dc.SetHDC((WXHDC)hdc);