const wxValidator& validator,
const wxString& name)
{
+ if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
+ return false;
+
m_noItems = 0 ; // this will be increased by our append command
m_selected = 0;
Str255 fontName ;
SInt16 fontSize ;
Style fontStyle ;
- SInt16 fontNum ;
#if TARGET_CARBON
GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
#else
// Find the widest line
for(int i = 0; i < GetCount(); i++) {
wxString str(GetString(i));
- wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+ #if wxUSE_UNICODE
+ Point bounds={0,0} ;
+ SInt16 baseline ;
+ ::GetThemeTextDimensions( wxMacCFStringHolder( str ) ,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &bounds,
+ &baseline );
+ wLine = bounds.h ;
+ #else
+ wxCharBuffer text = wxMacStringToCString( str ) ;
+ wLine = ::TextWidth( text , 0 , strlen(text) ) ;
+ #endif
lbWidth = wxMax(lbWidth, wLine);
}
LCellSize( pt , (ListHandle)m_macList ) ;
}
-void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
+void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
{
Boolean wasDoubleClick = false ;
long result ;
/* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
{
+ // FIXME: look in ancestors, not just parent.
wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
- wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
- new_event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( new_event );
+ if (win)
+ {
+ wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+ new_event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( new_event );
+ }
}
else if ( event.GetKeyCode() == WXK_TAB )
{