///////////////////////////////////////////////////////////////////////////////
-// Name: listbox.cpp
+// Name: src/msw/listbox.cpp
// Purpose: wxListBox
// Author: Julian Smart
// Modified by: Vadim Zeitlin (owner drawn stuff)
#pragma hdrstop
#endif
-#include "wx/window.h"
-#include "wx/msw/private.h"
+#if wxUSE_LISTBOX
#ifndef WX_PRECOMP
#include "wx/listbox.h"
#include "wx/utils.h"
#endif
+#include "wx/window.h"
+#include "wx/msw/private.h"
+
#include <windowsx.h>
#ifdef __WXWINE__
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
_T("only one of listbox selection modes can be specified") );
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ wstyle |= WS_CLIPSIBLINGS;
if (m_windowStyle & wxLB_MULTIPLE)
wstyle |= LBS_MULTIPLESEL;
wxLogDebug(wxT("LB_SETITEMDATA failed"));
}
-bool wxListBox::HasMultipleSelection() const
-{
- return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
-}
-
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
void *oldData = NULL;
wxClientData *oldObjData = NULL;
- if ( m_clientDataItemsType == ClientData_Void )
+ if ( m_clientDataItemsType == wxClientData_Void )
oldData = GetClientData(N);
- else if ( m_clientDataItemsType == ClientData_Object )
+ else if ( m_clientDataItemsType == wxClientData_Object )
oldObjData = GetClientObject(N);
// delete and recreate it
wListbox += 3*cx;
- int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*(wxMax(m_noItems, 7));
+ // don't make the listbox too tall (limit height to 10 items) but don't
+ // make it too small neither
+ int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*
+ wxMin(wxMax(m_noItems, 3), 10);
return wxSize(wListbox, hListbox);
}
wxListBoxItem *pItem = (wxListBoxItem *)data;
- wxDC dc;
- dc.SetHDC((WXHDC)pStruct->hDC, FALSE);
+ wxDCTemp dc((WXHDC)pStruct->hDC);
wxRect rect(wxPoint(pStruct->rcItem.left, pStruct->rcItem.top),
wxPoint(pStruct->rcItem.right, pStruct->rcItem.bottom));
return pItem->OnDrawItem(dc, rect,
- (wxOwnerDrawn::wxODAction)pStruct->itemAction,
- (wxOwnerDrawn::wxODStatus)pStruct->itemState);
+ (wxOwnerDrawn::wxODAction)pStruct->itemAction,
+ (wxOwnerDrawn::wxODStatus)pStruct->itemState);
}
-#endif
- // wxUSE_OWNER_DRAWN
+#endif // wxUSE_OWNER_DRAWN
+
+#endif // wxUSE_LISTBOX