m_label = label ;
+ OSStatus err;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl(this) ;
if ( id == wxID_HELP )
ControlButtonContentInfo info ;
info.contentType = kControlContentIconRef ;
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef);
- verify_noerr ( CreateRoundButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , kControlRoundButtonNormalSize ,
- &info , m_peer->GetControlRefAddr() ) );
+ err = CreateRoundButtonControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
+ &bounds, kControlRoundButtonNormalSize,
+ &info, m_peer->GetControlRefAddr() );
}
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
{
}
#endif
- verify_noerr ( CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , m_peer->GetControlRefAddr() ) );
+ err = CreatePushButtonControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
+ &bounds, CFSTR(""), m_peer->GetControlRefAddr() );
}
else
{
ControlButtonContentInfo info ;
info.contentType = kControlNoContent ;
- verify_noerr(CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""),
- kControlBevelButtonLargeBevel , kControlBehaviorPushbutton , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
+ err = CreateBevelButtonControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""),
+ kControlBevelButtonLargeBevel, kControlBehaviorPushbutton,
+ &info, 0, 0, 0, m_peer->GetControlRefAddr() );
}
+ verify_noerr( err );
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid Mac control") ) ;
- MacPostControlCreate(pos, size) ;
+ MacPostControlCreate( pos, size );
return true;
}
wxInt32 wxButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
{
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
+ wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId);
event.SetEventObject(this);
ProcessCommand(event);
return false;
if ( !CurrentDragHasSupportedFormat() )
- return false ;
+ return false;
- bool transferred = false ;
+ bool transferred = false;
if ( gTrackingGlobals.m_currentSource != NULL )
{
- wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
+ wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject();
- if ( data )
+ if (data != NULL)
{
- size_t formatcount = data->GetFormatCount() ;
+ size_t formatcount = data->GetFormatCount();
wxDataFormat *array = new wxDataFormat[formatcount];
data->GetAllFormats( array );
- for (size_t i = 0; !transferred && i < formatcount ; i++)
+ for (size_t i = 0; !transferred && i < formatcount; i++)
{
- wxDataFormat format = array[i] ;
+ wxDataFormat format = array[i];
if ( m_dataObject->IsSupported( format ) )
{
int size = data->GetDataSize( format );
- transferred = true ;
+ transferred = true;
if (size == 0)
{
- m_dataObject->SetData( format , 0 , 0 );
+ m_dataObject->SetData( format, 0, 0 );
}
else
{
char *d = new char[size];
- data->GetDataHere( format , (void*) d );
- m_dataObject->SetData( format , size , d ) ;
- delete [] d ;
+ data->GetDataHere( format, (void*)d );
+ m_dataObject->SetData( format, size, d );
+ delete [] d;
}
}
}
- delete [] array ;
+ delete [] array;
}
}
dataSize++ ;
}
- theData = new char[dataSize];
+ if (dataSize > 0)
+ theData = new char[dataSize];
+ else
+ theData = NULL;
GetFlavorData( (DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L );
if ( theType == kScrapFlavorTypeText )
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
- OSErr result;
+ OSStatus result;
DragReference theDrag;
RgnHandle dragRegion;
if ((result = NewDrag(&theDrag)) != noErr)
{
if ( !gTrackingGlobalsInstalled )
{
- OSErr result;
+ OSStatus err;
- result = InstallTrackingHandler( NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L, &gTrackingGlobals );
- wxASSERT( result == noErr );
+ err = InstallTrackingHandler( NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L, &gTrackingGlobals );
+ verify_noerr( err );
- result = InstallReceiveHandler( NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals );
- wxASSERT( result == noErr );
+ err = InstallReceiveHandler( NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals );
+ verify_noerr( err );
gTrackingGlobalsInstalled = true;
}
{
switch ( result )
{
- case wxDragCopy :
+ case wxDragCopy:
{
wxCursor cursor(wxCURSOR_COPY_ARROW) ;
cursor.MacInstall() ;
}
break ;
- case wxDragMove :
+ case wxDragMove:
{
wxCursor cursor(wxCURSOR_ARROW) ;
cursor.MacInstall() ;
}
break ;
- case wxDragNone :
+ case wxDragNone:
{
wxCursor cursor(wxCURSOR_NO_ENTRY) ;
cursor.MacInstall() ;
delete [] uniChars ;
if ( charBuf != buf )
delete [] charBuf ;
-
+
return result ;
}
bool wxWindowMac::MacCanFocus() const
{
// TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so
- // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning, but the value range
- // is nowhere documented
+ // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning,
+ // but the value range is nowhere documented
Boolean keyExistsAndHasValidFormat ;
- CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue ( CFSTR("AppleKeyboardUIMode" ) ,
- kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
-
+ CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue( CFSTR("AppleKeyboardUIMode" ) ,
+ kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat );
+
if ( keyExistsAndHasValidFormat && fullKeyboardAccess > 0 )
+ {
return true ;
+ }
else
{
UInt32 features = 0 ;
wxApp::s_captureWindow = this ;
}
-wxWindow* wxWindowBase::GetCapture()
+wxWindow * wxWindowBase::GetCapture()
{
return wxApp::s_captureWindow ;
}
#endif
-// Old style file-manager drag&drop
+// Old-style File Manager Drag & Drop
void wxWindowMac::DragAcceptFiles(bool accept)
{
// TODO:
int& x, int& y,
int& w, int& h , bool adjustOrigin ) const
{
- bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
-
// the desired size, minus the border pixels gives the correct size of the control
-
x = (int)pos.x;
y = (int)pos.y;
w = wxMax(size.x, 0) ; // WidthDefault( size.x );
h = wxMax(size.y, 0) ; // HeightDefault( size.y ) ;
+ bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ;
if ( !isCompositing )
GetParent()->MacWindowToRootWindow( &x , &y ) ;