introduction of m_peer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-06-04 07:28:59 +00:00
parent 6d4c54a768
commit 21fd55291b
24 changed files with 439 additions and 307 deletions

View File

@@ -73,11 +73,13 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
wxMacCreateBitmapButton( &info , m_bmpNormal ) ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) , (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) ,
kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ; kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , *m_peer ) );
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -92,7 +94,7 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
wxMacCreateBitmapButton( &info , m_bmpNormal ) ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent ) if ( info.contentType != kControlNoContent )
{ {
::SetControlData( (ControlRef) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ; m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ;
} }
} }

View File

@@ -39,18 +39,20 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
m_label = label ; m_label = label ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND) if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
{ {
verify_noerr ( CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , (ControlRef*) &m_macControl ) ) ; verify_noerr ( CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , *m_peer ) );
} }
else else
{ {
ControlButtonContentInfo info ; ControlButtonContentInfo info ;
info.contentType = kControlNoContent ; info.contentType = kControlNoContent ;
verify_noerr(CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,CFSTR(""), verify_noerr(CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,CFSTR(""),
kControlBevelButtonLargeBevel , kControlBehaviorPushbutton , &info , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ; kControlBevelButtonLargeBevel , kControlBehaviorPushbutton , &info , 0 , 0 , 0 , *m_peer ) );
} }
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -68,19 +70,9 @@ void wxButton::SetDefault()
parent->SetDefaultItem(this); parent->SetDefaultItem(this);
} }
Boolean inData; if ( btnOldDefault )
if ( btnOldDefault && btnOldDefault->m_macControl ) btnOldDefault->m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
{ m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 1 ) ;
inData = 0;
::SetControlData( (ControlRef) btnOldDefault->m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
if ( (ControlRef) m_macControl )
{
inData = 1;
::SetControlData( (ControlRef) m_macControl , kControlButtonPart ,
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
}
} }
wxSize wxButton::DoGetBestSize() const wxSize wxButton::DoGetBestSize() const
@@ -121,13 +113,7 @@ wxSize wxButton::GetDefaultSize()
void wxButton::Command (wxCommandEvent & event) void wxButton::Command (wxCommandEvent & event)
{ {
if ( (ControlRef) m_macControl ) m_peer->Flash(kControlButtonPart) ;
{
HiliteControl( (ControlRef) m_macControl , kControlButtonPart ) ;
unsigned long finalTicks ;
Delay( 8 , &finalTicks ) ;
HiliteControl( (ControlRef) m_macControl , 0 ) ;
}
ProcessCommand (event); ProcessCommand (event);
} }

View File

@@ -43,10 +43,11 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
maxValue = 2 /* kControlCheckboxMixedValue */; maxValue = 2 /* kControlCheckboxMixedValue */;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
CFSTR("") , 0 , false , (ControlRef*) &m_macControl ) ) ; CFSTR("") , 0 , false , *m_peer ) );
SetControl32BitMaximum( (ControlRef) m_macControl , maxValue ) ; m_peer->SetMaximum( maxValue ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -85,13 +86,12 @@ void wxCheckBox::Command (wxCommandEvent & event)
wxCheckBoxState wxCheckBox::DoGet3StateValue() const wxCheckBoxState wxCheckBox::DoGet3StateValue() const
{ {
return (wxCheckBoxState) ::GetControl32BitValue( (ControlRef) m_macControl ); return (wxCheckBoxState) m_peer->GetValue() ;
} }
void wxCheckBox::DoSet3StateValue(wxCheckBoxState val) void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
{ {
::SetControl32BitValue( (ControlRef) m_macControl , (int) val) ; m_peer->SetValue( val ) ;
MacRedrawControl() ;
} }
wxInt32 wxCheckBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) wxInt32 wxCheckBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )

View File

@@ -231,10 +231,10 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
ControlRef browser ;
verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , (ControlRef *)&m_macControl ) ); m_peer = new wxMacControl() ;
browser = (ControlRef) m_macControl ; verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , *m_peer ) );
DataBrowserSelectionFlags options = kDataBrowserDragSelect ; DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
if ( style & wxLB_MULTIPLE ) if ( style & wxLB_MULTIPLE )
@@ -249,7 +249,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
{ {
options += kDataBrowserSelectOnlyOne ; options += kDataBrowserSelectOnlyOne ;
} }
verify_noerr(SetDataBrowserSelectionFlags (browser, options ) ); verify_noerr(SetDataBrowserSelectionFlags (*m_peer, options ) );
DataBrowserListViewColumnDesc columnDesc ; DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0; columnDesc.headerBtnDesc.titleOffset = 0;
@@ -273,7 +273,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType; columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn | columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn |
kDataBrowserDefaultPropertyFlags; kDataBrowserDefaultPropertyFlags;
verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ; verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
// text column // text column
@@ -289,12 +289,12 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
; ;
verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ; verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
verify_noerr(::AutoSizeDataBrowserListViewColumns( browser ) ) ; verify_noerr(::AutoSizeDataBrowserListViewColumns( *m_peer ) ) ;
verify_noerr(::SetDataBrowserHasScrollBars( browser , false , true ) ) ; verify_noerr(::SetDataBrowserHasScrollBars( *m_peer , false , true ) ) ;
verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser, kDataBrowserTableViewFillHilite ) ) ; verify_noerr(::SetDataBrowserTableViewHiliteStyle( *m_peer, kDataBrowserTableViewFillHilite ) ) ;
verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser , 0 ) ) ; verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( *m_peer , 0 ) ) ;
DataBrowserCallbacks callbacks ; DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks; callbacks.version = kDataBrowserLatestCallbacks;
@@ -306,7 +306,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
#else #else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ; NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif #endif
SetDataBrowserCallbacks(browser, &callbacks); SetDataBrowserCallbacks(*m_peer, &callbacks);
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -343,7 +343,7 @@ void wxCheckListBox::Check(size_t item, bool check)
{ {
m_checks[item] = check; m_checks[item] = check;
UInt32 id = m_idArray[item] ; UInt32 id = m_idArray[item] ;
verify_noerr( ::UpdateDataBrowserItems( (ControlRef) m_macControl , kDataBrowserNoItem , 1 , &id , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ; verify_noerr( ::UpdateDataBrowserItems( *m_peer , kDataBrowserNoItem , 1 , &id , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ;
} }
} }

View File

@@ -67,15 +67,14 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
-12345 , false /* no variable width */ , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ; -12345 , false /* no variable width */ , 0 , 0 , 0 , *m_peer ) );
m_macPopUpMenuHandle = NewUniqueMenu() ; m_macPopUpMenuHandle = NewUniqueMenu() ;
SetControlData( (ControlRef) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ; m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ;
SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ; m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 ) ;
SetControl32BitMaximum( (ControlRef) m_macControl , 0) ;
if ( n > 0 )
SetControl32BitValue( (ControlRef) m_macControl , 1 ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
// TODO wxCB_SORT // TODO wxCB_SORT
for ( int i = 0; i < n; i++ ) for ( int i = 0; i < n; i++ )
@@ -96,7 +95,7 @@ int wxChoice::DoAppend(const wxString& item)
m_datas.Add( NULL ) ; m_datas.Add( NULL ) ;
int index = m_strings.GetCount() - 1 ; int index = m_strings.GetCount() - 1 ;
DoSetItemClientData( index , NULL ) ; DoSetItemClientData( index , NULL ) ;
SetControl32BitMaximum( (ControlRef) m_macControl , GetCount()) ; m_peer->SetMaximum( GetCount() ) ;
return index ; return index ;
} }
@@ -112,7 +111,7 @@ int wxChoice::DoInsert(const wxString& item, int pos)
m_strings.Insert( item, pos ) ; m_strings.Insert( item, pos ) ;
m_datas.Insert( NULL, pos ) ; m_datas.Insert( NULL, pos ) ;
DoSetItemClientData( pos , NULL ) ; DoSetItemClientData( pos , NULL ) ;
SetControl32BitMaximum( (ControlRef) m_macControl , pos) ; m_peer->SetMaximum( GetCount() ) ;
return pos ; return pos ;
} }
@@ -126,7 +125,7 @@ void wxChoice::Delete(int n)
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ; ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
m_strings.RemoveAt( n ) ; m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ; m_datas.RemoveAt( n ) ;
SetControl32BitMaximum( (ControlRef) m_macControl , GetCount()) ; m_peer->SetMaximum( GetCount() ) ;
} }
void wxChoice::Clear() void wxChoice::Clear()
@@ -138,7 +137,7 @@ void wxChoice::Clear()
} }
m_strings.Empty() ; m_strings.Empty() ;
m_datas.Empty() ; m_datas.Empty() ;
SetControl32BitMaximum( (ControlRef) m_macControl , 0 ) ; m_peer->SetMaximum( 0 ) ;
} }
void wxChoice::FreeData() void wxChoice::FreeData()
@@ -158,12 +157,12 @@ void wxChoice::FreeData()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
int wxChoice::GetSelection() const int wxChoice::GetSelection() const
{ {
return GetControl32BitValue( (ControlRef) m_macControl ) -1 ; return m_peer->GetValue() -1 ;
} }
void wxChoice::SetSelection(int n) void wxChoice::SetSelection(int n)
{ {
SetControl32BitValue( (ControlRef) m_macControl , n + 1 ) ; m_peer->SetValue( n + 1 ) ;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -43,6 +43,48 @@ MenuHandle NewUniqueMenu()
return handle ; return handle ;
} }
#if USE_HICOMBOBOX
static const EventTypeSpec eventList[] =
{
{ kEventClassTextField , kEventTextAccepted } ,
} ;
static pascal OSStatus wxMacComboBoxEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
wxComboBox* cb = (wxComboBox*) data ;
wxMacCarbonEvent cEvent( event ) ;
switch( cEvent.GetClass() )
{
case kEventClassTextField :
switch( cEvent.GetKind() )
{
case kEventTextAccepted :
{
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, cb->GetId() );
event.SetInt( cb->GetSelection() );
event.SetString( cb->GetStringSelection() );
event.SetEventObject( cb );
cb->GetEventHandler()->ProcessEvent( event );
}
break ;
default :
break ;
}
break ;
default :
break ;
}
return result ;
}
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacComboBoxEventHandler )
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
@@ -339,12 +381,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
//hiRect.size.height = bounds.bottom - bounds.top; //hiRect.size.height = bounds.bottom - bounds.top;
//printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom); //printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
//printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height); //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height);
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, (HIViewRef*) &m_macControl) ); m_peer = new wxMacControl() ;
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) );
SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ;
SetControl32BitMaximum( (ControlRef) m_macControl , 100) ; SetControl32BitMinimum( *m_peer , 0 ) ;
SetControl32BitMaximum( *m_peer , 100) ;
if ( n > 0 ) if ( n > 0 )
SetControl32BitValue( (ControlRef) m_macControl , 1 ) ; SetControl32BitValue( *m_peer , 1 ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -353,8 +397,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
DoAppend( choices[ i ] ); DoAppend( choices[ i ] );
} }
HIViewSetVisible( (HIViewRef) m_macControl, true ); HIViewSetVisible( *m_peer, true );
SetSelection(0); SetSelection(0);
EventHandlerRef comboEventHandler ;
InstallControlEventHandler( *m_peer, GetwxMacComboBoxEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
(EventHandlerRef *)&comboEventHandler);
#else #else
m_choice = new wxComboBoxChoice(this, style ); m_choice = new wxComboBoxChoice(this, style );
@@ -390,7 +438,7 @@ wxString wxComboBox::GetValue() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
CFStringRef myString; CFStringRef myString;
HIComboBoxCopyTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex)GetSelection(), &myString ); HIComboBoxCopyTextItemAtIndex( *m_peer, (CFIndex)GetSelection(), &myString );
return wxMacCFStringHolder( myString, m_font.GetEncoding() ).AsString(); return wxMacCFStringHolder( myString, m_font.GetEncoding() ).AsString();
#else #else
wxString result; wxString result;
@@ -509,8 +557,8 @@ int wxComboBox::DoAppend(const wxString& item)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
CFIndex outIndex; CFIndex outIndex;
HIComboBoxAppendTextItem( (HIViewRef) m_macControl, wxMacCFStringHolder( item, m_font.GetEncoding() ), &outIndex ); HIComboBoxAppendTextItem( *m_peer, wxMacCFStringHolder( item, m_font.GetEncoding() ), &outIndex );
//SetControl32BitMaximum( (HIViewRef) m_macControl, GetCount() ); //SetControl32BitMaximum( *m_peer, GetCount() );
return (int) outIndex; return (int) outIndex;
#else #else
return m_choice->DoAppend( item ) ; return m_choice->DoAppend( item ) ;
@@ -520,9 +568,9 @@ int wxComboBox::DoAppend(const wxString& item)
int wxComboBox::DoInsert(const wxString& item, int pos) int wxComboBox::DoInsert(const wxString& item, int pos)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
HIComboBoxInsertTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex)pos, wxMacCFStringHolder(item, m_font.GetEncoding()) ); HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex)pos, wxMacCFStringHolder(item, m_font.GetEncoding()) );
//SetControl32BitMaximum( (HIViewRef) m_macControl, GetCount() ); //SetControl32BitMaximum( *m_peer, GetCount() );
return pos; return pos;
#else #else
@@ -580,7 +628,7 @@ void wxComboBox::FreeData()
int wxComboBox::GetCount() const { int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
return (int) HIComboBoxGetItemCount( (HIViewRef) m_macControl ); return (int) HIComboBoxGetItemCount( *m_peer );
#else #else
return m_choice->GetCount() ; return m_choice->GetCount() ;
#endif #endif
@@ -589,7 +637,7 @@ int wxComboBox::GetCount() const {
void wxComboBox::Delete(int n) void wxComboBox::Delete(int n)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, (CFIndex)n ); HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex)n );
#else #else
// force client object deletion // force client object deletion
if( HasClientObjectData() ) if( HasClientObjectData() )
@@ -603,11 +651,8 @@ void wxComboBox::Clear()
FreeData(); FreeData();
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
for ( CFIndex i = GetCount() - 1 ; i >= 0 ; ++ i ) for ( CFIndex i = GetCount() - 1 ; i >= 0 ; ++ i )
verify_noerr( HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, i ) ); verify_noerr( HIComboBoxRemoveItemAtIndex( *m_peer, i ) );
wxMacCFStringHolder cf(wxEmptyString,m_font.GetEncoding()) ; m_peer->SetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag,CFSTR(""));
CFStringRef cfr = cf ;
SetControlData((ControlRef) m_macControl,kHIComboBoxEditTextPart,kControlEditTextCFStringTag,
sizeof(CFStringRef),(Ptr) &cfr);
#else #else
m_choice->Clear(); m_choice->Clear();
#endif #endif
@@ -625,7 +670,7 @@ int wxComboBox::GetSelection() const
void wxComboBox::SetSelection(int n) void wxComboBox::SetSelection(int n)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
SetControl32BitValue( (ControlRef) m_macControl , n + 1 ) ; SetControl32BitValue( *m_peer , n + 1 ) ;
#else #else
m_choice->SetSelection( n ); m_choice->SetSelection( n );
@@ -654,7 +699,7 @@ wxString wxComboBox::GetString(int n) const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
CFStringRef itemText; CFStringRef itemText;
HIComboBoxCopyTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex)n, &itemText ); HIComboBoxCopyTextItemAtIndex( *m_peer, (CFIndex)n, &itemText );
return wxMacCFStringHolder(itemText).AsString(); return wxMacCFStringHolder(itemText).AsString();
#else #else
return m_choice->GetString( n ); return m_choice->GetString( n );
@@ -664,12 +709,7 @@ wxString wxComboBox::GetString(int n) const
wxString wxComboBox::GetStringSelection() const wxString wxComboBox::GetStringSelection() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
CFStringRef cfr ; return wxMacCFStringHolder(m_peer->GetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString() ;
verify_noerr(GetControlData((ControlRef) m_macControl,kHIComboBoxEditTextPart,kControlEditTextCFStringTag,
sizeof(CFStringRef),(Ptr) &cfr,NULL));
// takes of release responsibility
wxMacCFStringHolder cf( cfr ) ;
return cf.AsString() ;
#else #else
int sel = GetSelection (); int sel = GetSelection ();
if (sel > -1) if (sel > -1)
@@ -694,9 +734,9 @@ bool wxComboBox::SetStringSelection(const wxString& sel)
void wxComboBox::SetString(int n, const wxString& s) void wxComboBox::SetString(int n, const wxString& s)
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
verify_noerr ( HIComboBoxInsertTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex) n, verify_noerr ( HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex) n,
wxMacCFStringHolder(s, m_font.GetEncoding()) ) ); wxMacCFStringHolder(s, m_font.GetEncoding()) ) );
verify_noerr ( HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, (CFIndex) n + 1 ) ); verify_noerr ( HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex) n + 1 ) );
#else #else
m_choice->SetString( n , s ) ; m_choice->SetString( n , s ) ;
#endif #endif

