adding a peer pointing back to wxWindow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -411,19 +411,23 @@ Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxS
 | 
			
		||||
class wxMacControl
 | 
			
		||||
{
 | 
			
		||||
public :
 | 
			
		||||
    wxMacControl()
 | 
			
		||||
    wxMacControl(wxWindow* peer)
 | 
			
		||||
    {
 | 
			
		||||
        m_peer = peer ;
 | 
			
		||||
        m_controlRef = NULL ;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    wxMacControl( ControlRef control ) 
 | 
			
		||||
    wxMacControl( wxWindow* peer , ControlRef control ) 
 | 
			
		||||
    {
 | 
			
		||||
        m_peer = peer ;
 | 
			
		||||
        m_controlRef = control ;
 | 
			
		||||
    }
 | 
			
		||||
    wxMacControl( WXWidget control )
 | 
			
		||||
    wxMacControl( wxWindow* peer , WXWidget control )
 | 
			
		||||
    {
 | 
			
		||||
        m_peer = peer ;
 | 
			
		||||
        m_controlRef = (ControlRef) control ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual ~wxMacControl()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
@@ -513,9 +517,10 @@ public :
 | 
			
		||||
    // invalidates this control and all children
 | 
			
		||||
    virtual void InvalidateWithChildren() ;
 | 
			
		||||
    virtual void SetDrawingEnabled( bool enable ) ;
 | 
			
		||||
#ifdef __WXMAC_OSX__
 | 
			
		||||
    virtual bool GetNeedsDisplay() const ;
 | 
			
		||||
    virtual void SetNeedsDisplay( bool needsDisplay , RgnHandle where = NULL ) ;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
    virtual void ScrollRect( const wxRect &rect , int dx , int dy ) ;
 | 
			
		||||
 | 
			
		||||
    virtual void GetRect( Rect *r ) ;
 | 
			
		||||
@@ -565,6 +570,7 @@ protected :
 | 
			
		||||
    ControlRef  m_controlRef ;
 | 
			
		||||
    wxFont      m_font ;
 | 
			
		||||
    long        m_windowStyle ; 
 | 
			
		||||
    wxWindow*   m_peer ;
 | 
			
		||||
} ;
 | 
			
		||||
 | 
			
		||||
#if wxMAC_USE_CORE_GRAPHICS
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 | 
			
		||||
    wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl( this ) ;
 | 
			
		||||
    verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , 
 | 
			
		||||
        (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel )  , 
 | 
			
		||||
        kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl,
 | 
			
		||||
    m_label = label ;
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    if ( id == wxID_HELP )
 | 
			
		||||
    {
 | 
			
		||||
        ControlButtonContentInfo info ;
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 | 
			
		||||
        maxValue = 2 /* kControlCheckboxMixedValue */;
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
 | 
			
		||||
        CFSTR("") , 0 , false , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -224,7 +224,7 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
 | 
			
		||||
        -12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -383,7 +383,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
    //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);
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -106,6 +106,9 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
 | 
			
		||||
    GetClip( m_formerClip ) ;
 | 
			
		||||
 | 
			
		||||
    if ( win )
 | 
			
		||||
    {
 | 
			
		||||
        // guard against half constructed objects, this just leads to a empty clip
 | 
			
		||||
        if( win->GetPeer() )
 | 
			
		||||
        {
 | 
			
		||||
            int x = 0 , y = 0;
 | 
			
		||||
            win->MacWindowToRootWindow( &x,&y ) ;
 | 
			
		||||
@@ -113,7 +116,7 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
 | 
			
		||||
            CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ) ;
 | 
			
		||||
            if ( !EmptyRgn( m_newClip ) )
 | 
			
		||||
                OffsetRgn( m_newClip , x , y ) ;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        SetClip( m_newClip ) ;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
    }
 | 
			
		||||
    */
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 
 | 
			
		||||
     GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -182,7 +182,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 | 
			
		||||
    DataBrowserSelectionFlags  options = kDataBrowserDragSelect ;
 | 
			
		||||
 
 | 
			
		||||
@@ -129,7 +129,7 @@ bool wxNotebook::Create(wxWindow *parent,
 | 
			
		||||
            tabsize = kControlSizeSmall; 
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
 | 
			
		||||
     tabsize , tabstyle, 0, NULL,  m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , 
 | 
			
		||||
        0 , false /* no autotoggle */ , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 
 | 
			
		||||
    0 , 0 , 100 , 1 , true /* liveTracking */ , wxMacLiveScrollbarActionUPP , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
    while (tickMarks > 20)
 | 
			
		||||
        tickMarks /= 5; //keep the number of tickmarks from becoming unwieldly
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
 | 
			
		||||
        value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
 | 
			
		||||
        wxMacLiveScrollbarActionUPP , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 ,
 | 
			
		||||
     m_peer->GetControlRefAddr() ) );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , 
 | 
			
		||||
        true /*primary*/ , m_peer->GetControlRefAddr() ) ) ;  
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ bool wxStaticLine::Create( wxWindow *parent,
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, m_peer->GetControlRefAddr() ) ) ;  
 | 
			
		||||
 | 
			
		||||
    MacPostControlCreate(pos,size) ;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ;
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str , 
 | 
			
		||||
        NULL , m_peer->GetControlRefAddr() ) ) ;  
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 | 
			
		||||
            tabsize = kControlSizeSmall; 
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
 | 
			
		||||
     tabsize , tabstyle, 0, NULL,  m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
 | 
			
		||||
    
 | 
			
		||||
    m_peer = new wxMacControl() ;
 | 
			
		||||
    m_peer = new wxMacControl(this) ;
 | 
			
		||||
    verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , 
 | 
			
		||||
        kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user