wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
(( 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) ;
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
if ( info.contentType != kControlNoContent )
{
- ::SetControlData( (ControlRef) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
+ m_peer->SetData( kControlButtonPart , kControlBevelButtonContentTag , info ) ;
}
}
m_label = label ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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
{
ControlButtonContentInfo info ;
info.contentType = kControlNoContent ;
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) ;
parent->SetDefaultItem(this);
}
- Boolean inData;
- if ( btnOldDefault && btnOldDefault->m_macControl )
- {
- 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) ) ;
- }
+ if ( btnOldDefault )
+ btnOldDefault->m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
+ m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 1 ) ;
}
wxSize wxButton::DoGetBestSize() const
void wxButton::Command (wxCommandEvent & event)
{
- if ( (ControlRef) m_macControl )
- {
- HiliteControl( (ControlRef) m_macControl , kControlButtonPart ) ;
- unsigned long finalTicks ;
- Delay( 8 , &finalTicks ) ;
- HiliteControl( (ControlRef) m_macControl , 0 ) ;
- }
+ m_peer->Flash(kControlButtonPart) ;
ProcessCommand (event);
}
maxValue = 2 /* kControlCheckboxMixedValue */;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
- CFSTR("") , 0 , false , (ControlRef*) &m_macControl ) ) ;
-
- SetControl32BitMaximum( (ControlRef) m_macControl , maxValue ) ;
+ CFSTR("") , 0 , false , *m_peer ) );
+
+ m_peer->SetMaximum( maxValue ) ;
MacPostControlCreate(pos,size) ;
wxCheckBoxState wxCheckBox::DoGet3StateValue() const
{
- return (wxCheckBoxState) ::GetControl32BitValue( (ControlRef) m_macControl );
+ return (wxCheckBoxState) m_peer->GetValue() ;
}
void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
{
- ::SetControl32BitValue( (ControlRef) m_macControl , (int) val) ;
- MacRedrawControl() ;
+ m_peer->SetValue( val ) ;
}
wxInt32 wxCheckBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
- ControlRef browser ;
- verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , (ControlRef *)&m_macControl ) );
- browser = (ControlRef) m_macControl ;
+ m_peer = new wxMacControl() ;
+ verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , *m_peer ) );
+
DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
if ( style & wxLB_MULTIPLE )
{
options += kDataBrowserSelectOnlyOne ;
}
- verify_noerr(SetDataBrowserSelectionFlags (browser, options ) );
+ verify_noerr(SetDataBrowserSelectionFlags (*m_peer, options ) );
DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0;
columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn |
kDataBrowserDefaultPropertyFlags;
- verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
+ verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
// text column
;
- verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
+ verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
- verify_noerr(::AutoSizeDataBrowserListViewColumns( browser ) ) ;
- verify_noerr(::SetDataBrowserHasScrollBars( browser , false , true ) ) ;
- verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser, kDataBrowserTableViewFillHilite ) ) ;
- verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser , 0 ) ) ;
+ verify_noerr(::AutoSizeDataBrowserListViewColumns( *m_peer ) ) ;
+ verify_noerr(::SetDataBrowserHasScrollBars( *m_peer , false , true ) ) ;
+ verify_noerr(::SetDataBrowserTableViewHiliteStyle( *m_peer, kDataBrowserTableViewFillHilite ) ) ;
+ verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( *m_peer , 0 ) ) ;
DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks;
#else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif
- SetDataBrowserCallbacks(browser, &callbacks);
+ SetDataBrowserCallbacks(*m_peer, &callbacks);
MacPostControlCreate(pos,size) ;
{
m_checks[item] = check;
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 ) ) ;
}
}
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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() ;
- SetControlData( (ControlRef) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
- SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ;
- SetControl32BitMaximum( (ControlRef) m_macControl , 0) ;
- if ( n > 0 )
- SetControl32BitValue( (ControlRef) m_macControl , 1 ) ;
+ m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ;
+ m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 ) ;
MacPostControlCreate(pos,size) ;
// TODO wxCB_SORT
for ( int i = 0; i < n; i++ )
m_datas.Add( NULL ) ;
int index = m_strings.GetCount() - 1 ;
DoSetItemClientData( index , NULL ) ;
- SetControl32BitMaximum( (ControlRef) m_macControl , GetCount()) ;
+ m_peer->SetMaximum( GetCount() ) ;
return index ;
}
m_strings.Insert( item, pos ) ;
m_datas.Insert( NULL, pos ) ;
DoSetItemClientData( pos , NULL ) ;
- SetControl32BitMaximum( (ControlRef) m_macControl , pos) ;
+ m_peer->SetMaximum( GetCount() ) ;
return pos ;
}
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
- SetControl32BitMaximum( (ControlRef) m_macControl , GetCount()) ;
+ m_peer->SetMaximum( GetCount() ) ;
}
void wxChoice::Clear()
}
m_strings.Empty() ;
m_datas.Empty() ;
- SetControl32BitMaximum( (ControlRef) m_macControl , 0 ) ;
+ m_peer->SetMaximum( 0 ) ;
}
void wxChoice::FreeData()
// ----------------------------------------------------------------------------
int wxChoice::GetSelection() const
{
- return GetControl32BitValue( (ControlRef) m_macControl ) -1 ;
+ return m_peer->GetValue() -1 ;
}
void wxChoice::SetSelection(int n)
{
- SetControl32BitValue( (ControlRef) m_macControl , n + 1 ) ;
+ m_peer->SetValue( n + 1 ) ;
}
// ----------------------------------------------------------------------------
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
//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("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 )
- SetControl32BitValue( (ControlRef) m_macControl , 1 ) ;
+ SetControl32BitValue( *m_peer , 1 ) ;
MacPostControlCreate(pos,size) ;
DoAppend( choices[ i ] );
}
- HIViewSetVisible( (HIViewRef) m_macControl, true );
+ HIViewSetVisible( *m_peer, true );
SetSelection(0);
+ EventHandlerRef comboEventHandler ;
+ InstallControlEventHandler( *m_peer, GetwxMacComboBoxEventHandlerUPP(),
+ GetEventTypeCount(eventList), eventList, this,
+ (EventHandlerRef *)&comboEventHandler);
#else
m_choice = new wxComboBoxChoice(this, style );
{
#if USE_HICOMBOBOX
CFStringRef myString;
- HIComboBoxCopyTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex)GetSelection(), &myString );
+ HIComboBoxCopyTextItemAtIndex( *m_peer, (CFIndex)GetSelection(), &myString );
return wxMacCFStringHolder( myString, m_font.GetEncoding() ).AsString();
#else
wxString result;
{
#if USE_HICOMBOBOX
CFIndex outIndex;
- HIComboBoxAppendTextItem( (HIViewRef) m_macControl, wxMacCFStringHolder( item, m_font.GetEncoding() ), &outIndex );
- //SetControl32BitMaximum( (HIViewRef) m_macControl, GetCount() );
+ HIComboBoxAppendTextItem( *m_peer, wxMacCFStringHolder( item, m_font.GetEncoding() ), &outIndex );
+ //SetControl32BitMaximum( *m_peer, GetCount() );
return (int) outIndex;
#else
return m_choice->DoAppend( item ) ;
int wxComboBox::DoInsert(const wxString& item, int pos)
{
#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;
#else
int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
- return (int) HIComboBoxGetItemCount( (HIViewRef) m_macControl );
+ return (int) HIComboBoxGetItemCount( *m_peer );
#else
return m_choice->GetCount() ;
#endif
void wxComboBox::Delete(int n)
{
#if USE_HICOMBOBOX
- HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, (CFIndex)n );
+ HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex)n );
#else
// force client object deletion
if( HasClientObjectData() )
FreeData();
#if USE_HICOMBOBOX
for ( CFIndex i = GetCount() - 1 ; i >= 0 ; ++ i )
- verify_noerr( HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, i ) );
- wxMacCFStringHolder cf(wxEmptyString,m_font.GetEncoding()) ;
- CFStringRef cfr = cf ;
- SetControlData((ControlRef) m_macControl,kHIComboBoxEditTextPart,kControlEditTextCFStringTag,
- sizeof(CFStringRef),(Ptr) &cfr);
+ verify_noerr( HIComboBoxRemoveItemAtIndex( *m_peer, i ) );
+ m_peer->SetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag,CFSTR(""));
#else
m_choice->Clear();
#endif
void wxComboBox::SetSelection(int n)
{
#if USE_HICOMBOBOX
- SetControl32BitValue( (ControlRef) m_macControl , n + 1 ) ;
+ SetControl32BitValue( *m_peer , n + 1 ) ;
#else
m_choice->SetSelection( n );
{
#if USE_HICOMBOBOX
CFStringRef itemText;
- HIComboBoxCopyTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex)n, &itemText );
+ HIComboBoxCopyTextItemAtIndex( *m_peer, (CFIndex)n, &itemText );
return wxMacCFStringHolder(itemText).AsString();
#else
return m_choice->GetString( n );
wxString wxComboBox::GetStringSelection() const
{
#if USE_HICOMBOBOX
- CFStringRef cfr ;
- verify_noerr(GetControlData((ControlRef) m_macControl,kHIComboBoxEditTextPart,kControlEditTextCFStringTag,
- sizeof(CFStringRef),(Ptr) &cfr,NULL));
- // takes of release responsibility
- wxMacCFStringHolder cf( cfr ) ;
- return cf.AsString() ;
+ return wxMacCFStringHolder(m_peer->GetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString() ;
#else
int sel = GetSelection ();
if (sel > -1)
void wxComboBox::SetString(int n, const wxString& s)
{
#if USE_HICOMBOBOX
- verify_noerr ( HIComboBoxInsertTextItemAtIndex( (HIViewRef) m_macControl, (CFIndex) n,
+ verify_noerr ( HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex) n,
wxMacCFStringHolder(s, m_font.GetEncoding()) ) );
- verify_noerr ( HIComboBoxRemoveItemAtIndex( (HIViewRef) m_macControl, (CFIndex) n + 1 ) );
+ verify_noerr ( HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex) n + 1 ) );
#else
m_choice->SetString( n , s ) ;
#endif
void wxControl::OnKeyDown( wxKeyEvent &event )
{
- if ( (ControlRef) m_macControl == NULL )
+ if ( m_peer == NULL || !m_peer->Ok() )
return ;
#if TARGET_CARBON
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
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
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
- ::HandleControlKey( (ControlRef) m_macControl , keycode , keychar , ev->modifiers ) ;
+ ::HandleControlKey( *m_peer , keycode , keychar , ev->modifiers ) ;
#endif
}
const wxString& name)
{
m_macIsUserPane = FALSE ;
-
+
if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) )
return false;
wxSize size = s ;
- m_rangeMax = range ;
- m_gaugePos = 0 ;
-
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
{
size = wxSize( 200 , 16 ) ;
}
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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) ;
return TRUE;
}
-void wxGauge::SetShadowWidth(int w)
-{
-}
-
-void wxGauge::SetBezelFace(int w)
-{
-}
-
void wxGauge::SetRange(int r)
{
- m_rangeMax = r;
- ::SetControl32BitMaximum( (ControlRef) m_macControl , m_rangeMax ) ;
+ // we are going via the base class in case there is
+ // 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)
{
- m_gaugePos = pos;
- ::SetControl32BitValue( (ControlRef) m_macControl , m_gaugePos ) ;
-}
-
-int wxGauge::GetShadowWidth() const
-{
- return 0;
-}
-
-int wxGauge::GetBezelFace() const
-{
- return 0;
-}
-
-int wxGauge::GetRange() const
-{
- return m_rangeMax;
+ // we are going via the base class in case there is
+ // some change behind the values by it
+ wxGaugeBase::SetValue(pos) ;
+ if ( m_peer && m_peer->Ok() )
+ m_peer->SetValue( GetValue() ) ;
}
int wxGauge::GetValue() const
{
- return m_gaugePos;
+/*
+ if ( m_peer && m_peer->Ok() )
+ return m_peer->GetValue() ;
+*/
+ return m_gaugePos ;
}
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
- ControlRef browser ;
- verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , (ControlRef *)&m_macControl ) );
- browser = (ControlRef) m_macControl ;
+ m_peer = new wxMacControl() ;
+ verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , *m_peer ) );
DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
if ( style & wxLB_MULTIPLE )
{
options += kDataBrowserSelectOnlyOne ;
}
- verify_noerr(SetDataBrowserSelectionFlags (browser, options ) );
+ verify_noerr(SetDataBrowserSelectionFlags (*m_peer, options ) );
DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0;
kDataBrowserTableViewSelectionColumn ;
- verify_noerr(::AddDataBrowserListViewColumn(browser, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
- verify_noerr(::AutoSizeDataBrowserListViewColumns( browser ) ) ;
- verify_noerr(::SetDataBrowserHasScrollBars( browser , false , true ) ) ;
- verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser, kDataBrowserTableViewFillHilite ) ) ;
- verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser , 0 ) ) ;
+ verify_noerr(::AddDataBrowserListViewColumn(*m_peer, &columnDesc, kDataBrowserListViewAppendColumn) ) ;
+ verify_noerr(::AutoSizeDataBrowserListViewColumns( *m_peer ) ) ;
+ verify_noerr(::SetDataBrowserHasScrollBars( *m_peer , false , true ) ) ;
+ verify_noerr(::SetDataBrowserTableViewHiliteStyle( *m_peer, kDataBrowserTableViewFillHilite ) ) ;
+ verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( *m_peer , 0 ) ) ;
DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks;
#else
NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif
- SetDataBrowserCallbacks(browser, &callbacks);
+ SetDataBrowserCallbacks(*m_peer, &callbacks);
MacPostControlCreate(pos,size) ;
wxListBox::~wxListBox()
{
- SetControlReference( (ControlRef) m_macControl , NULL ) ;
+ SetControlReference( *m_peer , NULL ) ;
FreeData() ;
// avoid access during destruction
if ( m_macList )
void wxListBox::MacDelete( int 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 ) ;
}
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_nextId ;
}
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_nextId ;
}
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() ;
}
if ( n >= 0 )
{
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 ) ;
}
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
{
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 ;
}
aSelections.Empty();
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 ) ;
no_sel++ ;
{
// as we don't store the strings we only have to issue a redraw
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 )
{
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
tabsize = kControlSizeSmall;
}
+ m_peer = new wxMacControl() ;
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
- tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) );
+ tabsize , tabstyle, 0, NULL, *m_peer ) );
+
MacPostControlCreate(pos,size) ;
return TRUE ;
{
m_nSelection++;
// 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
/* Added by Mark Newsam
* 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.
*/
void wxNotebook::MacSetupTabs()
{
- SetControl32BitMaximum( (ControlRef) m_macControl , GetPageCount() ) ;
+ SetControl32BitMaximum( *m_peer , GetPageCount() ) ;
wxNotebookPage *page;
ControlTabInfoRec info;
info.iconSuiteID = 0;
wxMacStringToPascal( page->GetLabel() , info.name ) ;
- SetControlData( (ControlRef) m_macControl, ii+1, kControlTabInfoTag,
+ SetControlData( *m_peer, ii+1, kControlTabInfoTag,
sizeof( ControlTabInfoRec) , (char*) &info ) ;
- SetTabEnabled( (ControlRef) m_macControl , ii+1 , true ) ;
+ SetTabEnabled( *m_peer , ii+1 , true ) ;
#if TARGET_CARBON
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
{
wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
info.contentType = kControlContentIconRef ;
info.u.iconRef = iconRef ;
- SetControlData( (ControlRef) m_macControl, ii+1,kControlTabImageContentTag,
+ SetControlData( *m_peer, ii+1,kControlTabImageContentTag,
sizeof( info ), (Ptr)&info );
wxASSERT_MSG( err == noErr , wxT("Error when setting icon on tab") ) ;
if ( UMAGetSystemVersion() < 0x1030 )
#endif
}
Rect bounds;
- UMAGetControlBoundsInWindowCoords((ControlRef)m_macControl, &bounds);
+ UMAGetControlBoundsInWindowCoords(*m_peer, &bounds);
InvalWindowRect((WindowRef)MacGetTopLevelWindowRef(), &bounds);
}
}
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) )
{
OSStatus status = eventNotHandledErr ;
- SInt32 newSel = GetControl32BitValue( (ControlRef) m_macControl ) - 1 ;
+ SInt32 newSel = GetControl32BitValue( *m_peer ) - 1 ;
if ( newSel != m_nSelection )
{
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
}
else
{
- SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ;
+ SetControl32BitValue( *m_peer , m_nSelection + 1 ) ;
}
status = noErr ;
}
if ( bounds.bottom <= bounds.top )
bounds.bottom = bounds.top + 100 ;
+ m_peer = new wxMacControl() ;
+
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
- true /*primary*/ , (ControlRef*)&m_macControl ) ) ;
+ true /*primary*/ , *m_peer ) ) ;
for (i = 0; i < n; i++)
{
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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) ;
void wxRadioButton::SetValue(bool val)
{
wxRadioButton *cycle;
- if ( GetControl32BitValue( (ControlRef) m_macControl ) == val )
+ if ( GetControl32BitValue( *m_peer ) == val )
return ;
- ::SetControl32BitValue( (ControlRef) m_macControl , val ) ;
+ ::SetControl32BitValue( *m_peer , val ) ;
if (val)
{
cycle=this->NextInCycle();
bool wxRadioButton::GetValue() const
{
- return ::GetControl32BitValue( (ControlRef) m_macControl ) ;
+ return ::GetControl32BitValue( *m_peer ) ;
}
void wxRadioButton::Command (wxCommandEvent & event)
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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) ;
void wxScrollBar::SetThumbPosition(int viewStart)
{
- ::SetControl32BitValue( (ControlRef) m_macControl , viewStart ) ;
+ ::SetControl32BitValue( *m_peer , viewStart ) ;
}
int wxScrollBar::GetThumbPosition() const
{
- return ::GetControl32BitValue( (ControlRef) m_macControl ) ;
+ return ::GetControl32BitValue( *m_peer ) ;
}
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
- SetControl32BitMaximum( (ControlRef) m_macControl , range1 ) ;
- SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ;
- SetControl32BitValue( (ControlRef) m_macControl , position ) ;
- SetControlViewSize( (ControlRef) m_macControl , m_viewSize ) ;
+ SetControl32BitMaximum( *m_peer , range1 ) ;
+ SetControl32BitMinimum( *m_peer , 0 ) ;
+ SetControl32BitValue( *m_peer , position ) ;
+ SetControlViewSize( *m_peer , m_viewSize ) ;
if ( refresh )
MacRedrawControl() ;
void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
{
- int position = GetControl32BitValue( (ControlRef) m_macControl) ;
- int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ;
- int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ;
+ int position = GetControl32BitValue( *m_peer) ;
+ int minPos = GetControl32BitMinimum( *m_peer) ;
+ int maxPos = GetControl32BitMaximum( *m_peer) ;
wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc = 0;
wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
{
- int position = GetControl32BitValue( (ControlRef) m_macControl) ;
- int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ;
- int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ;
+ int position = GetControl32BitValue( *m_peer) ;
+ int minPos = GetControl32BitMinimum( *m_peer) ;
+ int maxPos = GetControl32BitMaximum( *m_peer) ;
wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc = 0;
if ( style & wxSL_AUTOTICKS )
tickMarks = maxValue - minValue ;
+ m_peer = new wxMacControl() ;
verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
- wxMacLiveScrollbarActionUPP , (ControlRef*) &m_macControl ) ) ;
+ wxMacLiveScrollbarActionUPP , *m_peer ) );
+
if(style & wxSL_VERTICAL) {
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
int wxSlider::GetValue() const
{
- return GetControl32BitValue( (ControlRef) m_macControl) ;
+ return GetControl32BitValue( *m_peer) ;
}
void wxSlider::SetValue(int value)
valuestring.Printf( wxT("%d") , value ) ;
if ( m_macValueStatic )
m_macValueStatic->SetLabel( valuestring ) ;
- SetControl32BitValue( (ControlRef) m_macControl , value ) ;
+ SetControl32BitValue( *m_peer , value ) ;
}
void wxSlider::SetRange(int minValue, int maxValue)
m_rangeMin = minValue;
m_rangeMax = maxValue;
- SetControl32BitMinimum( (ControlRef) m_macControl, m_rangeMin);
- SetControl32BitMaximum( (ControlRef) m_macControl, m_rangeMax);
+ SetControl32BitMinimum( *m_peer, m_rangeMin);
+ SetControl32BitMaximum( *m_peer, m_rangeMax);
if(m_macMinimumStatic) {
value.Printf(wxT("%d"), m_rangeMin);
void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
{
- SInt16 value = ::GetControl32BitValue( (ControlRef) m_macControl ) ;
+ SInt16 value = ::GetControl32BitValue( *m_peer ) ;
SetValue( value ) ;
wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
{
- SInt16 value = ::GetControl32BitValue( (ControlRef) m_macControl ) ;
+ SInt16 value = ::GetControl32BitValue( *m_peer ) ;
SetValue( value ) ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 ,
- (ControlRef*) &m_macControl ) ) ;
- SetControlAction( (ControlRef) m_macControl , wxMacLiveScrollbarActionUPP ) ;
+ *m_peer ) );
+
+ SetControlAction( *m_peer , wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate(pos,size) ;
return TRUE;
{
m_min = minVal;
m_max = maxVal;
- SetControl32BitMaximum( (ControlRef) m_macControl , maxVal ) ;
- SetControl32BitMinimum((ControlRef) m_macControl , minVal ) ;
+ SetControl32BitMaximum( *m_peer , maxVal ) ;
+ SetControl32BitMinimum(*m_peer , minVal ) ;
}
void wxSpinButton::MacHandleValueChanged( int inc )
{
m_value = oldValue ;
}
- SetControl32BitValue( (ControlRef) m_macControl , m_value ) ;
+ SetControl32BitValue( *m_peer , m_value ) ;
/* always send a thumbtrack event */
if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
- true /*primary*/ , (ControlRef*)&m_macControl ) ) ;
+ true /*primary*/ , *m_peer ) ) ;
MacPostControlCreate(pos,size) ;
return false;
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) ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
+ m_peer = new wxMacControl() ;
verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str ,
- NULL , (ControlRef*)&m_macControl ) ) ;
+ NULL , *m_peer ) ) ;
MacPostControlCreate(pos,size) ;
{
ControlFontStyleRec controlFont ;
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 ;
SInt16 baseline ;
wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
CFStringRef ref = str ;
- SetControlData( (ControlRef) m_macControl, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ),
+ SetControlData( *m_peer, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ),
&ref );
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
tabsize = kControlSizeSmall;
}
+ m_peer = new wxMacControl() ;
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
- tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) );
+ tabsize , tabstyle, 0, NULL, *m_peer ) );
+
MacPostControlCreate(pos,size) ;
return TRUE ;
wxTextCtrl::~wxTextCtrl()
{
#if wxMAC_USE_MLTE
- SetControlReference((ControlRef)m_macControl, 0) ;
+ SetControlReference(*m_peer, 0) ;
#if !wxMAC_USE_MLTE_HIVIEW
TXNDeleteObject((TXNObject)m_macTXN);
#endif
if ( scrollView )
{
HIViewAddSubview( scrollView , textView ) ;
- m_macControl = (WXWidget) scrollView ;
+ m_peer = scrollView ;
}
else
{
- m_macControl = (WXWidget) textView ;
+ m_peer = textView ;
}
#else
short featurSet;
| kControlWantsActivate | kControlHandlesTracking | kControlHasSpecialBackground
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
/* 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) ;
STPTextPaneVars *varsp ;
- mUPOpenControl( varsp, (ControlRef) m_macControl, m_windowStyle );
+ mUPOpenControl( varsp, *m_peer, m_windowStyle );
m_macTXNvars = varsp ;
m_macTXN = varsp->fTXNRec ;
#endif
{
wxMacWindowClipper clipper( this ) ;
#if !wxMAC_USE_MLTE_HIVIEW
- TPUpdateVisibility( (ControlRef) m_macControl ) ;
+ TPUpdateVisibility( *m_peer ) ;
#endif
SetTXNData( (STPTextPaneVars *)m_macTXNvars , (TXNObject) m_macTXN , st , kTXNStartOffset, kTXNEndOffset ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ;
CFStringRef cfr = cf ;
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) )
{
Boolean singleline = true ;
- ::SetControlData( (ControlHandle) m_macControl, kControlEditTextPart , kControlEditTextSingleLineTag , sizeof( singleline ) , &singleline ) ;
+ ::SetControlData( *m_peer, kControlEditTextPart , kControlEditTextSingleLineTag , sizeof( singleline ) , &singleline ) ;
}
MacPostControlCreate(pos,size) ;
#if !wxMAC_USE_MLTE_HIVIEW
MLTESetObjectVisibility((STPTextPaneVars*) m_macTXNvars , MacIsReallyShown() , GetWindowStyle() ) ;
if ( !MacIsReallyShown() )
- InvalWindowRect( GetControlOwner( (ControlHandle) m_macControl ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ;
+ InvalWindowRect( GetControlOwner( *m_peer ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ;
#endif
#else
if ( !(m_windowStyle & wxTE_MULTILINE) && MacIsReallyShown() )
ResType datatag = GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
- verify_noerr( GetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag,
+ verify_noerr( GetControlData( *m_peer , 0, kControlEditTextSelectionTag,
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( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag, sizeof(ControlEditTextSelectionRec), &sel ) );
+ verify_noerr( SetControlData( *m_peer , 0, datatag, sizeof(CFStringRef), &value ) );
+ verify_noerr( SetControlData( *m_peer , 0, kControlEditTextSelectionTag, sizeof(ControlEditTextSelectionRec), &sel ) );
CFRelease( value ) ;
}
CFStringRef value = NULL ;
Size actualSize = 0 ;
- verify_noerr( GetControlData( (ControlRef) m_macControl , 0, GetWindowStyle() & wxTE_PASSWORD ?
+ verify_noerr( GetControlData( *m_peer , 0, GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag,
sizeof(CFStringRef), &value, &actualSize ) );
if ( value )
#else
ControlEditTextSelectionRec sel ;
Size actualSize ;
- verify_noerr( GetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag,
+ verify_noerr( GetControlData( *m_peer , 0, kControlEditTextSelectionTag,
sizeof(ControlEditTextSelectionRec), &sel, &actualSize ) );
if ( from ) *from = sel.selStart ;
if ( to ) *to = sel.selEnd ;
#else
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ;
- verify_noerr( SetControlData( (ControlRef) m_macControl , 0, GetWindowStyle() & wxTE_PASSWORD ?
+ verify_noerr( SetControlData( *m_peer , 0, GetWindowStyle() & wxTE_PASSWORD ?
kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag,
sizeof(CFStringRef), &value ) );
#endif
ClearCurrentScrap();
TXNCopy((TXNObject)m_macTXN);
TXNConvertToPublicScrap();
+#else
+ m_peer->SendHICommand( kHICommandCopy ) ;
#endif
}
}
ClearCurrentScrap();
TXNCut((TXNObject)m_macTXN);
TXNConvertToPublicScrap();
+#else
+ m_peer->SendHICommand( kHICommandCut ) ;
#endif
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ;
TXNConvertFromPublicScrap();
TXNPaste((TXNObject)m_macTXN);
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
+#else
+ m_peer->SendHICommand( kHICommandPaste ) ;
#endif
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetString( GetValue() ) ;
TXNSetTXNObjectControls( (TXNObject) m_macTXN , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ;
#else
Boolean value = !editable ;
- ::SetControlData( (ControlHandle) m_macControl, 0, kControlEditTextLockedTag , sizeof( value ) , &value ) ;
+ ::SetControlData( *m_peer, 0, kControlEditTextLockedTag , sizeof( value ) , &value ) ;
#endif
}
}
ControlEditTextSelectionRec sel ;
sel.selStart = from ;
sel.selEnd = to ;
- verify_noerr( SetControlData( (ControlRef) m_macControl , 0, kControlEditTextSelectionTag,
+ verify_noerr( SetControlData( *m_peer , 0, kControlEditTextSelectionTag,
sizeof(ControlEditTextSelectionRec), &sel ) );
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ;
- SetControlData( (ControlRef) m_macControl , 0, kControlEditTextInsertCFStringRefTag,
+ SetControlData( *m_peer , 0, kControlEditTextInsertCFStringRefTag,
sizeof(CFStringRef), &value );
#else
wxString val = GetValue() ;
ItemCount lines = 0 ;
#if wxMAC_USE_MLTE
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
return lines ;
}
++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
return 0;
}
wxString wxTextCtrl::GetLineText(long lineNo) const
{
- wxString line ;
#if wxMAC_USE_MLTE
+ wxString line ;
Point curpt ;
wxString content = GetValue() ;
}
}
}
-#endif
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
}
/*
keychar = short(ev->message & charCodeMask);
keycode = short(ev->message & keyCodeMask) >> 8 ;
- ::HandleControlKey( (ControlRef) m_macControl , keycode , keychar , ev->modifiers ) ;
+ ::HandleControlKey( *m_peer , keycode , keychar , ev->modifiers ) ;
}
}
}
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl() ;
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) ;
void wxToggleButton::SetValue(bool val)
{
- ::SetControl32BitValue( (ControlRef) m_macControl , val ) ;
+ ::SetControl32BitValue( *m_peer , val ) ;
}
bool wxToggleButton::GetValue() const
{
- return GetControl32BitValue( (ControlRef) m_macControl ) ;
+ return GetControl32BitValue( *m_peer ) ;
}
void wxToggleButton::Command(wxCommandEvent & event)
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
+ m_peer = new wxMacControl() ;
#if TARGET_API_MAC_OSX
// 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
HIViewFindByID( HIViewGetRoot( (WindowRef) m_macWindow ) , kHIViewWindowContentID ,
- (ControlRef*)&m_macControl ) ;
+ *m_peer ) ;
#else
- ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ;
+ ::CreateRootControl( (WindowRef)m_macWindow , *m_peer ) ;
#endif
// the root control level handleer
MacInstallEventHandler() ;
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 ::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
// ----------------------------------------------------------------------------
void wxWindowMac::Init()
{
+ m_peer = NULL ;
m_frozenness = 0 ;
#if WXWIN_COMPATIBILITY_2_4
m_backgroundTransparent = FALSE;
m_vScrollBar = NULL ;
m_macBackgroundBrush = wxNullBrush ;
- m_macControl = NULL ;
-
m_macIsUserPane = TRUE;
// make sure all proc ptrs are available
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL);
}
- if ( (ControlRef) m_macControl )
+ if ( m_peer && m_peer->Ok() )
{
// in case the callback might be called during destruction
wxRemoveMacControlAssociation( this) ;
- ::SetControlColorProc( (ControlRef) m_macControl , NULL ) ;
- ::DisposeControl( (ControlRef) m_macControl ) ;
- m_macControl = NULL ;
+ ::SetControlColorProc( *m_peer , NULL ) ;
+ ::DisposeControl( *m_peer ) ;
}
if ( g_MacLastWindow == this )
m_dropTarget = NULL;
}
#endif // wxUSE_DRAG_AND_DROP
+ delete m_peer ;
+}
+
+WXWidget wxWindowMac::GetHandle() const
+{
+ return (WXWidget) (ControlRef) *m_peer ;
}
-//
void wxWindowMac::MacInstallEventHandler()
{
- wxAssociateControlWithMacControl( (ControlRef) m_macControl , this ) ;
- InstallControlEventHandler( (ControlRef) m_macControl, GetwxMacWindowEventHandlerUPP(),
+ wxAssociateControlWithMacControl( *m_peer , this ) ;
+ InstallControlEventHandler( *m_peer, GetwxMacWindowEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
(EventHandlerRef *)&m_macControlEventHandler);
// | 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) ;
#if !TARGET_API_MAC_OSX
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneDrawProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneDrawProcTag,
sizeof(gControlUserPaneDrawUPP),(Ptr) &gControlUserPaneDrawUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneHitTestProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneHitTestProcTag,
sizeof(gControlUserPaneHitTestUPP),(Ptr) &gControlUserPaneHitTestUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneTrackingProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneTrackingProcTag,
sizeof(gControlUserPaneTrackingUPP),(Ptr) &gControlUserPaneTrackingUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneIdleProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneIdleProcTag,
sizeof(gControlUserPaneIdleUPP),(Ptr) &gControlUserPaneIdleUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneKeyDownProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneKeyDownProcTag,
sizeof(gControlUserPaneKeyDownUPP),(Ptr) &gControlUserPaneKeyDownUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneActivateProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneActivateProcTag,
sizeof(gControlUserPaneActivateUPP),(Ptr) &gControlUserPaneActivateUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneFocusProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneFocusProcTag,
sizeof(gControlUserPaneFocusUPP),(Ptr) &gControlUserPaneFocusUPP);
- SetControlData((ControlRef) m_macControl,kControlEntireControl,kControlUserPaneBackgroundProcTag,
+ SetControlData(*m_peer,kControlEntireControl,kControlUserPaneBackgroundProcTag,
sizeof(gControlUserPaneBackgroundUPP),(Ptr) &gControlUserPaneBackgroundUPP);
#endif
}
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();
ControlRef container = (ControlRef) GetParent()->GetHandle() ;
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
- ::EmbedControl( (ControlRef) m_macControl , container ) ;
+ ::EmbedControl( *m_peer , container ) ;
// adjust font, controlsize etc
DoSetWindowVariant( m_windowVariant ) ;
#if !TARGET_API_MAC_OSX
// eventually we can fix some clipping issues be reactivating this hook
//if ( m_macIsUserPane )
- // SetControlColorProc( (ControlRef) m_macControl , wxMacSetupControlBackgroundUPP ) ;
+ // SetControlColorProc( *m_peer , wxMacSetupControlBackgroundUPP ) ;
#endif
- UMASetControlTitle( (ControlRef) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
+ UMASetControlTitle( *m_peer , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
if (!m_macIsUserPane)
{
{
// Don't assert, in case we set the window variant before
// the window is created
- // wxASSERT( m_macControl != NULL ) ;
+ // wxASSERT( m_peer->Ok() ) ;
m_windowVariant = variant ;
- if (!m_macControl)
+ if (m_peer == NULL || !m_peer->Ok())
return;
ControlSize size ;
wxFAIL_MSG(_T("unexpected window variant"));
break ;
}
- ::SetControlData( (ControlRef) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
+ ::SetControlData( *m_peer , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
wxFont font ;
font.MacCreateThemeFont( themeFont ) ;
fontStyle.foreColor = MAC_WXCOLORREF(GetForegroundColour().GetPixel() ) ;
fontStyle.flags |= kControlUseForeColorMask ;
- ::SetControlFontStyle( (ControlRef) m_macControl , &fontStyle );
+ ::SetControlFontStyle( *m_peer , &fontStyle );
Refresh() ;
}
// to issue a SetKeyboardFocus event and verify after whether it succeeded, this would risk problems
// in event handlers...
UInt32 features = 0 ;
- GetControlFeatures( (ControlRef) m_macControl , &features ) ;
+ GetControlFeatures( *m_peer , &features ) ;
return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ;
}
int& w, int& h) const
{
Rect bounds ;
- GetControlBounds( (ControlRef) m_macControl , &bounds ) ;
+ GetControlBounds( *m_peer , &bounds ) ;
x = bounds.left ;
#else
Rect bounds ;
- GetControlBounds( (ControlRef) m_macControl , &bounds ) ;
+ GetControlBounds( *m_peer , &bounds ) ;
if(x) *x = bounds.right - bounds.left ;
if(y) *y = bounds.bottom - bounds.top ;
#endif
if(y) *y = y1 ;
#else
Rect bounds ;
- GetControlBounds( (ControlRef) m_macControl , &bounds ) ;
+ GetControlBounds( *m_peer , &bounds ) ;
wxCHECK_RET( GetParent() , wxT("Missing Parent") ) ;
int xx = bounds.left ;
if ( y ) pt.y = *y ;
if ( !IsTopLevel() )
- HIViewConvertPoint( &pt , (ControlRef) m_macControl , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ;
+ HIViewConvertPoint( &pt , *m_peer , (ControlRef) MacGetTopLevelWindow()->GetHandle() ) ;
if ( x ) *x = (int) pt.x ;
if ( y ) *y = (int) pt.y ;
if ( !IsTopLevel() )
{
Rect bounds ;
- GetControlBounds( (ControlRef) m_macControl , &bounds ) ;
+ GetControlBounds( *m_peer , &bounds ) ;
if(x) *x += bounds.left ;
if(y) *y += bounds.top ;
}
if ( y ) pt.y = *y ;
if ( !IsTopLevel() )
- HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle() , (ControlRef) m_macControl ) ;
+ HIViewConvertPoint( &pt , (ControlRef) MacGetTopLevelWindow()->GetHandle() , *m_peer ) ;
if ( x ) *x = (int) pt.x ;
if ( y ) *y = (int) pt.y ;
if ( !IsTopLevel() )
{
Rect bounds ;
- GetControlBounds( (ControlRef) m_macControl , &bounds ) ;
+ GetControlBounds( *m_peer , &bounds ) ;
if(x) *x -= bounds.left ;
if(y) *y -= bounds.top ;
}
{
RgnHandle rgn = NewRgn() ;
Rect content ;
- if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr )
+ if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{
GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ;
}
else
{
- GetControlBounds( (ControlRef) m_macControl , &content ) ;
+ GetControlBounds( *m_peer , &content ) ;
}
Rect structure ;
- GetControlBounds( (ControlRef) m_macControl , &structure ) ;
+ GetControlBounds( *m_peer , &structure ) ;
#if !TARGET_API_MAC_OSX
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
Rect content ;
- if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr )
+ if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{
GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ;
}
else
{
- GetControlBounds( (ControlRef) m_macControl , &content ) ;
+ GetControlBounds( *m_peer , &content ) ;
}
Rect structure ;
- GetControlBounds( (ControlRef) m_macControl , &structure ) ;
+ GetControlBounds( *m_peer , &structure ) ;
#if !TARGET_API_MAC_OSX
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
RgnHandle rgn = NewRgn() ;
Rect content ;
- if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr )
+ if ( GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) == noErr )
{
GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ;
}
else
{
- GetControlBounds( (ControlRef) m_macControl , &content ) ;
+ GetControlBounds( *m_peer , &content ) ;
}
#if !TARGET_API_MAC_OSX
Rect structure ;
- GetControlBounds( (ControlRef) m_macControl , &structure ) ;
+ GetControlBounds( *m_peer , &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
ww = content.right - content.left ;
{
// we don't adjust twice for the origin
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
// the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
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 } ;
- HIViewSetFrame ( (ControlRef) m_macControl , &hir ) ;
+ HIViewSetFrame ( *m_peer , &hir ) ;
if ( vis )
- SetControlVisibility( (ControlRef)m_macControl , true , true ) ;
+ SetControlVisibility( *m_peer , true , true ) ;
#else
if ( vis )
- SetControlVisibility( (ControlRef)m_macControl , false , true ) ;
- SetControlBounds( (ControlRef) m_macControl , &r ) ;
+ SetControlVisibility( *m_peer , false , true ) ;
+ SetControlBounds( *m_peer , &r ) ;
if ( vis )
- SetControlVisibility( (ControlRef)m_macControl , true , true ) ;
+ SetControlVisibility( *m_peer , true , true ) ;
#endif
MacRepositionScrollBars() ;
if ( doMove )
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
int bestWidth, bestHeight ;
- ::GetBestControlRect( (ControlRef) m_macControl , &bestsize , &baselineoffset ) ;
+ ::GetBestControlRect( *m_peer , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) )
{
{
RgnHandle rgn = NewRgn() ;
Rect content ;
- GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) ;
+ GetControlRegion( *m_peer , kControlContentMetaPart , rgn ) ;
GetRegionBounds( rgn , &content ) ;
DisposeRgn( rgn ) ;
#if !TARGET_API_MAC_OSX
if (!::EmptyRect( &content ) )
{
Rect structure ;
- GetControlBounds( (ControlRef) m_macControl , &structure ) ;
+ GetControlBounds( *m_peer , &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
}
#endif
{
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() ;
}
// TODO use visibilityChanged Carbon Event for OSX
bool former = MacIsReallyShown() ;
- SetControlVisibility( (ControlRef) m_macControl , show , true ) ;
+ SetControlVisibility( *m_peer , show , true ) ;
if ( former != MacIsReallyShown() )
MacPropagateVisibilityChanged() ;
return TRUE;
bool wxWindowMac::Enable(bool enable)
{
- wxASSERT( m_macControl != NULL ) ;
+ wxASSERT( m_peer->Ok() ) ;
if ( !wxWindowBase::Enable(enable) )
return FALSE;
bool former = MacIsReallyEnabled() ;
#if TARGET_API_MAC_OSX
if ( enable )
- EnableControl( (ControlRef) m_macControl ) ;
+ EnableControl( *m_peer ) ;
else
- DisableControl( (ControlRef) m_macControl ) ;
+ DisableControl( *m_peer ) ;
#else
if ( enable )
- ActivateControl( (ControlRef) m_macControl ) ;
+ ActivateControl( *m_peer ) ;
else
- DeactivateControl( (ControlRef) m_macControl ) ;
+ DeactivateControl( *m_peer ) ;
#endif
if ( former != MacIsReallyEnabled() )
{
// only under OSX the visibility of the TLW is taken into account
#if TARGET_API_MAC_OSX
- return IsControlVisible( (ControlRef) m_macControl ) ;
+ return IsControlVisible( *m_peer ) ;
#else
wxWindow* win = this ;
while( win->IsShown() )
bool wxWindowMac::MacIsReallyEnabled()
{
#if TARGET_API_MAC_OSX
- return IsControlEnabled( (ControlRef) m_macControl ) ;
+ return IsControlEnabled( *m_peer ) ;
#else
- return IsControlActive( (ControlRef) m_macControl ) ;
+ return IsControlActive( *m_peer ) ;
#endif
}
bool wxWindowMac::MacIsReallyHilited()
{
- return IsControlActive( (ControlRef) m_macControl ) ;
+ return IsControlActive( *m_peer ) ;
}
void wxWindowMac::MacFlashInvalidAreas()
{
#if TARGET_API_MAC_OSX
if ( rect == NULL )
- HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+ HIViewSetNeedsDisplay( *m_peer , true ) ;
else
{
RgnHandle update = NewRgn() ;
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
wxPoint origin = GetClientAreaOrigin() ;
OffsetRgn( update, origin.x , origin.y ) ;
- HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , update , true ) ;
+ HIViewSetNeedsDisplayInRegion( *m_peer , update , true ) ;
}
#else
/*
InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , updateRgn ) ;
DisposeRgn(updateRgn) ;
*/
- if ( IsControlVisible( (ControlRef) m_macControl ) )
+ if ( IsControlVisible( *m_peer ) )
{
- SetControlVisibility( (ControlRef) m_macControl , false , false ) ;
- SetControlVisibility( (ControlRef) m_macControl , true , true ) ;
+ SetControlVisibility( *m_peer , false , false ) ;
+ SetControlVisibility( *m_peer , true , true ) ;
}
/*
if ( MacGetTopLevelWindow() == NULL )
return ;
- if ( !IsControlVisible( (ControlRef) m_macControl ) )
+ if ( !IsControlVisible( *m_peer ) )
return ;
wxPoint client = GetClientAreaOrigin();
#if TARGET_API_MAC_OSX
if ( !m_frozenness++ )
{
- HIViewSetDrawingEnabled( (HIViewRef) m_macControl , false ) ;
+ HIViewSetDrawingEnabled( *m_peer , false ) ;
}
#endif
}
if ( !--m_frozenness )
{
- HIViewSetDrawingEnabled( (HIViewRef) m_macControl , true ) ;
- InvalidateControlAndChildren( (HIViewRef) m_macControl ) ;
- // HIViewSetNeedsDisplay( (HIViewRef) m_macControl , true ) ;
+ HIViewSetDrawingEnabled( *m_peer , true ) ;
+ InvalidateControlAndChildren( *m_peer ) ;
+ // HIViewSetNeedsDisplay( *m_peer , true ) ;
}
#endif
}
void wxWindowMac::MacRedrawControl()
{
/*
- if ( (ControlRef) m_macControl && MacGetTopLevelWindowRef() && IsControlVisible( (ControlRef) m_macControl ) )
+ if ( *m_peer && MacGetTopLevelWindowRef() && IsControlVisible( *m_peer ) )
{
#if TARGET_API_MAC_CARBON
Update() ;
wxMacPortSetter helper(&dc) ;
wxMacWindowClipper clipper(this) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
- UMADrawControl( (ControlRef) m_macControl ) ;
+ UMADrawControl( *m_peer ) ;
#endif
}
*/
HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ;
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
// either immediate redraw or full invalidate
#if 1
// is the better overall solution, as it does not slow down scrolling
- HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+ HIViewSetNeedsDisplay( *m_peer , true ) ;
#else
// this would be the preferred version for fast drawing controls
if( UMAGetSystemVersion() < 0x1030 )
Update() ;
else
- HIViewRender((ControlRef) m_macControl) ;
+ HIViewRender(*m_peer) ;
#endif
}
- HIViewScrollRect ( (ControlRef) m_macControl , &scrollrect , dx ,dy ) ;
+ HIViewScrollRect ( *m_peer , &scrollrect , dx ,dy ) ;
#else
wxPoint pos;
wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ;
- GetControlBounds( (ControlRef) m_macControl, &scrollrect);
+ GetControlBounds( *m_peer, &scrollrect);
scrollrect.top += MacGetTopBorderSize() ;
scrollrect.left += MacGetLeftBorderSize() ;
scrollrect.bottom = scrollrect.top + height ;
void wxWindowMac::Raise()
{
#if TARGET_API_MAC_OSX
- HIViewSetZOrder((ControlRef)m_macControl,kHIViewZOrderAbove, NULL) ;
+ HIViewSetZOrder(*m_peer,kHIViewZOrderAbove, NULL) ;
#endif
}
void wxWindowMac::Lower()
{
#if TARGET_API_MAC_OSX
- HIViewSetZOrder((ControlRef)m_macControl,kHIViewZOrderBelow, NULL) ;
+ HIViewSetZOrder(*m_peer,kHIViewZOrderBelow, NULL) ;
#endif
}
status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
}
else
- HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+ HIViewSetNeedsDisplay( *m_peer , true ) ;
}
#else
- ::Draw1Control( (ControlRef) m_macControl ) ;
+ ::Draw1Control( *m_peer ) ;
#endif
}
Rect r ;
RgnHandle visRgn = 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() )
{
MacRootWindowToWindow( &r.left , & r.top ) ;
if ( MacGetTopLevelWindow()->MacUsesCompositing() == false )
{
Rect bounds;
- UMAGetControlBoundsInWindowCoords( (ControlRef)m_macControl, &bounds );
+ UMAGetControlBoundsInWindowCoords( *m_peer, &bounds );
RgnHandle controlRgn = NewRgn();
RectRgn( controlRgn, &bounds );
//KO: This sets the ownUpdateRgn to the area of this control that is inside