View File

@@ -85,7 +85,7 @@ bool wxControl::ProcessCommand (wxCommandEvent & event)
void wxControl::OnKeyDown( wxKeyEvent &event ) void wxControl::OnKeyDown( wxKeyEvent &event )
{ {
if ( (ControlRef) m_macControl == NULL ) if ( m_peer == NULL || !m_peer->Ok() )
return ; return ;
#if TARGET_CARBON #if TARGET_CARBON
@@ -98,7 +98,7 @@ void wxControl::OnKeyDown( wxKeyEvent &event )
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers); GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
::HandleControlKey( (ControlRef) m_macControl , keyCode , charCode , modifiers ) ; ::HandleControlKey( *m_peer , keyCode , charCode , modifiers ) ;
#else #else
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ; EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
@@ -107,7 +107,7 @@ void wxControl::OnKeyDown( wxKeyEvent &event )
keychar = short(ev->message & charCodeMask); keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ; keycode = short(ev->message & keyCodeMask) >> 8 ;
::HandleControlKey( (ControlRef) m_macControl , keycode , keychar , ev->modifiers ) ; ::HandleControlKey( *m_peer , keycode , keychar , ev->modifiers ) ;
#endif #endif
} }

View File

@@ -36,60 +36,46 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
wxSize size = s ; wxSize size = s ;
m_rangeMax = range ;
m_gaugePos = 0 ;
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y) if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
{ {
size = wxSize( 200 , 16 ) ; size = wxSize( 200 , 16 ) ;
} }
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
m_gaugePos , 0 , m_rangeMax , false /* not indeterminate */ , (ControlRef*) &m_macControl ) ) ; GetValue() , 0 , GetRange() , false /* not indeterminate */ , *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
return TRUE; return TRUE;
} }
void wxGauge::SetShadowWidth(int w)
{
}
void wxGauge::SetBezelFace(int w)
{
}
void wxGauge::SetRange(int r) void wxGauge::SetRange(int r)
{ {
m_rangeMax = r; // we are going via the base class in case there is
::SetControl32BitMaximum( (ControlRef) m_macControl , m_rangeMax ) ; // some change behind the values by it
wxGaugeBase::SetRange(r) ;
if ( m_peer && m_peer->Ok() )
m_peer->SetMaximum( GetRange() ) ;
} }
void wxGauge::SetValue(int pos) void wxGauge::SetValue(int pos)
{ {
m_gaugePos = pos; // we are going via the base class in case there is
::SetControl32BitValue( (ControlRef) m_macControl , m_gaugePos ) ; // some change behind the values by it
} wxGaugeBase::SetValue(pos) ;
if ( m_peer && m_peer->Ok() )
int wxGauge::GetShadowWidth() const m_peer->SetValue( GetValue() ) ;
{
return 0;
}
int wxGauge::GetBezelFace() const
{
return 0;
}
int wxGauge::GetRange() const
{
return m_rangeMax;
} }
int wxGauge::GetValue() const int wxGauge::GetValue() const
{ {
/*
if ( m_peer && m_peer->Ok() )
return m_peer->GetValue() ;
*/
return m_gaugePos ; return m_gaugePos ;
} }

View File

