From 3dee36ae33edfa99460ce71e928678e1282df844 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 22 Jul 2005 18:08:18 +0000 Subject: [PATCH] [1231183] 'cleanup: mismatched indentation' and other cleanings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/app.cpp | 2 +- src/mac/carbon/checklst.cpp | 234 ++++++++++++++-------------- src/mac/carbon/clipbrd.cpp | 38 ++--- src/mac/carbon/combobxc.cpp | 11 +- src/mac/carbon/dc.cpp | 10 +- src/mac/carbon/dirmac.cpp | 12 +- src/mac/carbon/gsocket.cpp | 286 +++++++++++++++++------------------ src/mac/carbon/mediactrl.cpp | 69 ++++----- src/mac/carbon/menuitem.cpp | 62 ++++---- src/mac/carbon/radiobut.cpp | 102 +++++++------ src/mac/carbon/textctrl.cpp | 152 +++++++++---------- src/mac/carbon/window.cpp | 37 +++-- 12 files changed, 505 insertions(+), 510 deletions(-) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index cf429f727e..7f666b955e 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -1443,7 +1443,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi event.SetEventObject(def); def->Command(event); return true ; - } + } } /* generate wxID_CANCEL if command-. or has been pressed (typically in dialogs) */ else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) ) diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index 466c722e7b..77b77f2055 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -2,7 +2,7 @@ // Name: checklst.cpp // Purpose: implementation of wxCheckListBox class // Author: Stefan Csomor -// Modified by: +// Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor @@ -62,10 +62,10 @@ bool wxCheckListBox::Create(wxWindow *parent, } #if TARGET_API_MAC_OSX -static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, +static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) #else -static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, +static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message) #endif { @@ -108,100 +108,100 @@ static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrow event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : TRUE ); wxPostEvent( list->GetEventHandler() , event ) ; // direct notification is not always having the listbox GetSelection() having in synch with event - // list->GetEventHandler()->ProcessEvent(event) ; - } + // list->GetEventHandler()->ProcessEvent(event) ; + } } } } -static pascal OSStatus ListBoxGetSetItemData(ControlRef browser, - DataBrowserItemID itemID, DataBrowserPropertyID property, +static pascal OSStatus ListBoxGetSetItemData(ControlRef browser, + DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean changeValue) { - OSStatus err = errDataBrowserPropertyNotSupported; - - if ( ! changeValue ) - { - switch (property) - { - - case kTextColumnId: - { - long ref = GetControlReference( browser ) ; - if ( ref ) - { - wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; + OSStatus err = errDataBrowserPropertyNotSupported; + + if ( ! changeValue ) + { + switch (property) + { + + case kTextColumnId: + { + long ref = GetControlReference( browser ) ; + if ( ref ) + { + wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; int i = itemID - 1 ; if (i >= 0 && i < list->GetCount() ) - { - wxMacCFStringHolder cf( list->GetString(i) , list->GetFont().GetEncoding() ) ; - verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ; - err = noErr ; - } - } - } - break; - case kCheckboxColumnId : - { - long ref = GetControlReference( browser ) ; - if ( ref ) - { - wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; + { + wxMacCFStringHolder cf( list->GetString(i) , list->GetFont().GetEncoding() ) ; + verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ; + err = noErr ; + } + } + } + break; + case kCheckboxColumnId : + { + long ref = GetControlReference( browser ) ; + if ( ref ) + { + wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; int i = itemID - 1 ; if (i >= 0 && i < list->GetCount() ) - { - verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) ) ; - err = noErr ; - } - } - } - break ; - case kDataBrowserItemIsEditableProperty: - { - err = ::SetDataBrowserItemDataBooleanValue(itemData, true); - } - break; - - default: - break; - } - } - else - { - switch( property ) - { - case kCheckboxColumnId : - { - long ref = GetControlReference( browser ) ; - if ( ref ) - { - wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; + { + verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) ) ; + err = noErr ; + } + } + } + break ; + case kDataBrowserItemIsEditableProperty: + { + err = ::SetDataBrowserItemDataBooleanValue(itemData, true); + } + break; + + default: + break; + } + } + else + { + switch( property ) + { + case kCheckboxColumnId : + { + long ref = GetControlReference( browser ) ; + if ( ref ) + { + wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ; int i = itemID - 1 ; if (i >= 0 && i < list->GetCount() ) - { - // we have to change this behind the back, since Check() would be triggering another update round + { + // we have to change this behind the back, since Check() would be triggering another update round bool newVal = !list->IsChecked( i ) ; - verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , newVal ? kThemeButtonOn : kThemeButtonOff ) ) ; - err = noErr ; - list->m_checks[ i ] = newVal ; + verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , newVal ? kThemeButtonOn : kThemeButtonOff ) ) ; + err = noErr ; + list->m_checks[ i ] = newVal ; wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, list->GetId()); event.SetInt(i); event.SetEventObject(list); list->GetEventHandler()->ProcessEvent(event); - } - } - - } - break ; - - default : - break ; - } - } - - return err; + } + } + + } + break ; + + default : + break ; + } + } + + return err; } bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -211,11 +211,11 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - m_macIsUserPane = FALSE ; + m_macIsUserPane = false ; wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), _T("only one of listbox selection modes can be specified") ); - + if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) return false; @@ -226,7 +226,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, m_peer = new wxMacControl(this) ; verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , m_peer->GetControlRefAddr() ) ); - + DataBrowserSelectionFlags options = kDataBrowserDragSelect ; if ( style & wxLB_MULTIPLE ) @@ -241,47 +241,47 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, { options += kDataBrowserSelectOnlyOne ; } - verify_noerr(m_peer->SetSelectionFlags( options ) ); + verify_noerr(m_peer->SetSelectionFlags( options ) ); DataBrowserListViewColumnDesc columnDesc ; columnDesc.headerBtnDesc.titleOffset = 0; - columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - - columnDesc.headerBtnDesc.btnFontStyle.flags = - kControlUseFontMask | kControlUseJustMask; - - columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent; - columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault; - columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; - columnDesc.headerBtnDesc.btnFontStyle.style = normal; - columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" ); + columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; + + columnDesc.headerBtnDesc.btnFontStyle.flags = + kControlUseFontMask | kControlUseJustMask; + + columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent; + columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault; + columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; + columnDesc.headerBtnDesc.btnFontStyle.style = normal; + columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" ); // check column - columnDesc.headerBtnDesc.minimumWidth = 30 ; - columnDesc.headerBtnDesc.maximumWidth = 30; + columnDesc.headerBtnDesc.minimumWidth = 30 ; + columnDesc.headerBtnDesc.maximumWidth = 30; - columnDesc.propertyDesc.propertyID = kCheckboxColumnId; - columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType; - columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn | + columnDesc.propertyDesc.propertyID = kCheckboxColumnId; + columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType; + columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn | kDataBrowserDefaultPropertyFlags; - verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ; + verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ; // text column - columnDesc.headerBtnDesc.minimumWidth = 0; - columnDesc.headerBtnDesc.maximumWidth = 10000; + columnDesc.headerBtnDesc.minimumWidth = 0; + columnDesc.headerBtnDesc.maximumWidth = 10000; - columnDesc.propertyDesc.propertyID = kTextColumnId; - columnDesc.propertyDesc.propertyType = kDataBrowserTextType; - columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn + columnDesc.propertyDesc.propertyID = kTextColumnId; + columnDesc.propertyDesc.propertyType = kDataBrowserTextType; + columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 - | kDataBrowserListViewTypeSelectColumn + | kDataBrowserListViewTypeSelectColumn #endif - ; + ; + - - verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ; + verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ; verify_noerr( m_peer->AutoSizeListViewColumns() ) ; verify_noerr( m_peer->SetHasScrollBars( false , true ) ) ; @@ -291,12 +291,12 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, DataBrowserCallbacks callbacks ; callbacks.version = kDataBrowserLatestCallbacks; InitDataBrowserCallbacks(&callbacks); - callbacks.u.v1.itemDataCallback = NewDataBrowserItemDataUPP(ListBoxGetSetItemData); - callbacks.u.v1.itemNotificationCallback = + callbacks.u.v1.itemDataCallback = NewDataBrowserItemDataUPP(ListBoxGetSetItemData); + callbacks.u.v1.itemNotificationCallback = #if TARGET_API_MAC_OSX - (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ; + (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ; #else - NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ; + NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ; #endif m_peer->SetCallbacks( &callbacks); @@ -314,8 +314,8 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, } SetBestSize(size); // Needed because it is a wxControlWithItems - - return TRUE; + + return true; } // ---------------------------------------------------------------------------- @@ -324,7 +324,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, bool wxCheckListBox::IsChecked(size_t item) const { - wxCHECK_MSG( item < m_checks.GetCount(), FALSE, + wxCHECK_MSG( item < m_checks.GetCount(), false, _T("invalid index in wxCheckListBox::IsChecked") ); return m_checks[item] != 0; @@ -362,7 +362,7 @@ int wxCheckListBox::DoAppend(const wxString& item) int pos = wxListBox::DoAppend(item); // the item is initially unchecked - m_checks.Insert(FALSE, pos); + m_checks.Insert(false, pos); return pos; } @@ -374,7 +374,7 @@ void wxCheckListBox::DoInsertItems(const wxArrayString& items, int pos) size_t count = items.GetCount(); for ( size_t n = 0; n < count; n++ ) { - m_checks.Insert(FALSE, pos + n); + m_checks.Insert(false, pos + n); } } @@ -386,7 +386,7 @@ void wxCheckListBox::DoSetItems(const wxArrayString& items, void **clientData) size_t count = items.GetCount(); for ( size_t n = 0; n < count; n++ ) { - m_checks.Add(FALSE); + m_checks.Add(false); } } diff --git a/src/mac/carbon/clipbrd.cpp b/src/mac/carbon/clipbrd.cpp index 1252a067fc..801a140774 100644 --- a/src/mac/carbon/clipbrd.cpp +++ b/src/mac/carbon/clipbrd.cpp @@ -197,12 +197,12 @@ void wxClipboard::Clear() bool wxClipboard::Flush() { - return FALSE; + return false; } bool wxClipboard::Open() { - wxCHECK_MSG( !m_open, FALSE, wxT("clipboard already open") ); + wxCHECK_MSG( !m_open, false, wxT("clipboard already open") ); m_open = true ; return true ; } @@ -214,9 +214,9 @@ bool wxClipboard::IsOpened() const bool wxClipboard::SetData( wxDataObject *data ) { - wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") ); + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); - wxCHECK_MSG( data, FALSE, wxT("data is invalid") ); + wxCHECK_MSG( data, false, wxT("data is invalid") ); Clear(); // as we can only store one wxDataObject, this is the same in this @@ -226,9 +226,9 @@ bool wxClipboard::SetData( wxDataObject *data ) bool wxClipboard::AddData( wxDataObject *data ) { - wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") ); + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); - wxCHECK_MSG( data, FALSE, wxT("data is invalid") ); + wxCHECK_MSG( data, false, wxT("data is invalid") ); /* we can only store one wxDataObject */ Clear(); @@ -248,7 +248,7 @@ bool wxClipboard::AddData( wxDataObject *data ) size_t sz = data->GetDataSize( array[i] ) ; void* buf = malloc( sz + 1 ) ; if ( buf ) - { + { // empty the buffer because in some case GetDataHere does not fill buf memset(buf, 0, sz+1); data->GetDataHere( array[i] , buf ) ; @@ -293,23 +293,23 @@ void wxClipboard::Close() wxCHECK_RET( m_open, wxT("clipboard not open") ); m_open = false ; - - // Get rid of cached object. If this is not done copying from another application will - // only work once + + // Get rid of cached object. If this is not done copying from another application will + // only work once if (m_data) { delete m_data; m_data = (wxDataObject*) NULL; - } - + } + } bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) { - if ( m_data ) - { - return m_data->IsSupported( dataFormat ) ; - } + if ( m_data ) + { + return m_data->IsSupported( dataFormat ) ; + } #if TARGET_CARBON OSStatus err = noErr; ScrapRef scrapRef; @@ -324,11 +324,11 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) { if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr) { - return TRUE ; + return true ; } } } - return FALSE; + return false; #else long offset ; @@ -344,7 +344,7 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) bool wxClipboard::GetData( wxDataObject& data ) { - wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") ); + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); size_t formatcount = data.GetFormatCount() + 1 ; wxDataFormat *array = new wxDataFormat[ formatcount ]; diff --git a/src/mac/carbon/combobxc.cpp b/src/mac/carbon/combobxc.cpp index 5e88864db4..21eb3135c1 100644 --- a/src/mac/carbon/combobxc.cpp +++ b/src/mac/carbon/combobxc.cpp @@ -165,7 +165,7 @@ protected: event.SetEventObject(def); def->Command(event); return ; - } + } } return; @@ -219,7 +219,7 @@ private: }; BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice) - EVT_CHOICE(-1, wxComboBoxChoice::OnChoice) + EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice) END_EVENT_TABLE() wxComboBox::~wxComboBox() @@ -275,13 +275,13 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { { // we might not be fully constructed yet, therefore watch out... if ( m_choice ) - m_choice->SetSize(0, 0 , width, -1); + m_choice->SetSize(0, 0 , width, wxDefaultCoord); } else { wxCoord wText = width - POPUPWIDTH - MARGIN; m_text->SetSize(0, 0, wText, height); - m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, -1); + m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord); } #endif } @@ -419,7 +419,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, else { m_text = new wxComboBoxText(this); - if ( size.y == -1 ) { + if ( size.y == wxDefaultCoord ) { csize.y = m_text->GetSize().y ; } } @@ -846,4 +846,3 @@ wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR ProcessCommand(event); return noErr ; } - diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index 31ace9896a..3d79025059 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -365,7 +365,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask PixMapHandle bmappixels ; // Set foreground and background colours (for bitmaps depth = 1) if(bmp.GetDepth() == 1) - { + { RGBColor fore = MAC_WXCOLORREF(m_textForegroundColour.GetPixel()); RGBColor back = MAC_WXCOLORREF(m_textBackgroundColour.GetPixel()); RGBForeColor(&fore); @@ -1666,9 +1666,9 @@ void wxDC::MacInstallFont() const Pattern whiteColor ; ::BackPat(GetQDGlobalsWhite(&whiteColor)); } - + wxASSERT( m_font.Ok() ) ; - + ::TextFont( m_font.MacGetFontNum() ) ; ::TextSize( (short)(m_scaleY * m_font.MacGetFontSize()) ) ; @@ -1745,7 +1745,7 @@ void wxDC::MacInstallFont() const atsuTags, atsuSizes, atsuValues); wxASSERT_MSG( status == noErr , wxT("couldn't Modify ATSU style") ) ; - + } Pattern gPatterns[] = diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index 7c3651fd63..85dd3e2535 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -243,12 +243,12 @@ wxString wxDir::GetName() const wxString name; if ( m_data ) { - name = M_DIR->GetName(); - if ( !name.empty() && (name.Last() == _T('/')) ) - { - // chop off the last (back)slash - name.Truncate(name.length() - 1); - } + name = M_DIR->GetName(); + if ( !name.empty() && (name.Last() == _T('/')) ) + { + // chop off the last (back)slash + name.Truncate(name.length() - 1); + } } return name; diff --git a/src/mac/carbon/gsocket.cpp b/src/mac/carbon/gsocket.cpp index 4d6bcac66c..bf85902ca2 100644 --- a/src/mac/carbon/gsocket.cpp +++ b/src/mac/carbon/gsocket.cpp @@ -717,8 +717,8 @@ GSocketError GSocket::SetNonOriented() GSocketError GSocket::Connect(GSocketStream stream) { InetAddress addr ; - TEndpointInfo info; - OSStatus err = kOTNoError; + TEndpointInfo info; + OSStatus err = kOTNoError; TCall peer ; assert(this); @@ -746,21 +746,21 @@ GSocketError GSocket::Connect(GSocketStream stream) /* Create the socket */ #if TARGET_CARBON m_endpoint = - OTOpenEndpointInContext( OTCreateConfiguration( kTCPName) , 0 , &info , &err , NULL ) ; + OTOpenEndpointInContext( OTCreateConfiguration( kTCPName) , 0 , &info , &err , NULL ) ; #else m_endpoint = - OTOpenEndpoint( OTCreateConfiguration( kTCPName) , 0 , &info , &err ) ; + OTOpenEndpoint( OTCreateConfiguration( kTCPName) , 0 , &info , &err ) ; #endif if ( m_endpoint == kOTInvalidEndpointRef || err != kOTNoError ) { - m_endpoint = kOTInvalidEndpointRef ; - m_error = GSOCK_IOERR; - return GSOCK_IOERR; + m_endpoint = kOTInvalidEndpointRef ; + m_error = GSOCK_IOERR; + return GSOCK_IOERR; } err = OTBind( m_endpoint , nil , nil ) ; if ( err != kOTNoError ) { - return GSOCK_IOERR; + return GSOCK_IOERR; } SetDefaultEndpointModes( m_endpoint , this ) ; // TODO @@ -786,7 +786,7 @@ GSocketError GSocket::Connect(GSocketStream stream) { if (Output_Timeout() == GSOCK_TIMEDOUT) { - OTSndOrderlyDisconnect( m_endpoint ) ; + OTSndOrderlyDisconnect( m_endpoint ) ; m_endpoint = kOTInvalidEndpointRef ; /* m_error is set in _GSocket_Output_Timeout */ return GSOCK_TIMEDOUT; @@ -926,21 +926,21 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) if ( ( flags & GSOCK_INPUT_FLAG ) && ! ( m_detected & GSOCK_INPUT_FLAG ) ) { - size_t sz = 0 ; - OTCountDataBytes( m_endpoint , &sz ) ; - if ( state == T_INCON || sz > 0 ) - { - m_detected |= GSOCK_INPUT_FLAG ; - (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); - } + size_t sz = 0 ; + OTCountDataBytes( m_endpoint , &sz ) ; + if ( state == T_INCON || sz > 0 ) + { + m_detected |= GSOCK_INPUT_FLAG ; + (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); + } } if ( ( flags & GSOCK_INPUT_FLAG ) && ! ( m_detected & GSOCK_OUTPUT_FLAG ) ) { - if ( state == T_DATAXFER || state == T_INREL ) - { - m_detected |=GSOCK_OUTPUT_FLAG ; - (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]); - } + if ( state == T_DATAXFER || state == T_INREL ) + { + m_detected |=GSOCK_OUTPUT_FLAG ; + (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]); + } } */ return ( flags & m_detected ) ; @@ -1060,31 +1060,31 @@ void GSocket::UnsetCallback(GSocketEventFlags flags) int GSocket::Recv_Stream(char *buffer, int size) { - OTFlags flags ; - OTResult res ; - OTByteCount sz = 0 ; - - OTCountDataBytes( m_endpoint , &sz ) ; - if ( size > (int)sz ) - size = sz ; - res = OTRcv( m_endpoint , buffer , size , &flags ) ; - if ( res < 0 ) - { - return -1 ; - } - - // we simulate another read event if there are still bytes - if ( m_takesEvents ) - { - OTByteCount sz = 0 ; - OTCountDataBytes( m_endpoint , &sz ) ; - if ( sz > 0 ) - { - m_detected |= GSOCK_INPUT_FLAG ; - (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); - } - } - return res ; + OTFlags flags ; + OTResult res ; + OTByteCount sz = 0 ; + + OTCountDataBytes( m_endpoint , &sz ) ; + if ( size > (int)sz ) + size = sz ; + res = OTRcv( m_endpoint , buffer , size , &flags ) ; + if ( res < 0 ) + { + return -1 ; + } + + // we simulate another read event if there are still bytes + if ( m_takesEvents ) + { + OTByteCount sz = 0 ; + OTCountDataBytes( m_endpoint , &sz ) ; + if ( sz > 0 ) + { + m_detected |= GSOCK_INPUT_FLAG ; + (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); + } + } + return res ; } int GSocket::Recv_Dgram(char *buffer, int size) @@ -1127,11 +1127,11 @@ int GSocket::Recv_Dgram(char *buffer, int size) int GSocket::Send_Stream(const char *buffer, int size) { - OTFlags flags = 0 ; - OTResult res ; + OTFlags flags = 0 ; + OTResult res ; - res = OTSnd( m_endpoint , (void*) buffer , size , flags ) ; - return res ; + res = OTSnd( m_endpoint , (void*) buffer , size , flags ) ; + return res ; } int GSocket::Send_Dgram(const char *buffer, int size) @@ -1272,7 +1272,7 @@ GSocketError _GAddress_translate_from(GAddress *address, GSocketError _GAddress_translate_to(GAddress *address, InetAddress *addr) { - if ( !GSocket_Verify_Inited() ) + if ( !GSocket_Verify_Inited() ) return GSOCK_IOERR ; memset(addr, 0 , sizeof(struct InetAddress)); OTInitInetAddress( addr , address->m_port , address->m_host ) ; @@ -1307,7 +1307,7 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname) ret = OTInetStringToAddress( gInetSvcRef , (char*) hostname , &hinfo ) ; if ( ret != kOTNoError ) { - address->m_host = INADDR_NONE ; + address->m_host = INADDR_NONE ; address->m_error = GSOCK_NOHOST; return GSOCK_NOHOST; } @@ -1334,15 +1334,15 @@ GSocketError GAddress_INET_SetHostAddress(GAddress *address, struct service_entry { - const char * name ; - unsigned short port ; - const char * protocol ; + const char * name ; + unsigned short port ; + const char * protocol ; } ; typedef struct service_entry service_entry ; service_entry gServices[] = { - { "http" , 80 , "tcp" } + { "http" , 80 , "tcp" } } ; GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, @@ -1360,14 +1360,14 @@ GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, } for ( i = 0 ; i < sizeof( gServices) / sizeof( service_entry ) ; ++i ) { - if ( strcmp( port , gServices[i].name ) == 0 ) - { - if ( protocol == NULL || strcmp( protocol , gServices[i].protocol ) ) - { - address->m_port = gServices[i].port ; - return GSOCK_NOERROR; - } - } + if ( strcmp( port , gServices[i].name ) == 0 ) + { + if ( protocol == NULL || strcmp( protocol , gServices[i].protocol ) ) + { + address->m_port = gServices[i].port ; + return GSOCK_NOERROR; + } + } } if (isdigit(port[0])) @@ -1392,7 +1392,7 @@ GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port) GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t sbuf) { InetDomainName name ; - if ( !GSocket_Verify_Inited() ) + if ( !GSocket_Verify_Inited() ) return GSOCK_IOERR ; assert(address != NULL); @@ -1421,36 +1421,36 @@ unsigned short GAddress_INET_GetPort(GAddress *address) void GSocket::Enable_Events() { - if ( m_takesEvents ) - return ; + if ( m_takesEvents ) + return ; - { - OTResult state ; - m_takesEvents = true ; - state = OTGetEndpointState(m_endpoint); - - { - OTByteCount sz = 0 ; - OTCountDataBytes( m_endpoint , &sz ) ; - if ( state == T_INCON || sz > 0 ) - { - m_detected |= GSOCK_INPUT_FLAG ; - (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); - } - } - { - if ( state == T_DATAXFER || state == T_INREL ) - { - m_detected |=GSOCK_OUTPUT_FLAG ; - (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]); - } - } - } + { + OTResult state ; + m_takesEvents = true ; + state = OTGetEndpointState(m_endpoint); + + { + OTByteCount sz = 0 ; + OTCountDataBytes( m_endpoint , &sz ) ; + if ( state == T_INCON || sz > 0 ) + { + m_detected |= GSOCK_INPUT_FLAG ; + (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]); + } + } + { + if ( state == T_DATAXFER || state == T_INREL ) + { + m_detected |=GSOCK_OUTPUT_FLAG ; + (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]); + } + } + } } void GSocket::Disable_Events() { - m_takesEvents = false ; + m_takesEvents = false ; } /* _GSocket_Input_Timeout: @@ -1469,17 +1469,17 @@ GSocketError GSocket::Input_Timeout() while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 ) { - OTResult state ; - OTByteCount sz = 0 ; - state = OTGetEndpointState(m_endpoint); - - OTCountDataBytes( m_endpoint , &sz ) ; - if ( state == T_INCON || sz > 0 ) - { - m_takesEvents = formerTakesEvents ; - return GSOCK_NOERROR; - } - Microseconds(&now); + OTResult state ; + OTByteCount sz = 0 ; + state = OTGetEndpointState(m_endpoint); + + OTCountDataBytes( m_endpoint , &sz ) ; + if ( state == T_INCON || sz > 0 ) + { + m_takesEvents = formerTakesEvents ; + return GSOCK_NOERROR; + } + Microseconds(&now); } m_takesEvents = formerTakesEvents ; m_error = GSOCK_TIMEDOUT; @@ -1504,15 +1504,15 @@ GSocketError GSocket::Output_Timeout() while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 ) { - OTResult state ; - state = OTGetEndpointState(m_endpoint); - - if ( state == T_DATAXFER || state == T_INREL ) - { - m_takesEvents = formerTakesEvents ; - return GSOCK_NOERROR; - } - Microseconds(&now); + OTResult state ; + state = OTGetEndpointState(m_endpoint); + + if ( state == T_DATAXFER || state == T_INREL ) + { + m_takesEvents = formerTakesEvents ; + return GSOCK_NOERROR; + } + Microseconds(&now); } m_takesEvents = formerTakesEvents ; m_error = GSOCK_TIMEDOUT; @@ -1569,39 +1569,39 @@ void _GSocket_Internal_Proc(unsigned long e , void* d ) */ if ( /* (socket != NULL) && */ (socket->m_takesEvents)) { - switch (ev) - { - case T_LISTEN : - event = GSOCK_CONNECTION ; - break ; - case T_CONNECT : - event = GSOCK_CONNECTION ; - event2 = GSOCK_OUTPUT ; - { - TCall retCall; - - retCall.addr.buf = NULL; - retCall.addr.maxlen = 0; - retCall.opt.buf = NULL; - retCall.opt.maxlen = 0; - retCall.udata.buf = NULL; - retCall.udata.maxlen= 0; - OTRcvConnect( socket->m_endpoint , &retCall ) ; - } - break ; - case T_DISCONNECT : - event = GSOCK_LOST ; - break ; - case T_GODATA : - case T_GOEXDATA : - event = GSOCK_OUTPUT ; - break ; - case T_DATA : - event = GSOCK_INPUT ; - break ; - case T_EXDATA : - event = GSOCK_INPUT ; - break ; + switch (ev) + { + case T_LISTEN : + event = GSOCK_CONNECTION ; + break ; + case T_CONNECT : + event = GSOCK_CONNECTION ; + event2 = GSOCK_OUTPUT ; + { + TCall retCall; + + retCall.addr.buf = NULL; + retCall.addr.maxlen = 0; + retCall.opt.buf = NULL; + retCall.opt.maxlen = 0; + retCall.udata.buf = NULL; + retCall.udata.maxlen = 0; + OTRcvConnect( socket->m_endpoint , &retCall ) ; + } + break ; + case T_DISCONNECT : + event = GSOCK_LOST ; + break ; + case T_GODATA : + case T_GOEXDATA : + event = GSOCK_OUTPUT ; + break ; + case T_DATA : + event = GSOCK_INPUT ; + break ; + case T_EXDATA : + event = GSOCK_INPUT ; + break ; } if (event != GSOCK_MAX_EVENT) { diff --git a/src/mac/carbon/mediactrl.cpp b/src/mac/carbon/mediactrl.cpp index 7bfdb8b1fb..a461af5ef6 100644 --- a/src/mac/carbon/mediactrl.cpp +++ b/src/mac/carbon/mediactrl.cpp @@ -261,19 +261,19 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, if ( ! #if wxUSE_CREATEMOVIECONTROL - ctrl->wxWindow::Create(parent, id, pos, size, - wxWindow::MacRemoveBordersFromStyle(style), - name) + ctrl->wxWindow::Create(parent, id, pos, size, + wxWindow::MacRemoveBordersFromStyle(style), + name) #else - ctrl->wxControl::Create(parent, id, pos, size, - wxWindow::MacRemoveBordersFromStyle(style), - validator, name) + ctrl->wxControl::Create(parent, id, pos, size, + wxWindow::MacRemoveBordersFromStyle(style), + validator, name) #endif ) return false; #if wxUSE_VALIDATORS - ctrl->SetValidator(validator); + ctrl->SetValidator(validator); #endif m_ctrl = ctrl; @@ -411,28 +411,28 @@ void wxQTMediaBackend::FinishLoad() movieTrackEnabledOnly) != NULL) { #if wxUSE_CREATEMOVIECONTROL - // - //Native CreateMovieControl QT control (Thanks to Kevin Olliver's - //wxQTMovie for some of this). - // - #define GetControlPeer(whatever) ctrl->m_peer - wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl; - Rect bounds = wxMacGetBoundsForControl(m_ctrl, - m_ctrl->GetPosition(), - m_ctrl->GetSize()); - - //Dispose of old control for new one - if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() ) - GetControlPeer(m_ctrl)->Dispose(); - - //Options- - //kMovieControlOptionXXX - //HideController - hide the movie controller - //LocateTopLeft - movie is pinned to top left rather than centered in the control - //EnableEditing - Allows programmatic editing and dragn'drop - //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also - //SetKeysEnabled - Allows keyboard input - //ManuallyIdled - app handles movie idling rather than internal timer event loop + // + //Native CreateMovieControl QT control (Thanks to Kevin Olliver's + //wxQTMovie for some of this). + // + #define GetControlPeer(whatever) ctrl->m_peer + wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl; + Rect bounds = wxMacGetBoundsForControl(m_ctrl, + m_ctrl->GetPosition(), + m_ctrl->GetSize()); + + //Dispose of old control for new one + if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() ) + GetControlPeer(m_ctrl)->Dispose(); + + //Options- + //kMovieControlOptionXXX + //HideController - hide the movie controller + //LocateTopLeft - movie is pinned to top left rather than centered in the control + //EnableEditing - Allows programmatic editing and dragn'drop + //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also + //SetKeysEnabled - Allows keyboard input + //ManuallyIdled - app handles movie idling rather than internal timer event loop ::CreateMovieControl( (WindowRef) ctrl->MacGetTopLevelWindowRef(), //parent @@ -447,9 +447,9 @@ void wxQTMediaBackend::FinishLoad() ::EmbedControl(ctrl->m_peer->GetControlRef(), (ControlRef)ctrl->GetParent()->GetHandle()); #else - // - //"Emulation" - // + // + //"Emulation" + // SetMovieGWorld(m_movie, (CGrafPtr) GetWindowPort( @@ -671,8 +671,3 @@ void wxQTMediaBackend::Move(int x, int y, int w, int h) FORCE_LINK_ME(basewxmediabackends); #endif //wxUSE_MEDIACTRL - - - - - diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index 0ee572afc2..a2a3a583b9 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -2,7 +2,7 @@ // Name: menuitem.cpp // Purpose: wxMenuItem implementation // Author: Stefan Csomor -// Modified by: +// Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor @@ -43,11 +43,11 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, const wxString& text, const wxString& strHelp, wxItemKind kind, - wxMenu *pSubMenu) - : wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu) + wxMenu *pSubMenu) + :wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu) { wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ; - + // In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines // therefore these item must not be translated if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") ) @@ -56,32 +56,32 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, } m_radioGroup.start = -1; - m_isRadioGroupStart = FALSE; + m_isRadioGroupStart = false; } -wxMenuItem::~wxMenuItem() +wxMenuItem::~wxMenuItem() { } // change item state // ----------------- -void wxMenuItem::SetBitmap(const wxBitmap& bitmap) -{ - m_bitmap = bitmap; - UpdateItemBitmap() ; +void wxMenuItem::SetBitmap(const wxBitmap& bitmap) +{ + m_bitmap = bitmap; + UpdateItemBitmap(); } -void wxMenuItem::UpdateItemBitmap() +void wxMenuItem::UpdateItemBitmap() { if ( !m_parentMenu ) return ; - + MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ; if( mhandle == NULL || index == 0) return ; - + if ( m_bitmap.Ok() ) { #if wxUSE_BMPBUTTON @@ -90,19 +90,19 @@ void wxMenuItem::UpdateItemBitmap() if ( info.contentType != kControlNoContent ) { if ( info.contentType == kControlContentIconRef ) - SetMenuItemIconHandle( mhandle , index , + SetMenuItemIconHandle( mhandle , index , kMenuIconRefType , (Handle) info.u.iconRef ) ; } wxMacReleaseBitmapButton( &info ) ; -#endif +#endif } } -void wxMenuItem::UpdateItemStatus() +void wxMenuItem::UpdateItemStatus() { if ( !m_parentMenu ) return ; - + #if TARGET_CARBON if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId) { @@ -119,37 +119,37 @@ void wxMenuItem::UpdateItemStatus() EnableMenuCommand( NULL , kHICommandQuit ) ; } #endif - { + { MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ; if( mhandle == NULL || index == 0) return ; - UMAEnableMenuItem( mhandle , index , m_isEnabled ) ; - if ( IsCheckable() && IsChecked() ) + UMAEnableMenuItem( mhandle , index , m_isEnabled ) ; + if ( IsCheckable() && IsChecked() ) ::SetItemMark( mhandle , index , 0x12 ) ; // checkmark else ::SetItemMark( mhandle , index , 0 ) ; // no mark - UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; - wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; + wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; } } -void wxMenuItem::UpdateItemText() +void wxMenuItem::UpdateItemText() { if ( !m_parentMenu ) return ; - + MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ; if( mhandle == NULL || index == 0) return ; - UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; - wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; + wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; } @@ -176,7 +176,7 @@ void wxMenuItem::Enable(bool bDoEnable) } void wxMenuItem::UncheckRadio() { - if ( m_isChecked ) + if ( m_isChecked ) { wxMenuItemBase::Check( false ) ; UpdateItemStatus() ; @@ -187,7 +187,7 @@ void wxMenuItem::Check(bool bDoCheck) { wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") ); - if ( m_isChecked != bDoCheck ) + if ( m_isChecked != bDoCheck ) { if ( GetKind() == wxITEM_RADIO ) { @@ -195,7 +195,7 @@ void wxMenuItem::Check(bool bDoCheck) { wxMenuItemBase::Check( bDoCheck ) ; UpdateItemStatus() ; - + // get the index of this item in the menu const wxMenuItemList& items = m_parentMenu->GetMenuItems(); int pos = items.IndexOf(this); @@ -246,7 +246,7 @@ void wxMenuItem::SetText(const wxString& text) return; wxMenuItemBase::SetText(text); - + UpdateItemText() ; } @@ -255,7 +255,7 @@ void wxMenuItem::SetText(const wxString& text) void wxMenuItem::SetAsRadioGroupStart() { - m_isRadioGroupStart = TRUE; + m_isRadioGroupStart = true; } void wxMenuItem::SetRadioGroupStart(int start) diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index a265da4e8c..e7f983642d 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -6,7 +6,7 @@ // Created: ??/??/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -30,46 +30,46 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - m_macIsUserPane = FALSE ; - + m_macIsUserPane = false ; + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; - + m_label = label ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; - + m_peer = new wxMacControl(this) ; - verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , + verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , 0 , false /* no autotoggle */ , m_peer->GetControlRefAddr() ) ); - + MacPostControlCreate(pos,size) ; - m_cycle = this ; - - if (HasFlag(wxRB_GROUP)) - { - AddInCycle( NULL ) ; - } - else - { - /* search backward for last group start */ - wxRadioButton *chief = (wxRadioButton*) NULL; - wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); - while (node) + m_cycle = this ; + + if (HasFlag(wxRB_GROUP)) { - wxWindow *child = node->GetData(); - if (child->IsKindOf( CLASSINFO( wxRadioButton ) ) ) - { - chief = (wxRadioButton*) child; - if (child->HasFlag(wxRB_GROUP)) break; - } - node = node->GetPrevious(); + AddInCycle( NULL ) ; } - AddInCycle( chief ) ; - } - return TRUE; + else + { + /* search backward for last group start */ + wxRadioButton *chief = (wxRadioButton*) NULL; + wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); + while (node) + { + wxWindow *child = node->GetData(); + if (child->IsKindOf( CLASSINFO( wxRadioButton ) ) ) + { + chief = (wxRadioButton*) child; + if (child->HasFlag(wxRB_GROUP)) break; + } + node = node->GetPrevious(); + } + AddInCycle( chief ) ; + } + return true; } void wxRadioButton::SetValue(bool val) @@ -77,19 +77,19 @@ void wxRadioButton::SetValue(bool val) wxRadioButton *cycle; if ( m_peer->GetValue() == val ) return ; - + m_peer->SetValue( val ) ; - if (val) + if (val) { cycle=this->NextInCycle(); - if (cycle!=NULL) + if (cycle!=NULL) { - while (cycle!=this) - { - cycle->SetValue(false); - cycle=cycle->NextInCycle(); - } - } + while (cycle!=this) + { + cycle->SetValue(false); + cycle=cycle->NextInCycle(); + } + } } } @@ -104,12 +104,12 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } -wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) +wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) { // if already set -> no action if ( GetValue() ) return noErr; - + wxRadioButton *cycle; cycle=this->NextInCycle(); if (cycle!=NULL) { @@ -133,19 +133,21 @@ wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVE wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle) { wxRadioButton *next,*current; - - if (cycle==NULL) { + + if (cycle==NULL) + { m_cycle=this; return(this); - } - else { + } + else + { current=cycle; - while ((next=current->m_cycle)!=cycle) + while ((next=current->m_cycle)!=cycle) current=current->m_cycle; - m_cycle=cycle; - current->m_cycle=this; - return(cycle); - } -} + m_cycle=cycle; + current->m_cycle=this; + return(cycle); + } +} #endif diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 6980cdc9f3..ccbfe3de4e 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -64,7 +64,7 @@ #endif #ifndef __WXMAC_OSX__ -enum +enum { kTXNVisibilityTag = 'visb' /*set the visibility state of the object */ }; @@ -335,7 +335,7 @@ public : protected : OSStatus DoCreate(); - + void MacUpdatePosition() ; void MacActivatePaneText(Boolean setActive) ; void MacFocusPaneText(Boolean setFocus) ; @@ -349,7 +349,7 @@ private : Rect m_txnControlBounds ; Rect m_txnVisBounds ; #ifdef __WXMAC_OSX__ - static pascal void TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, + static pascal void TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon) ; static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ; ControlRef m_sbHorizontal ; @@ -456,13 +456,13 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, { SetEditable( false ) ; } - + SetCursor( wxCursor( wxCURSOR_IBEAM ) ) ; return true; } -void wxTextCtrl::MacSuperChangedPosition() +void wxTextCtrl::MacSuperChangedPosition() { wxWindow::MacSuperChangedPosition() ; GetPeer()->SuperChangedPosition() ; @@ -907,7 +907,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) event.SetEventObject(def); def->Command(event); return ; - } + } } // this will make wxWidgets eat the ENTER key so that @@ -1392,9 +1392,9 @@ public : TXNControlData m_data[1] ; } ; -wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer ) +wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer ) { - SetNeedsFocusRect( true ) ; + SetNeedsFocusRect( true ) ; } wxString wxMacMLTEControl::GetStringValue() const @@ -1486,7 +1486,7 @@ void wxMacMLTEControl::SetStringValue( const wxString &str) TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle ) { TXNFrameOptions frameOptions = - kTXNDontDrawCaretWhenInactiveMask + kTXNDontDrawCaretWhenInactiveMask #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 | kTXNDoFontSubstitutionMask #endif @@ -1523,17 +1523,17 @@ TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle ) void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, bool visible ) { - TXNControlTag iControlTags[] = - { - kTXNDoFontSubstitution, + TXNControlTag iControlTags[] = + { + kTXNDoFontSubstitution, kTXNWordWrapStateTag , }; - TXNControlData iControlData[] = - { - {true}, + TXNControlData iControlData[] = + { + {true}, {kTXNNoAutoWrap}, }; - + int toptag = WXSIZEOF( iControlTags ) ; if ( m_windowStyle & wxTE_MULTILINE ) @@ -1568,7 +1568,7 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo kTXNStartOffset, kTXNEndOffset) ); } - + if ( m_windowStyle & wxTE_PASSWORD ) { UniChar c = 0xA5 ; @@ -2006,13 +2006,13 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const TXNScrollInfoUPP gTXNScrollInfoProc = NULL ; ControlActionUPP gTXNScrollActionProc = NULL ; -pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation +pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon) { wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ; SInt32 value = wxMax( iValue , 0 ) ; SInt32 maximum = wxMax( iMaximumValue , 0 ) ; - + if ( iScrollBarOrientation == kTXNHorizontal ) { if ( mlte->m_sbHorizontal ) @@ -2039,12 +2039,12 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ; if ( mlte == NULL ) return ; - + if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal ) - return ; - - bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ; - + return ; + + bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ; + SInt32 minimum = 0 ; SInt32 maximum = GetControl32BitMaximum( controlRef ) ; SInt32 value = GetControl32BitValue( controlRef ) ; @@ -2064,7 +2064,7 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef delta = -GetControlViewSize( controlRef ) ; break ; case kControlIndicatorPart : - delta = value - + delta = value - ( isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue ) ; break ; default : @@ -2073,7 +2073,7 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef if ( delta != 0 ) { SInt32 newValue = value ; - + if ( partCode != kControlIndicatorPart ) { if( value + delta < minimum ) @@ -2084,13 +2084,13 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef SetControl32BitValue( controlRef , value + delta ) ; newValue = value + delta ; } - + SInt32 verticalDelta = isHorizontal ? 0 : delta ; SInt32 horizontalDelta = isHorizontal ? delta : 0 ; - + err = TXNScroll( mlte->m_txn , kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels, &verticalDelta , &horizontalDelta ); - + if ( isHorizontal ) mlte->m_lastHorizontalValue = newValue ; else @@ -2100,7 +2100,7 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef #endif // make correct activations -void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive) +void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive) { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); @@ -2113,29 +2113,29 @@ void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive) TXNFocus( m_txn, setActive); } -void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus) +void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus) { TXNFocus( m_txn, setFocus); } -// guards against inappropriate redraw (hidden objects drawing onto window) +// guards against inappropriate redraw (hidden objects drawing onto window) void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis) { ControlRef controlFocus = 0 ; GetKeyboardFocus( m_txnWindow , &controlFocus ) ; - + if ( controlFocus == m_controlRef && vis == false ) { SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ; } - + TXNControlTag iControlTags[1] = { kTXNVisibilityTag }; TXNControlData iControlData[1] = { {(UInt32) false } }; verify_noerr( TXNGetTXNObjectControls( m_txn , 1, iControlTags, iControlData ) ) ; - + if ( iControlData[0].uValue != vis ) { iControlData[0].uValue = vis ; @@ -2149,7 +2149,7 @@ void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis) // make sure that the TXNObject is at the right position -void wxMacMLTEClassicControl::MacUpdatePosition() +void wxMacMLTEClassicControl::MacUpdatePosition() { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) @@ -2157,14 +2157,14 @@ void wxMacMLTEClassicControl::MacUpdatePosition() Rect bounds ; UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds); - + wxRect visRect = textctrl->MacGetClippedClientRect() ; Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ; int x , y ; x = y = 0 ; textctrl->MacWindowToRootWindow( &x , &y ) ; OffsetRect( &visBounds , x , y ) ; - + if ( !EqualRect( &bounds , &m_txnControlBounds ) || !EqualRect( &visBounds , &m_txnVisBounds) ) { m_txnControlBounds = bounds ; @@ -2186,10 +2186,10 @@ void wxMacMLTEClassicControl::MacUpdatePosition() sbBounds.top = h - 14 ; sbBounds.right = w + 1 ; sbBounds.bottom = h + 1 ; - + if ( !isCompositing ) OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ; - + SetControlBounds( m_sbHorizontal , &sbBounds ) ; SetControlViewSize( m_sbHorizontal , w ) ; } @@ -2201,7 +2201,7 @@ void wxMacMLTEClassicControl::MacUpdatePosition() sbBounds.top = -1 ; sbBounds.right = w + 1 ; sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ; - + if ( !isCompositing ) OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ; @@ -2209,39 +2209,39 @@ void wxMacMLTEClassicControl::MacUpdatePosition() SetControlViewSize( m_sbVertical , h ) ; } } - + Rect oldviewRect ; TXNLongRect olddestRect ; TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ; - + Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left, m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ; TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left, m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ; - + if ( olddestRect.right >= 10000 ) destRect.right = destRect.left + 32000 ; - + if ( olddestRect.bottom >= 0x20000000 ) destRect.bottom = destRect.top + 0x40000000 ; - - SectRect( &viewRect , &visBounds , &viewRect ) ; + + SectRect( &viewRect , &visBounds , &viewRect ) ; TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ; /* TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left, m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ), m_txnFrameID); */ #else - + TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left, - wxMax( m_txnControlBounds.bottom , m_txnControlBounds.top ) , + wxMax( m_txnControlBounds.bottom , m_txnControlBounds.top ) , wxMax( m_txnControlBounds.right , m_txnControlBounds.left ) , m_txnFrameID); - // the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a + // the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a // movement, therefore we have to force it TXNLongRect textRect ; - TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ; + TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ; if ( textRect.left < m_txnControlBounds.left ) { TXNShowSelection( m_txn , false ) ; @@ -2250,13 +2250,13 @@ void wxMacMLTEClassicControl::MacUpdatePosition() } } -void wxMacMLTEClassicControl::SetRect( Rect *r ) +void wxMacMLTEClassicControl::SetRect( Rect *r ) { wxMacControl::SetRect( r ) ; MacUpdatePosition() ; } -void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 thePart) +void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 thePart) { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) @@ -2269,7 +2269,7 @@ void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 thePart) } } -wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) +wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) { Point where = { y , x } ; ControlPartCode result; @@ -2278,7 +2278,7 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt1 wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) return 0 ; - + if (textctrl->MacIsReallyShown() ) { if (PtInRect(where, &m_txnControlBounds)) @@ -2302,7 +2302,7 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt1 return result; } -wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* actionProc ) +wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* actionProc ) { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) @@ -2339,15 +2339,15 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxIn return partCodeResult; } -void wxMacMLTEClassicControl::MacControlUserPaneIdleProc() +void wxMacMLTEClassicControl::MacControlUserPaneIdleProc() { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) return ; - if (textctrl->MacIsReallyShown()) + if (textctrl->MacIsReallyShown()) { - if (IsControlActive(m_controlRef)) + if (IsControlActive(m_controlRef)) { Point mousep; @@ -2356,7 +2356,7 @@ void wxMacMLTEClassicControl::MacControlUserPaneIdleProc() TXNIdle(m_txn); - if (PtInRect(mousep, &m_txnControlBounds)) + if (PtInRect(mousep, &m_txnControlBounds)) { RgnHandle theRgn; RectRgn((theRgn = NewRgn()), &m_txnControlBounds); @@ -2367,7 +2367,7 @@ void wxMacMLTEClassicControl::MacControlUserPaneIdleProc() } } -wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers) +wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers) { wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef); if ( textctrl == NULL ) @@ -2381,16 +2381,16 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, ev.modifiers = modifiers ; ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ; TXNKeyDown( m_txn , &ev); - + return kControlEntireControl; } -void wxMacMLTEClassicControl::MacControlUserPaneActivateProc( bool activating) +void wxMacMLTEClassicControl::MacControlUserPaneActivateProc( bool activating) { MacActivatePaneText( activating ); } -wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action) +wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action) { ControlPartCode focusResult; @@ -2400,19 +2400,19 @@ wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action) return 0; wxMacWindowClipper clipper( textctrl ) ; - + ControlRef controlFocus = 0 ; GetKeyboardFocus( m_txnWindow , &controlFocus ) ; bool wasFocused = ( controlFocus == m_controlRef ) ; - switch (action) + switch (action) { case kControlFocusPrevPart: case kControlFocusNextPart: MacFocusPaneText( ( !wasFocused)); focusResult = (!wasFocused) ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart; break; - + case kControlFocusNoPart: default: MacFocusPaneText( false); @@ -2599,10 +2599,10 @@ OSStatus wxMacMLTEClassicControl::DoCreate() #endif /* calculate the rectangles used by the control */ UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds); - + m_txnControlBounds = bounds ; m_txnVisBounds = bounds ; - + CGrafPtr origPort = NULL ; GDHandle origDev = NULL ; GetGWorld( &origPort , &origDev ) ; @@ -2622,7 +2622,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate() m_sbVertical = 0 ; m_lastHorizontalValue = 0 ; m_lastVerticalValue = 0 ; - + Rect sb = { 0 , 0 , 0 , 0 } ; if ( frameOptions & kTXNWantVScrollBarMask ) { @@ -2653,21 +2653,21 @@ OSStatus wxMacMLTEClassicControl::DoCreate() &m_txn, &m_txnFrameID, NULL ) ); /* TXNCarbonEventInfo cInfo ; - + cInfo.useCarbonEvents = false ; cInfo.filler = 0 ; cInfo.flags = 0 ; cInfo.fDictionary = NULL ; - TXNControlTag iControlTags[] = - { + TXNControlTag iControlTags[] = + { kTXNUseCarbonEvents , }; - TXNControlData iControlData[] = - { + TXNControlData iControlData[] = + { {(UInt32) &cInfo }, }; - + int toptag = WXSIZEOF( iControlTags ) ; verify_noerr( TXNSetTXNObjectControls( m_txn, false , toptag, diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 64a8737ec2..bfdbeb7ef6 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1831,15 +1831,15 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) return; } - if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) x = currentX; - if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + if ( y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) y = currentY; AdjustForParentClientOrigin(x, y, sizeFlags); - wxSize size(-1, -1); - if ( width == -1 ) + wxSize size = wxDefaultSize; + if ( width == wxDefaultCoord ) { if ( sizeFlags & wxSIZE_AUTO_WIDTH ) { @@ -1853,11 +1853,11 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) } } - if ( height == -1 ) + if ( height == wxDefaultCoord ) { if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) { - if ( size.x == -1 ) + if ( size.x == wxDefaultCoord ) { size = DoGetBestSize(); } @@ -1894,7 +1894,7 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) { - if ( clientheight != -1 || clientheight != -1 ) + if ( clientheight != wxDefaultCoord || clientheight != wxDefaultCoord ) { int currentclientwidth , currentclientheight ; int currentwidth , currentheight ; @@ -1902,7 +1902,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) GetClientSize( ¤tclientwidth , ¤tclientheight ) ; GetSize( ¤twidth , ¤theight ) ; - DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth , + DoSetSize( wxDefaultCoord , wxDefaultCoord , currentwidth + clientwidth - currentclientwidth , currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ; } } @@ -2169,8 +2169,8 @@ void wxWindowMac::WarpPointer (int x_pos, int y_pos) void wxWindowMac::OnEraseBackground(wxEraseEvent& event) { - if ( MacGetTopLevelWindow() == NULL ) - return ; + if ( MacGetTopLevelWindow() == NULL ) + return ; #if TARGET_API_MAC_OSX if ( MacGetTopLevelWindow()->MacUsesCompositing() && (m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) ) { @@ -2405,8 +2405,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) if( dx == 0 && dy ==0 ) return ; - int width , height ; - GetClientSize( &width , &height ) ; + int width , height ; + GetClientSize( &width , &height ) ; #if TARGET_API_MAC_OSX if ( 1 /* m_peer->IsCompositing() */ ) { @@ -2467,7 +2467,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) Rect scrollrect; RgnHandle updateRgn = NewRgn() ; - { + { wxClientDC dc(this) ; wxMacPortSetter helper(&dc) ; @@ -3244,15 +3244,14 @@ wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENT bool wxWindowMac::Reparent(wxWindowBase *newParentBase) { wxWindowMac *newParent = (wxWindowMac *)newParentBase; - + if ( !wxWindowBase::Reparent(newParent) ) - return FALSE; - + return false; + //copied from MacPostControlCreate ControlRef container = (ControlRef) GetParent()->GetHandle() ; wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; ::EmbedControl( m_peer->GetControlRef() , container ) ; - - return TRUE; -} + return true; +} -- 2.45.2