Merged trunk 47521:
Don't use exceptions to determine lack of a method implementation. Exceptions aren't designed for this in Cocoa. Instead, use respondsToSelector:. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -198,11 +198,8 @@ wxSize wxControl::DoGetBestSize() const
|
||||
wxASSERT(GetNSControl());
|
||||
/* We can ask single-celled controls for their cell and get its size */
|
||||
NSCell *cell = nil;
|
||||
NS_DURING
|
||||
cell = [GetNSControl() cell];
|
||||
NS_HANDLER
|
||||
// TODO: if anything other than method not implemented, re-raise
|
||||
NS_ENDHANDLER
|
||||
if([GetNSControl() respondsToSelector:@selector(cell)])
|
||||
cell = [GetNSControl() cell];
|
||||
if(cell)
|
||||
{
|
||||
NSSize cellSize = [cell cellSize];
|
||||
@@ -212,16 +209,10 @@ NS_ENDHANDLER
|
||||
}
|
||||
|
||||
/* multi-celled control? size to fit, get the size, then set it back */
|
||||
NSRect storedRect = [m_cocoaNSView frame];
|
||||
bool didFit = false;
|
||||
NS_DURING
|
||||
[GetNSControl() sizeToFit];
|
||||
didFit = true;
|
||||
NS_HANDLER
|
||||
// TODO: if anything other than method not implemented, re-raise
|
||||
NS_ENDHANDLER
|
||||
if(didFit)
|
||||
if([GetNSControl() respondsToSelector:@selector(sizeToFit)])
|
||||
{
|
||||
NSRect storedRect = [m_cocoaNSView frame];
|
||||
[GetNSControl() sizeToFit];
|
||||
NSRect cocoaRect = [m_cocoaNSView frame];
|
||||
wxSize size((int)ceil(cocoaRect.size.width),(int)ceil(cocoaRect.size.height));
|
||||
[m_cocoaNSView setFrame: storedRect];
|
||||
|
Reference in New Issue
Block a user