@@ -175,10 +175,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
ControlRef browser ;
verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , (ControlRef *)&m_macControl ) ); m_peer = new wxMacControl() ;
browser = (ControlRef) m_macControl ; verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , *m_peer ) );
DataBrowserSelectionFlags options = kDataBrowserDragSelect ; DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
if ( style & wxLB_MULTIPLE ) if ( style & wxLB_MULTIPLE )
@@ -193,7 +192,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
{ {
options += kDataBrowserSelectOnlyOne ; options += kDataBrowserSelectOnlyOne ;
} }
verify_noerr(SetDataBrowserSelectionFlags (browser, options ) ); verify_noerr(SetDataBrowserSelectionFlags (*m_peer, options ) );
DataBrowserListViewColumnDesc columnDesc ; DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0; columnDesc.headerBtnDesc.titleOffset = 0;
@@ -221,11 +220,11 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
kDataBrowserTableViewSelectionColumn ; kDataBrowserTableViewSelectionColumn ;
verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ; verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
verify_noerr(::AutoSizeDataBrowserListViewColumns( browser ) ) ; verify_noerr(::AutoSizeDataBrowserListViewColumns( *m_peer ) ) ;
verify_noerr(::SetDataBrowserHasScrollBars( browser , false , true ) ) ; verify_noerr(::SetDataBrowserHasScrollBars( *m_peer , false , true ) ) ;
verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser, kDataBrowserTableViewFillHilite ) ) ; verify_noerr(::SetDataBrowserTableViewHiliteStyle( *m_peer, kDataBrowserTableViewFillHilite ) ) ;
verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser , 0 ) ) ; verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( *m_peer , 0 ) ) ;
DataBrowserCallbacks callbacks ; DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks; callbacks.version = kDataBrowserLatestCallbacks;
@@ -241,7 +240,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
#else #else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ; NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif #endif
SetDataBrowserCallbacks(browser, &callbacks); SetDataBrowserCallbacks(*m_peer, &callbacks);
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -257,7 +256,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
wxListBox::~wxListBox() wxListBox::~wxListBox()
{ {
SetControlReference( (ControlRef) m_macControl , NULL ) ; SetControlReference( *m_peer , NULL ) ;
FreeData() ; FreeData() ;
// avoid access during destruction // avoid access during destruction
if ( m_macList ) if ( m_macList )
@@ -626,27 +625,27 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
void wxListBox::MacDelete( int N ) void wxListBox::MacDelete( int N )
{ {
UInt32 id = m_idArray[N] ; UInt32 id = m_idArray[N] ;
verify_noerr(::RemoveDataBrowserItems((ControlRef) m_macControl , kDataBrowserNoItem , 1 , (UInt32*) &id , kDataBrowserItemNoProperty ) ) ; verify_noerr(::RemoveDataBrowserItems(*m_peer , kDataBrowserNoItem , 1 , (UInt32*) &id , kDataBrowserItemNoProperty ) ) ;
m_idArray.RemoveAt( N ) ; m_idArray.RemoveAt( N ) ;
} }
void wxListBox::MacInsert( int n , const wxString& text) void wxListBox::MacInsert( int n , const wxString& text)
{ {
verify_noerr(::AddDataBrowserItems( (ControlRef) m_macControl , kDataBrowserNoItem , 1 , (UInt32*) &m_nextId , kDataBrowserItemNoProperty ) ) ; verify_noerr(::AddDataBrowserItems( *m_peer , kDataBrowserNoItem , 1 , (UInt32*) &m_nextId , kDataBrowserItemNoProperty ) ) ;
m_idArray.Insert( m_nextId , n ) ; m_idArray.Insert( m_nextId , n ) ;
++m_nextId ; ++m_nextId ;
} }
void wxListBox::MacAppend( const wxString& text) void wxListBox::MacAppend( const wxString& text)
{ {
verify_noerr(::AddDataBrowserItems( (ControlRef) m_macControl , kDataBrowserNoItem , 1 , (UInt32*) &m_nextId , kDataBrowserItemNoProperty ) ) ; verify_noerr(::AddDataBrowserItems( *m_peer , kDataBrowserNoItem , 1 , (UInt32*) &m_nextId , kDataBrowserItemNoProperty ) ) ;
m_idArray.Add( m_nextId ) ; m_idArray.Add( m_nextId ) ;
++m_nextId ; ++m_nextId ;
} }
void wxListBox::MacClear() void wxListBox::MacClear()
{ {
verify_noerr(::RemoveDataBrowserItems((ControlRef) m_macControl , kDataBrowserNoItem , 0 , NULL , kDataBrowserItemNoProperty ) ) ; verify_noerr(::RemoveDataBrowserItems(*m_peer , kDataBrowserNoItem , 0 , NULL , kDataBrowserItemNoProperty ) ) ;
m_idArray.Empty() ; m_idArray.Empty() ;
} }
@@ -659,26 +658,26 @@ void wxListBox::MacSetSelection( int n , bool select )
if ( n >= 0 ) if ( n >= 0 )
{ {
UInt32 idOld = m_idArray[n] ; UInt32 idOld = m_idArray[n] ;
SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & idOld , kDataBrowserItemsRemove ) ; SetDataBrowserSelectedItems(*m_peer , 1 , & idOld , kDataBrowserItemsRemove ) ;
} }
} }
if ( ::IsDataBrowserItemSelected( (ControlRef) m_macControl , id ) != select ) if ( ::IsDataBrowserItemSelected( *m_peer , id ) != select )
{ {
verify_noerr(::SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & id , kDataBrowserItemsToggle ) ) ; verify_noerr(::SetDataBrowserSelectedItems(*m_peer , 1 , & id , kDataBrowserItemsToggle ) ) ;
} }
MacScrollTo( n ) ; MacScrollTo( n ) ;
} }
bool wxListBox::MacIsSelected( int n ) const bool wxListBox::MacIsSelected( int n ) const
{ {
return ::IsDataBrowserItemSelected( (ControlRef) m_macControl , m_idArray[n] ) ; return ::IsDataBrowserItemSelected( *m_peer , m_idArray[n] ) ;
} }
int wxListBox::MacGetSelection() const int wxListBox::MacGetSelection() const
{ {
for ( size_t i = 0 ; i < m_idArray.GetCount() ; ++i ) for ( size_t i = 0 ; i < m_idArray.GetCount() ; ++i )
{ {
if ( ::IsDataBrowserItemSelected((ControlRef) m_macControl , m_idArray[i] ) ) if ( ::IsDataBrowserItemSelected(*m_peer , m_idArray[i] ) )
{ {
return i ; return i ;
} }
@@ -693,7 +692,7 @@ int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
aSelections.Empty(); aSelections.Empty();
for ( size_t i = 0 ; i < m_idArray.GetCount() ; ++i ) for ( size_t i = 0 ; i < m_idArray.GetCount() ; ++i )
{ {
if ( ::IsDataBrowserItemSelected((ControlRef) m_macControl , m_idArray[i] ) ) if ( ::IsDataBrowserItemSelected(*m_peer , m_idArray[i] ) )
{ {
aSelections.Add( i ) ; aSelections.Add( i ) ;
no_sel++ ; no_sel++ ;
@@ -706,13 +705,13 @@ void wxListBox::MacSet( int n , const wxString& text )
{ {
// as we don't store the strings we only have to issue a redraw // as we don't store the strings we only have to issue a redraw
UInt32 id = m_idArray[n] ; UInt32 id = m_idArray[n] ;
verify_noerr( ::UpdateDataBrowserItems( (ControlRef) m_macControl , kDataBrowserNoItem , 1 , &id , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ; verify_noerr( ::UpdateDataBrowserItems( *m_peer , kDataBrowserNoItem , 1 , &id , kDataBrowserItemNoProperty , kDataBrowserItemNoProperty ) ) ;
} }
void wxListBox::MacScrollTo( int n ) void wxListBox::MacScrollTo( int n )
{ {
UInt32 id = m_idArray[n] ; UInt32 id = m_idArray[n] ;
verify_noerr( ::RevealDataBrowserItem((ControlRef) m_macControl , id , kTextColumnId , kDataBrowserRevealWithoutSelecting ) ) ; verify_noerr( ::RevealDataBrowserItem(*m_peer , id , kTextColumnId , kDataBrowserRevealWithoutSelecting ) ) ;
} }
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX

View File

@@ -125,8 +125,10 @@ bool wxNotebook::Create(wxWindow *parent,
tabsize = kControlSizeSmall; tabsize = kControlSizeSmall;
} }
m_peer = new wxMacControl() ;
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) ); tabsize , tabstyle, 0, NULL, *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
return TRUE ; return TRUE ;
@@ -329,7 +331,7 @@ bool wxNotebook::InsertPage(size_t nPage,
{ {
m_nSelection++; m_nSelection++;
// while this still is the same page showing, we need to update the tabs // while this still is the same page showing, we need to update the tabs
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ; SetControl32BitValue( *m_peer , m_nSelection + 1 ) ;
} }
// some page should be selected: either this one or the first one if there // some page should be selected: either this one or the first one if there
@@ -348,12 +350,12 @@ bool wxNotebook::InsertPage(size_t nPage,
/* Added by Mark Newsam /* Added by Mark Newsam
* When a page is added or deleted to the notebook this function updates * When a page is added or deleted to the notebook this function updates
* information held in the m_macControl so that it matches the order * information held in the control so that it matches the order
* the user would expect. * the user would expect.
*/ */
void wxNotebook::MacSetupTabs() void wxNotebook::MacSetupTabs()
{ {
SetControl32BitMaximum( (ControlRef) m_macControl , GetPageCount() ) ; SetControl32BitMaximum( *m_peer , GetPageCount() ) ;
wxNotebookPage *page; wxNotebookPage *page;
ControlTabInfoRec info; ControlTabInfoRec info;
@@ -366,9 +368,9 @@ void wxNotebook::MacSetupTabs()
info.iconSuiteID = 0; info.iconSuiteID = 0;
wxMacStringToPascal( page->GetLabel() , info.name ) ; wxMacStringToPascal( page->GetLabel() , info.name ) ;
SetControlData( (ControlRef) m_macControl, ii+1, kControlTabInfoTag, SetControlData( *m_peer, ii+1, kControlTabInfoTag,
sizeof( ControlTabInfoRec) , (char*) &info ) ; sizeof( ControlTabInfoRec) , (char*) &info ) ;
SetTabEnabled( (ControlRef) m_macControl , ii+1 , true ) ; SetTabEnabled( *m_peer , ii+1 , true ) ;
#if TARGET_CARBON #if TARGET_CARBON
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 ) if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
{ {
@@ -397,7 +399,7 @@ void wxNotebook::MacSetupTabs()
wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ; wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
info.contentType = kControlContentIconRef ; info.contentType = kControlContentIconRef ;
info.u.iconRef = iconRef ; info.u.iconRef = iconRef ;
SetControlData( (ControlRef) m_macControl, ii+1,kControlTabImageContentTag, SetControlData( *m_peer, ii+1,kControlTabImageContentTag,
sizeof( info ), (Ptr)&info ); sizeof( info ), (Ptr)&info );
wxASSERT_MSG( err == noErr , wxT("Error when setting icon on tab") ) ; wxASSERT_MSG( err == noErr , wxT("Error when setting icon on tab") ) ;
if ( UMAGetSystemVersion() < 0x1030 ) if ( UMAGetSystemVersion() < 0x1030 )
@@ -412,7 +414,7 @@ void wxNotebook::MacSetupTabs()
#endif #endif
} }
Rect bounds; Rect bounds;
UMAGetControlBoundsInWindowCoords((ControlRef)m_macControl, &bounds); UMAGetControlBoundsInWindowCoords(*m_peer, &bounds);
InvalWindowRect((WindowRef)MacGetTopLevelWindowRef(), &bounds); InvalWindowRect((WindowRef)MacGetTopLevelWindowRef(), &bounds);
} }
@@ -564,14 +566,14 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
} }
m_nSelection = nSel; m_nSelection = nSel;
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ; SetControl32BitValue( *m_peer , m_nSelection + 1 ) ;
} }
wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
{ {
OSStatus status = eventNotHandledErr ; OSStatus status = eventNotHandledErr ;
SInt32 newSel = GetControl32BitValue( (ControlRef) m_macControl ) - 1 ; SInt32 newSel = GetControl32BitValue( *m_peer ) - 1 ;
if ( newSel != m_nSelection ) if ( newSel != m_nSelection )
{ {
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId, wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
@@ -589,7 +591,7 @@ wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR
} }
else else
{ {
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ; SetControl32BitValue( *m_peer , m_nSelection + 1 ) ;
} }
status = noErr ; status = noErr ;
} }

View File

@@ -137,8 +137,10 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
if ( bounds.bottom <= bounds.top ) if ( bounds.bottom <= bounds.top )
bounds.bottom = bounds.top + 100 ; bounds.bottom = bounds.top + 100 ;
m_peer = new wxMacControl() ;
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
true /*primary*/ , (ControlRef*)&m_macControl ) ) ; true /*primary*/ , *m_peer ) ) ;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {

View File

@@ -39,8 +39,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
0 , false /* no autotoggle */ , (ControlRef*) &m_macControl ) ) ; 0 , false /* no autotoggle */ , *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -73,10 +75,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
void wxRadioButton::SetValue(bool val) void wxRadioButton::SetValue(bool val)
{ {
wxRadioButton *cycle; wxRadioButton *cycle;
if ( GetControl32BitValue( (ControlRef) m_macControl ) == val ) if ( GetControl32BitValue( *m_peer ) == val )
return ; return ;
::SetControl32BitValue( (ControlRef) m_macControl , val ) ; ::SetControl32BitValue( *m_peer , val ) ;
if (val) if (val)
{ {
cycle=this->NextInCycle(); cycle=this->NextInCycle();
@@ -92,7 +94,7 @@ void wxRadioButton::SetValue(bool val)
bool wxRadioButton::GetValue() const bool wxRadioButton::GetValue() const
{ {
return ::GetControl32BitValue( (ControlRef) m_macControl ) ; return ::GetControl32BitValue( *m_peer ) ;
} }
void wxRadioButton::Command (wxCommandEvent & event) void wxRadioButton::Command (wxCommandEvent & event)

View File

@@ -47,8 +47,10 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , verify_noerr ( CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
0 , 0 , 100 , 1 , true /* liveTracking */ , wxMacLiveScrollbarActionUPP , (ControlRef*) &m_macControl ) ) ; 0 , 0 , 100 , 1 , true /* liveTracking */ , wxMacLiveScrollbarActionUPP , *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -61,12 +63,12 @@ wxScrollBar::~wxScrollBar()
void wxScrollBar::SetThumbPosition(int viewStart) void wxScrollBar::SetThumbPosition(int viewStart)
{ {
::SetControl32BitValue( (ControlRef) m_macControl , viewStart ) ; ::SetControl32BitValue( *m_peer , viewStart ) ;
} }
int wxScrollBar::GetThumbPosition() const int wxScrollBar::GetThumbPosition() const
{ {
return ::GetControl32BitValue( (ControlRef) m_macControl ) ; return ::GetControl32BitValue( *m_peer ) ;
} }
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
@@ -78,10 +80,10 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
int range1 = wxMax((m_objectSize - m_viewSize), 0) ; int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
SetControl32BitMaximum( (ControlRef) m_macControl , range1 ) ; SetControl32BitMaximum( *m_peer , range1 ) ;
SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ; SetControl32BitMinimum( *m_peer , 0 ) ;
SetControl32BitValue( (ControlRef) m_macControl , position ) ; SetControl32BitValue( *m_peer , position ) ;
SetControlViewSize( (ControlRef) m_macControl , m_viewSize ) ; SetControlViewSize( *m_peer , m_viewSize ) ;
if ( refresh ) if ( refresh )
MacRedrawControl() ; MacRedrawControl() ;
@@ -96,9 +98,9 @@ void wxScrollBar::Command(wxCommandEvent& event)
void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
{ {
int position = GetControl32BitValue( (ControlRef) m_macControl) ; int position = GetControl32BitValue( *m_peer) ;
int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ; int minPos = GetControl32BitMinimum( *m_peer) ;
int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ; int maxPos = GetControl32BitMaximum( *m_peer) ;
wxEventType scrollEvent = wxEVT_NULL; wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc = 0; int nScrollInc = 0;
@@ -169,9 +171,9 @@ void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart
wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent ) wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
{ {
int position = GetControl32BitValue( (ControlRef) m_macControl) ; int position = GetControl32BitValue( *m_peer) ;
int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ; int minPos = GetControl32BitMinimum( *m_peer) ;
int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ; int maxPos = GetControl32BitMaximum( *m_peer) ;
wxEventType scrollEvent = wxEVT_NULL; wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc = 0; int nScrollInc = 0;

View File

@@ -81,9 +81,11 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
if ( style & wxSL_AUTOTICKS ) if ( style & wxSL_AUTOTICKS )
tickMarks = maxValue - minValue ; tickMarks = maxValue - minValue ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ , value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
wxMacLiveScrollbarActionUPP , (ControlRef*) &m_macControl ) ) ; wxMacLiveScrollbarActionUPP , *m_peer ) );
if(style & wxSL_VERTICAL) { if(style & wxSL_VERTICAL) {
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
@@ -118,7 +120,7 @@ wxSlider::~wxSlider()
int wxSlider::GetValue() const int wxSlider::GetValue() const
{ {
return GetControl32BitValue( (ControlRef) m_macControl) ; return GetControl32BitValue( *m_peer) ;
} }
void wxSlider::SetValue(int value) void wxSlider::SetValue(int value)
@@ -127,7 +129,7 @@ void wxSlider::SetValue(int value)
valuestring.Printf( wxT("%d") , value ) ; valuestring.Printf( wxT("%d") , value ) ;
if ( m_macValueStatic ) if ( m_macValueStatic )
m_macValueStatic->SetLabel( valuestring ) ; m_macValueStatic->SetLabel( valuestring ) ;
SetControl32BitValue( (ControlRef) m_macControl , value ) ; SetControl32BitValue( *m_peer , value ) ;
} }
void wxSlider::SetRange(int minValue, int maxValue) void wxSlider::SetRange(int minValue, int maxValue)
@@ -137,8 +139,8 @@ void wxSlider::SetRange(int minValue, int maxValue)
m_rangeMin = minValue; m_rangeMin = minValue;
m_rangeMax = maxValue; m_rangeMax = maxValue;
SetControl32BitMinimum( (ControlRef) m_macControl, m_rangeMin); SetControl32BitMinimum( *m_peer, m_rangeMin);
SetControl32BitMaximum( (ControlRef) m_macControl, m_rangeMax); SetControl32BitMaximum( *m_peer, m_rangeMax);
if(m_macMinimumStatic) { if(m_macMinimumStatic) {
value.Printf(wxT("%d"), m_rangeMin); value.Printf(wxT("%d"), m_rangeMin);
@@ -232,7 +234,7 @@ void wxSlider::Command (wxCommandEvent & event)
void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown ) void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
{ {
SInt16 value = ::GetControl32BitValue( (ControlRef) m_macControl ) ; SInt16 value = ::GetControl32BitValue( *m_peer ) ;
SetValue( value ) ; SetValue( value ) ;
@@ -254,7 +256,7 @@ void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bo
wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent ) wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
{ {
SInt16 value = ::GetControl32BitValue( (ControlRef) m_macControl ) ; SInt16 value = ::GetControl32BitValue( *m_peer ) ;
SetValue( value ) ; SetValue( value ) ;

View File

@@ -54,9 +54,11 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 , verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 ,
(ControlRef*) &m_macControl ) ) ; *m_peer ) );
SetControlAction( (ControlRef) m_macControl , wxMacLiveScrollbarActionUPP ) ;
SetControlAction( *m_peer , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
return TRUE; return TRUE;
@@ -93,8 +95,8 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
{ {
m_min = minVal; m_min = minVal;
m_max = maxVal; m_max = maxVal;
SetControl32BitMaximum( (ControlRef) m_macControl , maxVal ) ; SetControl32BitMaximum( *m_peer , maxVal ) ;
SetControl32BitMinimum((ControlRef) m_macControl , minVal ) ; SetControl32BitMinimum(*m_peer , minVal ) ;
} }
void wxSpinButton::MacHandleValueChanged( int inc ) void wxSpinButton::MacHandleValueChanged( int inc )
@@ -137,7 +139,7 @@ void wxSpinButton::MacHandleValueChanged( int inc )
{ {
m_value = oldValue ; m_value = oldValue ;
} }
SetControl32BitValue( (ControlRef) m_macControl , m_value ) ; SetControl32BitValue( *m_peer , m_value ) ;
/* always send a thumbtrack event */ /* always send a thumbtrack event */
if (scrollEvent != wxEVT_SCROLL_THUMBTRACK) if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)

View File

@@ -43,8 +43,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
true /*primary*/ , (ControlRef*)&m_macControl ) ) ; true /*primary*/ , *m_peer ) ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;

