///////////////////////////////////////////////////////////////////////////////
-// Name: listbox.cpp
+// Name: src/os2/listbox.cpp
// Purpose: wxListBox
// Author: David Webster
// Modified by:
// Created: 10/09/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
class wxListBoxItem : public wxOwnerDrawn
{
public:
- wxListBoxItem(const wxString& rsStr = "");
+ wxListBoxItem(const wxString& rsStr = wxEmptyString);
};
wxListBoxItem::wxListBoxItem(
const wxString& rsStr
)
: wxOwnerDrawn( rsStr
- ,FALSE
+ ,false
)
{
//
SetMarginWidth(0);
} // end of wxListBoxItem::wxListBoxItem
-wxOwnerDrawn* wxListBox::CreateItem(
- size_t n
-)
+wxOwnerDrawn* wxListBox::CreateItem( size_t WXUNUSED(n) )
{
return new wxListBoxItem();
} // end of wxListBox::CreateItem
wxSystemSettings vSettings;
- SetBackgroundColour(vSettings.GetSystemColour(wxSYS_COLOUR_WINDOW));
+ SetBackgroundColour(vSettings.GetColour(wxSYS_COLOUR_WINDOW));
SetForegroundColour(pParent->GetForegroundColour());
m_windowId = (vId == -1) ? (int)NewControlId() : vId;
);
if (m_hWnd == 0)
{
- return FALSE;
+ return false;
}
//
//
wxColour vColour;
- vColour.Set(wxString("WHITE"));
+ vColour.Set(wxString(wxT("WHITE")));
LONG lColor = (LONG)vColour.GetPixel();
,sizeof(LONG)
,(PVOID)&lColor
);
- vColour.Set(wxString("NAVY"));
+ vColour.Set(wxString(wxT("NAVY")));
lColor = (LONG)vColour.GetPixel();
::WinSetPresParam( m_hWnd
,PP_HILITEBACKGROUNDCOLOR
,nHeight
);
delete pTextFont;
- return TRUE;
+ return true;
} // end of wxListBox::Create
wxListBox::~wxListBox()
::WinShowWindow(GetHwnd(), TRUE);
} // end of wxListBox::DoSetItems
-int wxListBox::FindString(
- const wxString& rsString
-) const
-{
- int nPos;
- LONG lTextLength;
- PSZ zStr;
-
-
- for (nPos = 0; nPos < m_nNumItems; nPos++)
- {
- lTextLength = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)nPos, (MPARAM)0));
- zStr = new char[lTextLength + 1];
- ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT(nPos, (SHORT)lTextLength), (MPARAM)zStr);
- if (rsString == (char*)zStr)
- {
- delete [] zStr;
- break;
- }
- delete [] zStr;
- }
- return nPos;
-} // end of wxListBox::FindString
-
void wxListBox::Clear()
{
#if wxUSE_OWNER_DRAWN
m_nNumItems = 0;
} // end of wxListBox::Clear
-void wxListBox::SetSelection(
+void wxListBox::DoSetSelection(
int N
, bool bSelect
)
int N
) const
{
- wxCHECK_MSG( N >= 0 && N < m_nNumItems, FALSE,
+ wxCHECK_MSG( N >= 0 && N < m_nNumItems, false,
wxT("invalid index in wxListBox::Selected") );
LONG lItem;
return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
} // end of wxListBox::HasMultipleSelection
-int wxListBox::GetSelections(
- wxArrayInt& raSelections
-) const
+int wxListBox::GetSelections( wxArrayInt& raSelections ) const
{
int nCount = 0;
LONG lItem;
}
return nCount;
}
- return 0;
}
else // single-selection listbox
{
) const
{
LONG lLen = 0;
- char* zBuf;
+ wxChar* zBuf;
wxString sResult;
- wxCHECK_MSG( N >= 0 && N < m_nNumItems, "",
+ wxCHECK_MSG( N >= 0 && N < m_nNumItems, wxEmptyString,
wxT("invalid index in wxListBox::GetClientData") );
lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)N, (MPARAM)0));
- zBuf = new char[lLen + 1];
+ zBuf = new wxChar[lLen + 1];
::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)N, (SHORT)lLen), (MPARAM)zBuf);
zBuf[lLen] = '\0';
sResult = zBuf;
int nListbox = 0;
int nCx;
int nCy;
+ wxFont vFont = (wxFont)GetFont();
for (int i = 0; i < m_nNumItems; i++)
{
wxGetCharSize( GetHWND()
,&nCx
,&nCy
- ,(wxFont*)&GetFont()
+ ,&vFont
);
nListbox += 3 * nCx;
//
// Some event we're not interested in
//
- return FALSE;
+ return false;
}
wxCommandEvent vEvent( eEvtType
,m_windowId
{
n = -1;
}
- vEvent.m_commandInt = n;
+ vEvent.SetInt(n);
return GetEventHandler()->ProcessEvent(vEvent);
} // end of wxListBox::OS2Command
//
// Only owner-drawn control should receive this message
//
- wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), FALSE);
+ wxCHECK(((m_windowStyle & wxLB_OWNERDRAW) == wxLB_OWNERDRAW), false);
//
// The item may be -1 for an empty listbox
//
if (lItemID == -1L)
- return FALSE;
+ return false;
wxListBoxItem* pData = (wxListBoxItem*)PVOIDFROMMR( ::WinSendMsg( GetHwnd()
,LM_QUERYITEMHANDLE
)
);
- wxCHECK(pData, FALSE );
+ wxCHECK(pData, false );
- wxDC vDc;
- wxRect vRect( wxPoint( pDrawStruct->rclItem.xLeft
- ,pDrawStruct->rclItem.yTop
- )
- ,wxPoint( pDrawStruct->rclItem.xRight
- ,pDrawStruct->rclItem.yBottom
- )
- );
+ wxDC vDc;
+ wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop );
+ wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom );
+ wxRect vRect( pt1, pt2 );
vDc.SetHPS(pDrawStruct->hps);
// For now we don't care about anything else
// just ignore the entire message!
//
- return TRUE;
+ return true;
}
}
return pData->OnDrawItem( vDc
#endif // ndef for wxUSE_OWNER_DRAWN
#endif // ndef for wxUSE_LISTBOX
-