SetMarginWidth(0);
}
-wxOwnerDrawn *wxListBox::CreateItem(uint n)
+wxOwnerDrawn *wxListBox::CreateItem(size_t n)
{
return new wxListBoxItem();
}
// Subclass again to catch messages
SubclassWin((WXHWND)wx_list);
- uint ui;
- for (ui = 0; ui < (uint)n; ui++) {
+ size_t ui;
+ for (ui = 0; ui < (size_t)n; ui++) {
SendMessage(wx_list, LB_ADDSTRING, 0, (LPARAM)(const char *)choices[ui]);
}
#if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) {
- for (ui = 0; ui < (uint)n; ui++) {
+ for (ui = 0; ui < (size_t)n; ui++) {
// create new item which will process WM_{DRAW|MEASURE}ITEM messages
wxOwnerDrawn *pNewItem = CreateItem(ui);
pNewItem->SetName(choices[ui]);
wxListBox::~wxListBox(void)
{
#if USE_OWNER_DRAWN
- uint uiCount = m_aItems.Count();
+ size_t uiCount = m_aItems.Count();
while ( uiCount-- != 0 ) {
delete m_aItems[uiCount];
}
#if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) {
// first delete old items
- uint ui = m_aItems.Count();
+ size_t ui = m_aItems.Count();
while ( ui-- != 0 ) {
delete m_aItems[ui];
}
m_aItems.Empty();
// then create new ones
- for (ui = 0; ui < (uint)n; ui++) {
+ for (ui = 0; ui < (size_t)n; ui++) {
wxOwnerDrawn *pNewItem = CreateItem(ui);
pNewItem->SetName(choices[ui]);
m_aItems.Add(pNewItem);
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
// If we're prepared to use the existing size, then...
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
{
HDC dc = GetWindowDC(hwnd);
HFONT oldFont = 0;
if (GetFont() && GetFont()->GetResourceHandle())
- oldFont = ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
+ oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
GetTextMetrics(dc, &lpTextMetric);
SIZE extentXY;
HDC dc = GetWindowDC(hwnd);
HFONT oldFont = 0;
if (GetFont() && GetFont()->GetResourceHandle())
- oldFont = ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
+ oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont()->GetResourceHandle());
GetTextMetrics(dc, &lpTextMetric);
int i;
#if USE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) {
for ( i = 0; i < nItems; i++ ) {
- wxOwnerDrawn *pNewItem = CreateItem((uint)(pos + i));
+ wxOwnerDrawn *pNewItem = CreateItem((size_t)(pos + i));
pNewItem->SetName(items[i]);
- m_aItems.Insert(pNewItem, (uint)(pos + i));
+ m_aItems.Insert(pNewItem, (size_t)(pos + i));
ListBox_SetItemData(hwnd, i, pNewItem);
}
}
void wxListBox::SetString(int N, const wxString& s)
{
- int sel = GetSelection();
+ int sel = -1;
+ if (!(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED))
+ sel = GetSelection();
char *oldData = (char *)wxListBox::GetClientData(N);