View File

@@ -56,7 +56,8 @@ bool wxStaticLine::Create( wxWindow *parent,
return false; return false;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, (ControlRef*)&m_macControl ) ) ; m_peer = new wxMacControl() ;
verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, *m_peer ) ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;

View File

@@ -49,8 +49,9 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ; wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
m_peer = new wxMacControl() ;
verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str , verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str ,
NULL , (ControlRef*)&m_macControl ) ) ; NULL , *m_peer ) ) ;
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -61,7 +62,7 @@ wxSize wxStaticText::DoGetBestSize() const
{ {
ControlFontStyleRec controlFont ; ControlFontStyleRec controlFont ;
Size outSize ; Size outSize ;
verify_noerr( GetControlData( (ControlRef) m_macControl , kControlEntireControl , kControlFontStyleTag , sizeof(controlFont) , &controlFont , &outSize ) ) ; verify_noerr( GetControlData( *m_peer , kControlEntireControl , kControlFontStyleTag , sizeof(controlFont) , &controlFont , &outSize ) ) ;
Point bounds ; Point bounds ;
SInt16 baseline ; SInt16 baseline ;
@@ -88,7 +89,7 @@ void wxStaticText::SetLabel(const wxString& st )
wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ; wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
CFStringRef ref = str ; CFStringRef ref = str ;
SetControlData( (ControlRef) m_macControl, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ), SetControlData( *m_peer, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ),
&ref ); &ref );
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )

