Just silently return NULL like the other ports

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-06-06 23:15:50 +00:00
parent 88b1cfb651
commit c69279ef70
2 changed files with 28 additions and 26 deletions

View File

@@ -48,11 +48,11 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
{ {
Rect bounds ; Rect bounds ;
Str255 title ; Str255 title ;
MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewUniqueMenu() ; m_macPopUpMenuHandle = NewUniqueMenu() ;
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ; SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ; SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
@@ -161,7 +161,7 @@ int wxChoice::FindString(const wxString& s) const
for( int i = 0 ; i < GetCount() ; i++ ) for( int i = 0 ; i < GetCount() ; i++ )
{ {
if ( GetString( i ).IsSameAs(s, FALSE) ) if ( GetString( i ).IsSameAs(s, FALSE) )
return i ; return i ;
} }
return wxNOT_FOUND ; return wxNOT_FOUND ;
} }
@@ -186,14 +186,15 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(), wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
wxT("invalid index in wxChoice::SetClientData") ); wxT("invalid index in wxChoice::SetClientData") );
m_datas[n] = (char*) clientData ; m_datas[n] = (char*) clientData ;
} }
void *wxChoice::DoGetItemClientData(int n) const void *wxChoice::DoGetItemClientData(int n) const
{ {
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL, if ( n < 0 || (size_t)n >= m_datas.GetCount() )
wxT("invalid index in wxChoice::GetClientData") ); return (void*)NULL;
return (void *)m_datas[n]; return (void *)m_datas[n];
} }
@@ -207,7 +208,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const
return (wxClientData *)DoGetItemClientData(n); return (wxClientData *)DoGetItemClientData(n);
} }
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
{ {
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId ); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
int n = GetSelection(); int n = GetSelection();
@@ -232,11 +233,11 @@ wxSize wxChoice::DoGetBestSize() const
int wLine; int wLine;
#if TARGET_CARBON #if TARGET_CARBON
long metric ; long metric ;
GetThemeMetric(kThemeMetricPopupButtonHeight , &metric ); GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );
lbHeight = metric ; lbHeight = metric ;
#endif #endif
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font ) if ( font )
{ {
@@ -274,7 +275,7 @@ wxSize wxChoice::DoGetBestSize() const
// And just a bit more // And just a bit more
int cx = ::TextWidth( "X" , 0 , 1 ) ; int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ; lbWidth += cx ;
} }
return wxSize(lbWidth, lbHeight); return wxSize(lbWidth, lbHeight);
} }

View File

@@ -48,11 +48,11 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
{ {
Rect bounds ; Rect bounds ;
Str255 title ; Str255 title ;
MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ; MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
m_macPopUpMenuHandle = NewUniqueMenu() ; m_macPopUpMenuHandle = NewUniqueMenu() ;
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ; SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ; SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
@@ -161,7 +161,7 @@ int wxChoice::FindString(const wxString& s) const
for( int i = 0 ; i < GetCount() ; i++ ) for( int i = 0 ; i < GetCount() ; i++ )
{ {
if ( GetString( i ).IsSameAs(s, FALSE) ) if ( GetString( i ).IsSameAs(s, FALSE) )
return i ; return i ;
} }
return wxNOT_FOUND ; return wxNOT_FOUND ;
} }
@@ -186,14 +186,15 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(), wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
wxT("invalid index in wxChoice::SetClientData") ); wxT("invalid index in wxChoice::SetClientData") );
m_datas[n] = (char*) clientData ; m_datas[n] = (char*) clientData ;
} }
void *wxChoice::DoGetItemClientData(int n) const void *wxChoice::DoGetItemClientData(int n) const
{ {
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL, if ( n < 0 || (size_t)n >= m_datas.GetCount() )
wxT("invalid index in wxChoice::GetClientData") ); return (void*)NULL;
return (void *)m_datas[n]; return (void *)m_datas[n];
} }
@@ -207,7 +208,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const
return (wxClientData *)DoGetItemClientData(n); return (wxClientData *)DoGetItemClientData(n);
} }
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
{ {
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId ); wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
int n = GetSelection(); int n = GetSelection();
@@ -232,11 +233,11 @@ wxSize wxChoice::DoGetBestSize() const
int wLine; int wLine;
#if TARGET_CARBON #if TARGET_CARBON
long metric ; long metric ;
GetThemeMetric(kThemeMetricPopupButtonHeight , &metric ); GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );
lbHeight = metric ; lbHeight = metric ;
#endif #endif
{ {
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ; wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font ) if ( font )
{ {
@@ -274,7 +275,7 @@ wxSize wxChoice::DoGetBestSize() const
// And just a bit more // And just a bit more
int cx = ::TextWidth( "X" , 0 , 1 ) ; int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ; lbWidth += cx ;
} }
return wxSize(lbWidth, lbHeight); return wxSize(lbWidth, lbHeight);
} }