View File

@@ -56,8 +56,10 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
tabsize = kControlSizeSmall; tabsize = kControlSizeSmall;
} }
m_peer = new wxMacControl() ;
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) ); tabsize , tabstyle, 0, NULL, *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
return TRUE ; return TRUE ;

View File

@@ -738,7 +738,7 @@ void wxTextCtrl::Init()
wxTextCtrl::~wxTextCtrl() wxTextCtrl::~wxTextCtrl()
{ {
#if wxMAC_USE_MLTE #if wxMAC_USE_MLTE
SetControlReference((ControlRef)m_macControl, 0) ; SetControlReference(*m_peer, 0) ;
#if !wxMAC_USE_MLTE_HIVIEW #if !wxMAC_USE_MLTE_HIVIEW
TXNDeleteObject((TXNObject)m_macTXN); TXNDeleteObject((TXNObject)m_macTXN);
#endif #endif
@@ -803,11 +803,11 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
if ( scrollView ) if ( scrollView )
{ {
HIViewAddSubview( scrollView , textView ) ; HIViewAddSubview( scrollView , textView ) ;
m_macControl = (WXWidget) scrollView ; m_peer = scrollView ;
} }
else else
{ {
m_macControl = (WXWidget) textView ; m_peer = textView ;
} }
#else #else
short featurSet; short featurSet;
@@ -816,11 +816,13 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
| kControlWantsActivate | kControlHandlesTracking | kControlHasSpecialBackground | kControlWantsActivate | kControlHandlesTracking | kControlHasSpecialBackground
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback; | kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
/* create the control */ /* create the control */
verify_noerr( CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, featurSet , (ControlRef*) &m_macControl) ) ; m_peer = new wxMacControl() ;
verify_noerr( CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, featurSet , , *m_peer ) );
) ) ;
wxMacWindowClipper c(this) ; wxMacWindowClipper c(this) ;
STPTextPaneVars *varsp ; STPTextPaneVars *varsp ;
mUPOpenControl( varsp, (ControlRef) m_macControl, m_windowStyle ); mUPOpenControl( varsp, *m_peer, m_windowStyle );
m_macTXNvars = varsp ; m_macTXNvars = varsp ;
m_macTXN = varsp->fTXNRec ; m_macTXN = varsp->fTXNRec ;
#endif #endif
@@ -841,7 +843,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
{ {
wxMacWindowClipper clipper( this ) ; wxMacWindowClipper clipper( this ) ;
#if !wxMAC_USE_MLTE_HIVIEW #if !wxMAC_USE_MLTE_HIVIEW
TPUpdateVisibility( (ControlRef) m_macControl ) ; TPUpdateVisibility( *m_peer ) ;
#endif #endif
SetTXNData( (STPTextPaneVars *)m_macTXNvars , (TXNObject) m_macTXN , st , kTXNStartOffset, kTXNEndOffset ) ; SetTXNData( (STPTextPaneVars *)m_macTXNvars , (TXNObject) m_macTXN , st , kTXNStartOffset, kTXNEndOffset ) ;
@@ -863,11 +865,13 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ; wxMacCFStringHolder cf(st , m_font.GetEncoding()) ;
CFStringRef cfr = cf ; CFStringRef cfr = cf ;
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ; Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
CreateEditUnicodeTextControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , cfr , isPassword , NULL , (ControlRef*) &m_macControl ) ; m_peer = new wxMacControl() ;
CreateEditUnicodeTextControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , cfr , isPassword , NULL , *m_peer ) ;
if ( !(m_windowStyle & wxTE_MULTILINE) ) if ( !(m_windowStyle & wxTE_MULTILINE) )
{ {
Boolean singleline = true ; Boolean singleline = true ;
::SetControlData( (ControlHandle) m_macControl, kControlEditTextPart , kControlEditTextSingleLineTag , sizeof( singleline ) , &singleline ) ; ::SetControlData( *m_peer, kControlEditTextPart , kControlEditTextSingleLineTag , sizeof( singleline ) , &singleline ) ;
} }
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -887,7 +891,7 @@ void wxTextCtrl::MacVisibilityChanged()
#if !wxMAC_USE_MLTE_HIVIEW #if !wxMAC_USE_MLTE_HIVIEW
MLTESetObjectVisibility((STPTextPaneVars*) m_macTXNvars , MacIsReallyShown() , GetWindowStyle() ) ; MLTESetObjectVisibility((STPTextPaneVars*) m_macTXNvars , MacIsReallyShown() , GetWindowStyle() ) ;
if ( !MacIsReallyShown() ) if ( !MacIsReallyShown() )
InvalWindowRect( GetControlOwner( (ControlHandle) m_macControl ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ; InvalWindowRect( GetControlOwner( *m_peer ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ;
#endif #endif
#else #else
if ( !(m_windowStyle & wxTE_MULTILINE) && MacIsReallyShown() ) if ( !(m_windowStyle & wxTE_MULTILINE) && MacIsReallyShown() )
@@ -899,12 +903,12 @@ void wxTextCtrl::MacVisibilityChanged()
ResType datatag = GetWindowStyle() & wxTE_PASSWORD ? ResType datatag = GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ; kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
verify_noerr( GetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag, verify_noerr( GetControlData( *m_peer , 0, kControlEditTextSelectionTag,
sizeof(ControlEditTextSelectionRec), &sel, &actualSize ) ); sizeof(ControlEditTextSelectionRec), &sel, &actualSize ) );
verify_noerr( GetControlData( (ControlRef) m_macControl , 0, datatag , sizeof(CFStringRef), &value, &actualSize ) ); verify_noerr( GetControlData( *m_peer , 0, datatag , sizeof(CFStringRef), &value, &actualSize ) );
verify_noerr( SetControlData( (ControlRef) m_macControl , 0, datatag, sizeof(CFStringRef), &value ) ); verify_noerr( SetControlData( *m_peer , 0, datatag, sizeof(CFStringRef), &value ) );
verify_noerr( SetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag, sizeof(ControlEditTextSelectionRec), &sel ) ); verify_noerr( SetControlData( *m_peer , 0, kControlEditTextSelectionTag, sizeof(ControlEditTextSelectionRec), &sel ) );
CFRelease( value ) ; CFRelease( value ) ;
} }
@@ -984,7 +988,7 @@ wxString wxTextCtrl::GetValue() const
CFStringRef value = NULL ; CFStringRef value = NULL ;
Size actualSize = 0 ; Size actualSize = 0 ;
verify_noerr( GetControlData( (ControlRef) m_macControl , 0, GetWindowStyle() & wxTE_PASSWORD ? verify_noerr( GetControlData( *m_peer , 0, GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag, kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag,
sizeof(CFStringRef), &value, &actualSize ) ); sizeof(CFStringRef), &value, &actualSize ) );
if ( value ) if ( value )
@@ -1004,7 +1008,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
#else #else
ControlEditTextSelectionRec sel ; ControlEditTextSelectionRec sel ;
Size actualSize ; Size actualSize ;
verify_noerr( GetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag, verify_noerr( GetControlData( *m_peer , 0, kControlEditTextSelectionTag,
sizeof(ControlEditTextSelectionRec), &sel, &actualSize ) ); sizeof(ControlEditTextSelectionRec), &sel, &actualSize ) );
if ( from ) *from = sel.selStart ; if ( from ) *from = sel.selStart ;
if ( to ) *to = sel.selEnd ; if ( to ) *to = sel.selEnd ;
@@ -1039,7 +1043,7 @@ void wxTextCtrl::SetValue(const wxString& str)
#else #else
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ; wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ; CFStringRef value = cf ;
verify_noerr( SetControlData( (ControlRef) m_macControl , 0, GetWindowStyle() & wxTE_PASSWORD ? verify_noerr( SetControlData( *m_peer , 0, GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag, kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag,
sizeof(CFStringRef), &value ) ); sizeof(CFStringRef), &value ) );
#endif #endif
@@ -1167,6 +1171,8 @@ void wxTextCtrl::Copy()
ClearCurrentScrap(); ClearCurrentScrap();
TXNCopy((TXNObject)m_macTXN); TXNCopy((TXNObject)m_macTXN);
TXNConvertToPublicScrap(); TXNConvertToPublicScrap();
#else
m_peer->SendHICommand( kHICommandCopy ) ;
#endif #endif
} }
} }
@@ -1179,6 +1185,8 @@ void wxTextCtrl::Cut()
ClearCurrentScrap(); ClearCurrentScrap();
TXNCut((TXNObject)m_macTXN); TXNCut((TXNObject)m_macTXN);
TXNConvertToPublicScrap(); TXNConvertToPublicScrap();
#else
m_peer->SendHICommand( kHICommandCut ) ;
#endif #endif
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ; event.SetString( GetValue() ) ;
@@ -1195,6 +1203,8 @@ void wxTextCtrl::Paste()
TXNConvertFromPublicScrap(); TXNConvertFromPublicScrap();
TXNPaste((TXNObject)m_macTXN); TXNPaste((TXNObject)m_macTXN);
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ; SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
#else
m_peer->SendHICommand( kHICommandPaste ) ;
#endif #endif
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ; event.SetString( GetValue() ) ;
@@ -1246,7 +1256,7 @@ void wxTextCtrl::SetEditable(bool editable)
TXNSetTXNObjectControls( (TXNObject) m_macTXN , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ; TXNSetTXNObjectControls( (TXNObject) m_macTXN , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ;
#else #else
Boolean value = !editable ; Boolean value = !editable ;
::SetControlData( (ControlHandle) m_macControl, 0, kControlEditTextLockedTag , sizeof( value ) , &value ) ; ::SetControlData( *m_peer, 0, kControlEditTextLockedTag , sizeof( value ) , &value ) ;
#endif #endif
} }
} }
@@ -1336,7 +1346,7 @@ void wxTextCtrl::SetSelection(long from, long to)
ControlEditTextSelectionRec sel ; ControlEditTextSelectionRec sel ;
sel.selStart = from ; sel.selStart = from ;
sel.selEnd = to ; sel.selEnd = to ;
verify_noerr( SetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag, verify_noerr( SetControlData( *m_peer , 0, kControlEditTextSelectionTag,
sizeof(ControlEditTextSelectionRec), &sel ) ); sizeof(ControlEditTextSelectionRec), &sel ) );
#endif #endif
@@ -1474,7 +1484,7 @@ void wxTextCtrl::WriteText(const wxString& str)
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ; wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ; CFStringRef value = cf ;
SetControlData( (ControlRef) m_macControl , 0, kControlEditTextInsertCFStringRefTag, SetControlData( *m_peer , 0, kControlEditTextInsertCFStringRefTag,
sizeof(CFStringRef), &value ); sizeof(CFStringRef), &value );
#else #else
wxString val = GetValue() ; wxString val = GetValue() ;
@@ -1632,6 +1642,13 @@ int wxTextCtrl::GetNumberOfLines() const
ItemCount lines = 0 ; ItemCount lines = 0 ;
#if wxMAC_USE_MLTE #if wxMAC_USE_MLTE
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ; TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
#else
wxString content = GetValue() ;
lines = 1;
for (size_t i = 0; i < content.Length() ; i++)
{
if (content[i] == '\r') lines++;
}
#endif #endif
return lines ; return lines ;
} }
@@ -1778,14 +1795,36 @@ int wxTextCtrl::GetLineLength(long lineNo) const
++xpos ; ++xpos ;
} }
} }
#else
// TODO change this if possible to reflect real lines
wxString content = GetValue() ;
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
{
if (count == lineNo)
{
// Count chars in line then
count = 0;
for (size_t j = i; j < content.Length(); j++)
{
count++;
if (content[j] == '\n') return count;
}
return count;
}
if (content[i] == '\n') count++;
}
#endif #endif
return 0; return 0;
} }
wxString wxTextCtrl::GetLineText(long lineNo) const wxString wxTextCtrl::GetLineText(long lineNo) const
{ {
wxString line ;
#if wxMAC_USE_MLTE #if wxMAC_USE_MLTE
wxString line ;
Point curpt ; Point curpt ;
wxString content = GetValue() ; wxString content = GetValue() ;
@@ -1823,8 +1862,34 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
} }
} }
} }
#endif
return line ; return line ;
#else
// TODO change this if possible to reflect real lines
wxString content = GetValue() ;
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
{
if (count == lineNo)
{
// Add chars in line then
wxString tmp;
for (size_t j = i; j < content.Length(); j++)
{
if (content[j] == '\n')
return tmp;
tmp += content[j];
}
return tmp;
}
if (content[i] == '\n') count++;
}
return wxEmptyString ;
#endif
} }
/* /*
@@ -1956,7 +2021,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
keychar = short(ev->message & charCodeMask); keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ; keycode = short(ev->message & keyCodeMask) >> 8 ;
::HandleControlKey( (ControlRef) m_macControl , keycode , keychar , ev->modifiers ) ; ::HandleControlKey( *m_peer , keycode , keychar , ev->modifiers ) ;
} }
} }
} }

View File

@@ -65,8 +65,10 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
m_peer = new wxMacControl() ;
verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ; kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , *m_peer ) );
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
@@ -87,12 +89,12 @@ wxSize wxToggleButton::DoGetBestSize() const
void wxToggleButton::SetValue(bool val) void wxToggleButton::SetValue(bool val)
{ {
::SetControl32BitValue( (ControlRef) m_macControl , val ) ; ::SetControl32BitValue( *m_peer , val ) ;
} }
bool wxToggleButton::GetValue() const bool wxToggleButton::GetValue() const
{ {
return GetControl32BitValue( (ControlRef) m_macControl ) ; return GetControl32BitValue( *m_peer ) ;
} }
void wxToggleButton::Command(wxCommandEvent & event) void wxToggleButton::Command(wxCommandEvent & event)

View File

@@ -972,13 +972,14 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
m_peer = new wxMacControl() ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitely // the content view, so we have to retrieve it explicitely
HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID , HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID ,
(ControlRef*)&m_macControl ) ; *m_peer ) ;
#else #else
::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ; ::CreateRootControl( (WindowRef)m_macWindow , *m_peer ) ;
#endif #endif
// the root control level handleer // the root control level handleer
MacInstallEventHandler() ; MacInstallEventHandler() ;

View File

@@ -1281,7 +1281,7 @@ OSStatus wxMacCarbonEvent::GetParameter(EventParamName inName, EventParamType in
return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ) ; return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ) ;
} }
OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, void * inData) OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, const void * inData)
{ {
return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ; return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ;
} }
@@ -1305,6 +1305,36 @@ OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size
return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ; return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ;
} }
OSStatus wxMacControl::SendEvent( EventRef event , OptionBits inOptions )
{
return SendEventToEventTargetWithOptions( event,
HIObjectGetEventTarget( (HIObjectRef) m_controlRef ),
inOptions );
}
OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions )
{
wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ) ;
event.SetParameter<HICommand>(kEventParamDirectObject,command) ;
return SendEvent( event , inOptions ) ;
}
OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions )
{
HICommand command ;
memset( &command, 0 , sizeof(command) ) ;
command.commandID = commandID ;
return SendHICommand( command , inOptions ) ;
}
void wxMacControl::Flash( ControlPartCode part , UInt32 ticks )
{
HiliteControl( m_controlRef , part ) ;
unsigned long finalTicks ;
Delay( ticks , &finalTicks ) ;
HiliteControl( m_controlRef , kControlNoPart ) ;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// debugging support // debugging support
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -577,6 +577,7 @@ wxWindowMac::wxWindowMac(wxWindowMac *parent,
void wxWindowMac::Init() void wxWindowMac::Init()
{ {
m_peer = NULL ;
m_frozenness = 0 ; m_frozenness = 0 ;
#if WXWIN_COMPATIBILITY_2_4 #if WXWIN_COMPATIBILITY_2_4
m_backgroundTransparent = FALSE; m_backgroundTransparent = FALSE;
@@ -589,8 +590,6 @@ void wxWindowMac::Init()
m_vScrollBar = NULL ; m_vScrollBar = NULL ;
m_macBackgroundBrush = wxNullBrush ; m_macBackgroundBrush = wxNullBrush ;
m_macControl = NULL ;
m_macIsUserPane = TRUE; m_macIsUserPane = TRUE;
// make sure all proc ptrs are available // make sure all proc ptrs are available
@@ -652,13 +651,12 @@ wxWindowMac::~wxWindowMac()
if (parent->GetDefaultItem() == (wxButton*) this) if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL); parent->SetDefaultItem(NULL);
} }
if ( (ControlRef) m_macControl ) if ( m_peer && m_peer->Ok() )
{ {
// in case the callback might be called during destruction // in case the callback might be called during destruction
wxRemoveMacControlAssociation( this) ; wxRemoveMacControlAssociation( this) ;
::SetControlColorProc( (ControlRef) m_macControl , NULL ) ; ::SetControlColorProc( *m_peer , NULL ) ;
::DisposeControl( (ControlRef) m_macControl ) ; ::DisposeControl( *m_peer ) ;
m_macControl = NULL ;
} }
if ( g_MacLastWindow == this ) if ( g_MacLastWindow == this )
@@ -683,14 +681,19 @@ wxWindowMac::~wxWindowMac()
m_dropTarget = NULL; m_dropTarget = NULL;
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
delete m_peer ;
}
WXWidget wxWindowMac::GetHandle() const
{
return (WXWidget) (ControlRef) *m_peer ;
} }
//
void wxWindowMac::MacInstallEventHandler() void wxWindowMac::MacInstallEventHandler()
{ {
wxAssociateControlWithMacControl( (ControlRef) m_macControl , this ) ; wxAssociateControlWithMacControl( *m_peer , this ) ;
InstallControlEventHandler( (ControlRef) m_macControl, GetwxMacWindowEventHandlerUPP(), InstallControlEventHandler( *m_peer, GetwxMacWindowEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this, GetEventTypeCount(eventList), eventList, this,
(EventHandlerRef *)&m_macControlEventHandler); (EventHandlerRef *)&m_macControlEventHandler);
@@ -727,25 +730,27 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
// | kControlWantsIdle // | kControlWantsIdle
; ;
::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , (ControlRef*) &m_macControl); m_peer = new wxMacControl() ;
::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , *m_peer);
MacPostControlCreate(pos,size) ; MacPostControlCreate(pos,size) ;
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneDrawProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneDrawProcTag,
sizeof(gControlUserPaneDrawUPP),(Ptr) &gControlUserPaneDrawUPP); sizeof(gControlUserPaneDrawUPP),(Ptr) &gControlUserPaneDrawUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneHitTestProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneHitTestProcTag,
sizeof(gControlUserPaneHitTestUPP),(Ptr) &gControlUserPaneHitTestUPP); sizeof(gControlUserPaneHitTestUPP),(Ptr) &gControlUserPaneHitTestUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneTrackingProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneTrackingProcTag,
sizeof(gControlUserPaneTrackingUPP),(Ptr) &gControlUserPaneTrackingUPP); sizeof(gControlUserPaneTrackingUPP),(Ptr) &gControlUserPaneTrackingUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneIdleProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneIdleProcTag,
sizeof(gControlUserPaneIdleUPP),(Ptr) &gControlUserPaneIdleUPP); sizeof(gControlUserPaneIdleUPP),(Ptr) &gControlUserPaneIdleUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneKeyDownProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneKeyDownProcTag,
sizeof(gControlUserPaneKeyDownUPP),(Ptr) &gControlUserPaneKeyDownUPP); sizeof(gControlUserPaneKeyDownUPP),(Ptr) &gControlUserPaneKeyDownUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneActivateProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneActivateProcTag,
sizeof(gControlUserPaneActivateUPP),(Ptr) &gControlUserPaneActivateUPP); sizeof(gControlUserPaneActivateUPP),(Ptr) &gControlUserPaneActivateUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneFocusProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneFocusProcTag,
sizeof(gControlUserPaneFocusUPP),(Ptr) &gControlUserPaneFocusUPP); sizeof(gControlUserPaneFocusUPP),(Ptr) &gControlUserPaneFocusUPP);
SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneBackgroundProcTag, SetControlData(*m_peer,kControlEntireControl,kControlUserPaneBackgroundProcTag,
sizeof(gControlUserPaneBackgroundUPP),(Ptr) &gControlUserPaneBackgroundUPP); sizeof(gControlUserPaneBackgroundUPP),(Ptr) &gControlUserPaneBackgroundUPP);
#endif #endif
} }
@@ -766,15 +771,15 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size) void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
{ {
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ; wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
::SetControlReference( (ControlRef) m_macControl , (long) this ) ; ::SetControlReference( *m_peer , (long) this ) ;
MacInstallEventHandler(); MacInstallEventHandler();
ControlRef container = (ControlRef) GetParent()->GetHandle() ; ControlRef container = (ControlRef) GetParent()->GetHandle() ;
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
::EmbedControl( (ControlRef) m_macControl , container ) ; ::EmbedControl( *m_peer , container ) ;
// adjust font, controlsize etc // adjust font, controlsize etc
DoSetWindowVariant( m_windowVariant ) ; DoSetWindowVariant( m_windowVariant ) ;
@@ -782,10 +787,10 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
// eventually we can fix some clipping issues be reactivating this hook // eventually we can fix some clipping issues be reactivating this hook
//if ( m_macIsUserPane ) //if ( m_macIsUserPane )
// SetControlColorProc( (ControlRef) m_macControl , wxMacSetupControlBackgroundUPP ) ; // SetControlColorProc( *m_peer , wxMacSetupControlBackgroundUPP ) ;
#endif #endif
UMASetControlTitle( (ControlRef) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ; UMASetControlTitle( *m_peer , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
if (!m_macIsUserPane) if (!m_macIsUserPane)
{ {
@@ -799,11 +804,11 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
{ {
// Don't assert, in case we set the window variant before // Don't assert, in case we set the window variant before
// the window is created // the window is created
// wxASSERT( m_macControl != NULL ) ; // wxASSERT( m_peer->Ok() ) ;
m_windowVariant = variant ; m_windowVariant = variant ;
if (!m_macControl) if (m_peer == NULL || !m_peer->Ok())
return; return;
ControlSize size ; ControlSize size ;
@@ -844,7 +849,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
wxFAIL_MSG(_T("unexpected window variant")); wxFAIL_MSG(_T("unexpected window variant"));
break ; break ;
} }
::SetControlData( (ControlRef) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size ); ::SetControlData( *m_peer , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
wxFont font ; wxFont font ;
font.MacCreateThemeFont( themeFont ) ; font.MacCreateThemeFont( themeFont ) ;
@@ -884,7 +889,7 @@ void wxWindowMac::MacUpdateControlFont()
fontStyle.foreColor = MAC_WXCOLORREF(GetForegroundColour().GetPixel() ) ; fontStyle.foreColor = MAC_WXCOLORREF(GetForegroundColour().GetPixel() ) ;
fontStyle.flags |= kControlUseForeColorMask ; fontStyle.flags |= kControlUseForeColorMask ;
::SetControlFontStyle( (ControlRef) m_macControl , &fontStyle ); ::SetControlFontStyle( *m_peer , &fontStyle );
Refresh() ; Refresh() ;
} }
@@ -940,7 +945,7 @@ bool wxWindowMac::MacCanFocus() const
// to issue a SetKeyboardFocus event and verify after whether it succeeded, this would risk problems // to issue a SetKeyboardFocus event and verify after whether it succeeded, this would risk problems
// in event handlers... // in event handlers...
UInt32 features = 0 ; UInt32 features = 0 ;
GetControlFeatures( (ControlRef) m_macControl , &features ) ; GetControlFeatures( *m_peer , &features ) ;
return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ; return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ;
} }
@@ -1033,7 +1038,7 @@ void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
int& w, int& h) const int& w, int& h) const
{ {
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) m_macControl , &bounds ) ; GetControlBounds( *m_peer , &bounds ) ;
x = bounds.left ; x = bounds.left ;
@@ -1080,7 +1085,7 @@ void wxWindowMac::DoGetSize(int *x, int *y) const
#else #else
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) m_macControl , &bounds ) ; GetControlBounds( *m_peer , &bounds ) ;
if(x) *x = bounds.right - bounds.left ; if(x) *x = bounds.right - bounds.left ;
if(y) *y = bounds.bottom - bounds.top ; if(y) *y = bounds.bottom - bounds.top ;
#endif #endif
@@ -1105,7 +1110,7 @@ void wxWindowMac::DoGetPosition(int *x, int *y) const
if(y) *y = y1 ; if(y) *y = y1 ;
#else #else
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) m_macControl , &bounds ) ; GetControlBounds( *m_peer , &bounds ) ;
wxCHECK_RET( GetParent() , wxT("Missing Parent") ) ; wxCHECK_RET( GetParent() , wxT("Missing Parent") ) ;
int xx = bounds.left ; int xx = bounds.left ;
@@ -1199,7 +1204,7 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const
if ( y ) pt.y = *y ; if ( y ) pt.y = *y ;
if ( !IsTopLevel() ) if ( !IsTopLevel() )
HIViewConvertPoint( &pt , (ControlRef) m_macControl , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ; HIViewConvertPoint( &pt , *m_peer , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ;
if ( x ) *x = (int) pt.x ; if ( x ) *x = (int) pt.x ;
if ( y ) *y = (int) pt.y ; if ( y ) *y = (int) pt.y ;
@@ -1207,7 +1212,7 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const
if ( !IsTopLevel() ) if ( !IsTopLevel() )
{ {
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) m_macControl , &bounds ) ; GetControlBounds( *m_peer , &bounds ) ;
if(x) *x += bounds.left ; if(x) *x += bounds.left ;
if(y) *y += bounds.top ; if(y) *y += bounds.top ;
} }
@@ -1232,7 +1237,7 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const
if ( y ) pt.y = *y ; if ( y ) pt.y = *y ;
if ( !IsTopLevel() ) if ( !IsTopLevel() )
HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle() , (ControlRef) m_macControl ) ; HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle() , *m_peer ) ;
if ( x ) *x = (int) pt.x ; if ( x ) *x = (int) pt.x ;
if ( y ) *y = (int) pt.y ; if ( y ) *y = (int) pt.y ;
@@ -1240,7 +1245,7 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const
if ( !IsTopLevel() ) if ( !IsTopLevel() )
{ {
Rect bounds ; Rect bounds ;
GetControlBounds( (ControlRef) m_macControl , &bounds ) ; GetControlBounds( *m_peer , &bounds ) ;
if(x) *x -= bounds.left ; if(x) *x -= bounds.left ;
if(y) *y -= bounds.top ; if(y) *y -= bounds.top ;
} }
@@ -1261,17 +1266,17 @@ void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , in
{ {
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
Rect content ; Rect content ;
if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr ) if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{ {
GetRegionBounds( rgn , &content ) ; GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
} }
else else
{ {
GetControlBounds( (ControlRef) m_macControl , &content ) ; GetControlBounds( *m_peer , &content ) ;
} }
Rect structure ; Rect structure ;
GetControlBounds( (ControlRef) m_macControl , &structure ) ; GetControlBounds( *m_peer , &structure ) ;
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif #endif
@@ -1289,17 +1294,17 @@ wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
Rect content ; Rect content ;
if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr ) if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{ {
GetRegionBounds( rgn , &content ) ; GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
} }
else else
{ {
GetControlBounds( (ControlRef) m_macControl , &content ) ; GetControlBounds( *m_peer , &content ) ;
} }
Rect structure ; Rect structure ;
GetControlBounds( (ControlRef) m_macControl , &structure ) ; GetControlBounds( *m_peer , &structure ) ;
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif #endif
@@ -1321,18 +1326,18 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
Rect content ; Rect content ;
if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr ) if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{ {
GetRegionBounds( rgn , &content ) ; GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
} }
else else
{ {
GetControlBounds( (ControlRef) m_macControl , &content ) ; GetControlBounds( *m_peer , &content ) ;
} }
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
Rect structure ; Rect structure ;
GetControlBounds( (ControlRef) m_macControl , &structure ) ; GetControlBounds( *m_peer , &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
#endif #endif
ww = content.right - content.left ; ww = content.right - content.left ;
@@ -1529,21 +1534,21 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
{ {
// we don't adjust twice for the origin // we don't adjust twice for the origin
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ; Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
bool vis = IsControlVisible( (ControlRef) m_macControl ) ; bool vis = IsControlVisible( *m_peer ) ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not ! // the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
if ( vis ) if ( vis )
SetControlVisibility( (ControlRef)m_macControl , false , true ) ; SetControlVisibility( *m_peer , false , true ) ;
HIRect hir = { r.left , r.top , r.right - r.left , r.bottom - r.top } ; HIRect hir = { r.left , r.top , r.right - r.left , r.bottom - r.top } ;
HIViewSetFrame ( (ControlRef) m_macControl , &hir ) ; HIViewSetFrame ( *m_peer , &hir ) ;
if ( vis ) if ( vis )
SetControlVisibility( (ControlRef)m_macControl , true , true ) ; SetControlVisibility( *m_peer , true , true ) ;
#else #else
if ( vis ) if ( vis )
SetControlVisibility( (ControlRef)m_macControl , false , true ) ; SetControlVisibility( *m_peer , false , true ) ;
SetControlBounds( (ControlRef) m_macControl , &r ) ; SetControlBounds( *m_peer , &r ) ;
if ( vis ) if ( vis )
SetControlVisibility( (ControlRef)m_macControl , true , true ) ; SetControlVisibility( *m_peer , true , true ) ;
#endif #endif
MacRepositionScrollBars() ; MacRepositionScrollBars() ;
if ( doMove ) if ( doMove )
@@ -1573,7 +1578,7 @@ wxSize wxWindowMac::DoGetBestSize() const
Rect bestsize = { 0 , 0 , 0 , 0 } ; Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ; short baselineoffset ;
int bestWidth, bestHeight ; int bestWidth, bestHeight ;
::GetBestControlRect( (ControlRef) m_macControl , &bestsize , &baselineoffset ) ; ::GetBestControlRect( *m_peer , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) ) if ( EmptyRect( &bestsize ) )
{ {
@@ -1680,7 +1685,7 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
{ {
RgnHandle rgn = NewRgn() ; RgnHandle rgn = NewRgn() ;
Rect content ; Rect content ;
GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) ; GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) ;
GetRegionBounds( rgn , &content ) ; GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ; DisposeRgn( rgn ) ;
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
@@ -1689,7 +1694,7 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
if (!::EmptyRect( &content ) ) if (!::EmptyRect( &content ) )
{ {
Rect structure ; Rect structure ;
GetControlBounds( (ControlRef) m_macControl , &structure ) ; GetControlBounds( *m_peer , &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ; OffsetRect( &content , -structure.left , -structure.top ) ;
} }
#endif #endif
@@ -1716,9 +1721,9 @@ void wxWindowMac::SetTitle(const wxString& title)
{ {
m_label = wxStripMenuCodes(title) ; m_label = wxStripMenuCodes(title) ;
if ( m_macControl ) if ( m_peer && m_peer->Ok() )
{ {
UMASetControlTitle( (ControlRef) m_macControl , m_label , m_font.GetEncoding() ) ; UMASetControlTitle( *m_peer , m_label , m_font.GetEncoding() ) ;
} }
Refresh() ; Refresh() ;
} }
@@ -1736,7 +1741,7 @@ bool wxWindowMac::Show(bool show)
// TODO use visibilityChanged Carbon Event for OSX // TODO use visibilityChanged Carbon Event for OSX
bool former = MacIsReallyShown() ; bool former = MacIsReallyShown() ;
SetControlVisibility( (ControlRef) m_macControl , show , true ) ; SetControlVisibility( *m_peer , show , true ) ;
if ( former != MacIsReallyShown() ) if ( former != MacIsReallyShown() )
MacPropagateVisibilityChanged() ; MacPropagateVisibilityChanged() ;
return TRUE; return TRUE;
@@ -1744,21 +1749,21 @@ bool wxWindowMac::Show(bool show)
bool wxWindowMac::Enable(bool enable) bool wxWindowMac::Enable(bool enable)
{ {
wxASSERT( m_macControl != NULL ) ; wxASSERT( m_peer->Ok() ) ;
if ( !wxWindowBase::Enable(enable) ) if ( !wxWindowBase::Enable(enable) )
return FALSE; return FALSE;
bool former = MacIsReallyEnabled() ; bool former = MacIsReallyEnabled() ;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( enable ) if ( enable )
EnableControl( (ControlRef) m_macControl ) ; EnableControl( *m_peer ) ;
else else
DisableControl( (ControlRef) m_macControl ) ; DisableControl( *m_peer ) ;
#else #else
if ( enable ) if ( enable )
ActivateControl( (ControlRef) m_macControl ) ; ActivateControl( *m_peer ) ;
else else
DeactivateControl( (ControlRef) m_macControl ) ; DeactivateControl( *m_peer ) ;
#endif #endif
if ( former != MacIsReallyEnabled() ) if ( former != MacIsReallyEnabled() )
@@ -1842,7 +1847,7 @@ bool wxWindowMac::MacIsReallyShown()
{ {
// only under OSX the visibility of the TLW is taken into account // only under OSX the visibility of the TLW is taken into account
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return IsControlVisible( (ControlRef) m_macControl ) ; return IsControlVisible( *m_peer ) ;
#else #else
wxWindow* win = this ; wxWindow* win = this ;
while( win->IsShown() ) while( win->IsShown() )
@@ -1862,15 +1867,15 @@ bool wxWindowMac::MacIsReallyShown()
bool wxWindowMac::MacIsReallyEnabled() bool wxWindowMac::MacIsReallyEnabled()
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
return IsControlEnabled( (ControlRef) m_macControl ) ; return IsControlEnabled( *m_peer ) ;
#else #else
return IsControlActive( (ControlRef) m_macControl ) ; return IsControlActive( *m_peer ) ;
#endif #endif
} }
bool wxWindowMac::MacIsReallyHilited() bool wxWindowMac::MacIsReallyHilited()
{ {
return IsControlActive( (ControlRef) m_macControl ) ; return IsControlActive( *m_peer ) ;
} }
void wxWindowMac::MacFlashInvalidAreas() void wxWindowMac::MacFlashInvalidAreas()
@@ -1925,7 +1930,7 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( rect == NULL ) if ( rect == NULL )
HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ; HIViewSetNeedsDisplay( *m_peer , true ) ;
else else
{ {
RgnHandle update = NewRgn() ; RgnHandle update = NewRgn() ;
@@ -1933,7 +1938,7 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ; SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
wxPoint origin = GetClientAreaOrigin() ; wxPoint origin = GetClientAreaOrigin() ;
OffsetRgn( update, origin.x , origin.y ) ; OffsetRgn( update, origin.x , origin.y ) ;
HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , update , true ) ; HIViewSetNeedsDisplayInRegion( *m_peer , update , true ) ;
} }
#else #else
/* /*
@@ -1950,16 +1955,16 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , updateRgn ) ; InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , updateRgn ) ;
DisposeRgn(updateRgn) ; DisposeRgn(updateRgn) ;
*/ */
if ( IsControlVisible( (ControlRef) m_macControl ) ) if ( IsControlVisible( *m_peer ) )
{ {
SetControlVisibility( (ControlRef) m_macControl , false , false ) ; SetControlVisibility( *m_peer , false , false ) ;
SetControlVisibility( (ControlRef) m_macControl , true , true ) ; SetControlVisibility( *m_peer , true , true ) ;
} }
/* /*
if ( MacGetTopLevelWindow() == NULL ) if ( MacGetTopLevelWindow() == NULL )
return ; return ;
if ( !IsControlVisible( (ControlRef) m_macControl ) ) if ( !IsControlVisible( *m_peer ) )
return ; return ;
wxPoint client = GetClientAreaOrigin(); wxPoint client = GetClientAreaOrigin();
@@ -2003,7 +2008,7 @@ void wxWindowMac::Freeze()
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if ( !m_frozenness++ ) if ( !m_frozenness++ )
{ {
HIViewSetDrawingEnabled( (HIViewRef) m_macControl , false ) ; HIViewSetDrawingEnabled( *m_peer , false ) ;
} }
#endif #endif
} }
@@ -2036,9 +2041,9 @@ void wxWindowMac::Thaw()
if ( !--m_frozenness ) if ( !--m_frozenness )
{ {
HIViewSetDrawingEnabled( (HIViewRef) m_macControl , true ) ; HIViewSetDrawingEnabled( *m_peer , true ) ;
InvalidateControlAndChildren( (HIViewRef) m_macControl ) ; InvalidateControlAndChildren( *m_peer ) ;
// HIViewSetNeedsDisplay( (HIViewRef) m_macControl , true ) ; // HIViewSetNeedsDisplay( *m_peer , true ) ;
} }
#endif #endif
} }
@@ -2046,7 +2051,7 @@ void wxWindowMac::Thaw()
void wxWindowMac::MacRedrawControl() void wxWindowMac::MacRedrawControl()
{ {
/* /*
if ( (ControlRef) m_macControl && MacGetTopLevelWindowRef() && IsControlVisible( (ControlRef) m_macControl ) ) if ( *m_peer && MacGetTopLevelWindowRef() && IsControlVisible( *m_peer ) )
{ {
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
Update() ; Update() ;
@@ -2055,7 +2060,7 @@ void wxWindowMac::MacRedrawControl()
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
wxMacWindowClipper clipper(this) ; wxMacWindowClipper clipper(this) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlRef) m_macControl ) ; UMADrawControl( *m_peer ) ;
#endif #endif
} }
*/ */
@@ -2311,22 +2316,22 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ; HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ;
scrollrect = CGRectIntersection( scrollrect , scrollarea ) ; scrollrect = CGRectIntersection( scrollrect , scrollarea ) ;
} }
if ( HIViewGetNeedsDisplay( (ControlRef) m_macControl ) ) if ( HIViewGetNeedsDisplay( *m_peer ) )
{ {
// becuase HIViewScrollRect does not scroll the already invalidated area we have two options // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
// either immediate redraw or full invalidate // either immediate redraw or full invalidate
#if 1 #if 1
// is the better overall solution, as it does not slow down scrolling // is the better overall solution, as it does not slow down scrolling
HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ; HIViewSetNeedsDisplay( *m_peer , true ) ;
#else #else
// this would be the preferred version for fast drawing controls // this would be the preferred version for fast drawing controls
if( UMAGetSystemVersion() < 0x1030 ) if( UMAGetSystemVersion() < 0x1030 )
Update() ; Update() ;
else else
HIViewRender((ControlRef) m_macControl) ; HIViewRender(*m_peer) ;
#endif #endif
} }
HIViewScrollRect ( (ControlRef) m_macControl , &scrollrect , dx ,dy ) ; HIViewScrollRect ( *m_peer , &scrollrect , dx ,dy ) ;
#else #else
wxPoint pos; wxPoint pos;
@@ -2339,7 +2344,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
wxClientDC dc(this) ; wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
GetControlBounds( (ControlRef) m_macControl, &scrollrect); GetControlBounds( *m_peer, &scrollrect);
scrollrect.top += MacGetTopBorderSize() ; scrollrect.top += MacGetTopBorderSize() ;
scrollrect.left += MacGetLeftBorderSize() ; scrollrect.left += MacGetLeftBorderSize() ;
scrollrect.bottom = scrollrect.top + height ; scrollrect.bottom = scrollrect.top + height ;
@@ -2447,7 +2452,7 @@ void wxWindowMac::OnInternalIdle()
void wxWindowMac::Raise() void wxWindowMac::Raise()
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
HIViewSetZOrder((ControlRef)m_macControl,kHIViewZOrderAbove, NULL) ; HIViewSetZOrder(*m_peer,kHIViewZOrderAbove, NULL) ;
#endif #endif
} }
@@ -2455,7 +2460,7 @@ void wxWindowMac::Raise()
void wxWindowMac::Lower() void wxWindowMac::Lower()
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
HIViewSetZOrder((ControlRef)m_macControl,kHIViewZOrderBelow, NULL) ; HIViewSetZOrder(*m_peer,kHIViewZOrderBelow, NULL) ;
#endif #endif
} }
@@ -2545,10 +2550,10 @@ void wxWindowMac::Update()
status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ; status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
} }
else else
HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ; HIViewSetNeedsDisplay( *m_peer , true ) ;
} }
#else #else
::Draw1Control( (ControlRef) m_macControl ) ; ::Draw1Control( *m_peer ) ;
#endif #endif
} }
@@ -2568,9 +2573,9 @@ wxRegion wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures )
Rect r ; Rect r ;
RgnHandle visRgn = NewRgn() ; RgnHandle visRgn = NewRgn() ;
RgnHandle tempRgn = NewRgn() ; RgnHandle tempRgn = NewRgn() ;
if ( IsControlVisible( (ControlRef) m_macControl ) ) if ( IsControlVisible( *m_peer ) )
{ {
GetControlBounds( (ControlRef) m_macControl , &r ) ; GetControlBounds( *m_peer , &r ) ;
if (! MacGetTopLevelWindow()->MacUsesCompositing() ) if (! MacGetTopLevelWindow()->MacUsesCompositing() )
{ {
MacRootWindowToWindow( &r.left , & r.top ) ; MacRootWindowToWindow( &r.left , & r.top ) ;
@@ -2694,7 +2699,7 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
if ( MacGetTopLevelWindow()->MacUsesCompositing() == false ) if ( MacGetTopLevelWindow()->MacUsesCompositing() == false )
{ {
Rect bounds; Rect bounds;
UMAGetControlBoundsInWindowCoords( (ControlRef)m_macControl, &bounds ); UMAGetControlBoundsInWindowCoords( *m_peer, &bounds );
RgnHandle controlRgn = NewRgn(); RgnHandle controlRgn = NewRgn();
RectRgn( controlRgn, &bounds ); RectRgn( controlRgn, &bounds );
//KO: This sets the ownUpdateRgn to the area of this control that is inside //KO: This sets the ownUpdateRgn to the area of this control that is inside