moving embedding to common API
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -299,8 +299,6 @@ public :
|
|||||||
|
|
||||||
virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; }
|
virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; }
|
||||||
|
|
||||||
virtual void SetReference( URefCon data );
|
|
||||||
|
|
||||||
virtual bool IsVisible() const;
|
virtual bool IsVisible() const;
|
||||||
|
|
||||||
virtual void Raise();
|
virtual void Raise();
|
||||||
|
@@ -160,6 +160,7 @@ public :
|
|||||||
|
|
||||||
void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
|
void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
|
||||||
|
|
||||||
|
void InstallEventHandler( WXWidget control = NULL );
|
||||||
protected:
|
protected:
|
||||||
WXWidget m_osxView;
|
WXWidget m_osxView;
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
|
||||||
|
@@ -235,6 +235,8 @@ public :
|
|||||||
// is the clicked event sent AFTER the state already changed, so no additional
|
// is the clicked event sent AFTER the state already changed, so no additional
|
||||||
// state changing logic is required from the outside
|
// state changing logic is required from the outside
|
||||||
virtual bool ButtonClickDidStateChange() = 0;
|
virtual bool ButtonClickDidStateChange() = 0;
|
||||||
|
|
||||||
|
virtual void InstallEventHandler( WXWidget control = NULL ) = 0;
|
||||||
|
|
||||||
// static methods for associating native controls and their implementations
|
// static methods for associating native controls and their implementations
|
||||||
|
|
||||||
|
@@ -1907,6 +1907,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
|
|||||||
MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
|
MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
|
||||||
&bounds, featureSet, &m_controlRef );
|
&bounds, featureSet, &m_controlRef );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
SetControlReference( m_controlRef , (URefCon) wxPeer );
|
||||||
|
|
||||||
DoCreate();
|
DoCreate();
|
||||||
|
|
||||||
|
@@ -841,22 +841,15 @@ void wxMacControl::Init()
|
|||||||
m_macControlEventHandler = NULL;
|
m_macControlEventHandler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetReference( URefCon data )
|
|
||||||
{
|
|
||||||
SetControlReference( m_controlRef , data );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacControl::RemoveFromParent()
|
void wxMacControl::RemoveFromParent()
|
||||||
{
|
{
|
||||||
// nothing to do here for carbon
|
// nothing to do here for carbon
|
||||||
|
HIViewRemoveFromSuperview(m_controlRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::Embed( wxWidgetImpl *parent )
|
void wxMacControl::Embed( wxWidgetImpl *parent )
|
||||||
{
|
{
|
||||||
// copied from MacPostControlCreate
|
HIViewAddSubview(parent->GetWXWidget(), m_controlRef);
|
||||||
ControlRef container = (ControlRef) parent->GetWXWidget() ;
|
|
||||||
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
|
||||||
::EmbedControl( m_controlRef , container ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacControl::SetNeedsDisplay( const wxRect* rect )
|
void wxMacControl::SetNeedsDisplay( const wxRect* rect )
|
||||||
@@ -1388,6 +1381,13 @@ void wxMacControl::SetScrollThumb( wxInt32 WXUNUSED(pos), wxInt32 WXUNUSED(views
|
|||||||
// implemented in respective subclass
|
// implemented in respective subclass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxMacControl::AddSubWidget( wxWidgetImpl* widget )
|
||||||
|
{
|
||||||
|
ControlRef container = (ControlRef) GetWXWidget() ;
|
||||||
|
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
||||||
|
::EmbedControl( (ControlRef) widget->GetWXWidget() , container ) ;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tab Control
|
// Tab Control
|
||||||
//
|
//
|
||||||
|
@@ -31,15 +31,12 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = static_cast<NSView*>(wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
[v setBezelStyle:NSRegularSquareBezelStyle];
|
[v setBezelStyle:NSRegularSquareBezelStyle];
|
||||||
[v setImage:bitmap.GetNSImage() ];
|
[v setImage:bitmap.GetNSImage() ];
|
||||||
[v setButtonType:NSMomentaryPushInButton];
|
[v setButtonType:NSMomentaryPushInButton];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -198,8 +198,6 @@ wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -213,7 +211,6 @@ wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
[v setButtonType:NSMomentaryPushInButton];
|
[v setButtonType:NSMomentaryPushInButton];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
@@ -287,15 +284,12 @@ wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
[v setBezelStyle:NSDisclosureBezelStyle];
|
[v setBezelStyle:NSDisclosureBezelStyle];
|
||||||
[v setButtonType:NSOnOffButton];
|
[v setButtonType:NSOnOffButton];
|
||||||
[v setTitle:wxCFStringRef( label).AsNSString()];
|
[v setTitle:wxCFStringRef( label).AsNSString()];
|
||||||
[v setImagePosition:NSImageRight];
|
[v setImagePosition:NSImageRight];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -25,8 +25,6 @@ wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -34,7 +32,6 @@ wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
|
|||||||
if (style & wxCHK_3STATE)
|
if (style & wxCHK_3STATE)
|
||||||
[v setAllowsMixedState:YES];
|
[v setAllowsMixedState:YES];
|
||||||
|
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -91,11 +91,8 @@ wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStylew)
|
long extraStylew)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
|
wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO];
|
||||||
[sv addSubview:v];
|
|
||||||
[v setMenu: menu->GetHMenu()];
|
[v setMenu: menu->GetHMenu()];
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
|
@@ -105,8 +105,6 @@ wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r];
|
wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -114,7 +112,6 @@ wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
|
|||||||
[v setMaxValue: maximum];
|
[v setMaxValue: maximum];
|
||||||
[v setIndeterminate:FALSE];
|
[v setIndeterminate:FALSE];
|
||||||
[v setDoubleValue: (double) value];
|
[v setDoubleValue: (double) value];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -291,11 +291,8 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NSView* sv = (parent->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
|
||||||
wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r];
|
wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
m_peer = new wxWidgetCocoaImpl( this, v );
|
m_peer = new wxWidgetCocoaImpl( this, v );
|
||||||
[v setImplementation:m_peer];
|
[v setImplementation:m_peer];
|
||||||
|
|
||||||
|
@@ -473,8 +473,6 @@ wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* superv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
NSScrollView* scrollview = [[NSScrollView alloc] initWithFrame:r];
|
NSScrollView* scrollview = [[NSScrollView alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -503,7 +501,6 @@ wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
|
|||||||
[tableview setColumnAutoresizingStyle:NSTableViewLastColumnOnlyAutoresizingStyle];
|
[tableview setColumnAutoresizingStyle:NSTableViewLastColumnOnlyAutoresizingStyle];
|
||||||
wxNSTableDataSource* ds = [[ wxNSTableDataSource alloc] init];
|
wxNSTableDataSource* ds = [[ wxNSTableDataSource alloc] init];
|
||||||
[tableview setDataSource:ds];
|
[tableview setDataSource:ds];
|
||||||
[superv addSubview:scrollview];
|
|
||||||
wxListWidgetCocoaImpl* c = new wxListWidgetCocoaImpl( wxpeer, scrollview, tableview, ds );
|
wxListWidgetCocoaImpl* c = new wxListWidgetCocoaImpl( wxpeer, scrollview, tableview, ds );
|
||||||
[tableview setImplementation:c];
|
[tableview setImplementation:c];
|
||||||
[ds setImplementation:c];
|
[ds setImplementation:c];
|
||||||
|
@@ -246,8 +246,6 @@ wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
|
|||||||
if ( !controller )
|
if ( !controller )
|
||||||
controller =[[wxTabViewController alloc] init];
|
controller =[[wxTabViewController alloc] init];
|
||||||
|
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
|
|
||||||
NSTabViewType tabstyle = NSTopTabsBezelBorder;
|
NSTabViewType tabstyle = NSTopTabsBezelBorder;
|
||||||
@@ -259,7 +257,6 @@ wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
|
|||||||
tabstyle = NSBottomTabsBezelBorder;
|
tabstyle = NSBottomTabsBezelBorder;
|
||||||
|
|
||||||
wxNSTabView* v = [[wxNSTabView alloc] initWithFrame:r];
|
wxNSTabView* v = [[wxNSTabView alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
[v setTabViewType:tabstyle];
|
[v setTabViewType:tabstyle];
|
||||||
wxWidgetCocoaImpl* c = new wxCocoaTabView( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxCocoaTabView( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
|
@@ -25,14 +25,11 @@ wxWidgetImplType* wxWidgetImpl::CreateRadioButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
[v setButtonType:NSRadioButton];
|
[v setButtonType:NSRadioButton];
|
||||||
|
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -111,12 +111,9 @@ wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSScroller* v = [[wxNSScroller alloc] initWithFrame:r];
|
wxNSScroller* v = [[wxNSScroller alloc] initWithFrame:r];
|
||||||
|
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxOSXScrollBarCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxOSXScrollBarCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -77,8 +77,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r];
|
wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -99,7 +97,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
|
|||||||
[v setMinValue: minimum];
|
[v setMinValue: minimum];
|
||||||
[v setMaxValue: maximum];
|
[v setMaxValue: maximum];
|
||||||
[v setFloatValue: (double) value];
|
[v setFloatValue: (double) value];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -77,8 +77,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSStepper* v = [[wxNSStepper alloc] initWithFrame:r];
|
wxNSStepper* v = [[wxNSStepper alloc] initWithFrame:r];
|
||||||
|
|
||||||
@@ -89,7 +87,6 @@ wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer,
|
|||||||
if ( style & wxSP_WRAP )
|
if ( style & wxSP_WRAP )
|
||||||
[v setValueWraps:YES];
|
[v setValueWraps:YES];
|
||||||
|
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -171,11 +171,8 @@ wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxTextCtrl* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSSearchField* v = [[wxNSSearchField alloc] initWithFrame:r];
|
wxNSSearchField* v = [[wxNSSearchField alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
[[v cell] setSendsWholeSearchString:YES];
|
[[v cell] setSendsWholeSearchString:YES];
|
||||||
// per wx default cancel is not shown
|
// per wx default cancel is not shown
|
||||||
[[v cell] setCancelButtonCell:nil];
|
[[v cell] setCancelButtonCell:nil];
|
||||||
|
@@ -44,11 +44,8 @@ wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -41,11 +41,8 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticLine( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -101,11 +101,8 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSTextField* v = [[wxNSTextField alloc] initWithFrame:r];
|
wxNSTextField* v = [[wxNSTextField alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
|
|
||||||
[v setBezeled:NO];
|
[v setBezeled:NO];
|
||||||
[v setEditable:NO];
|
[v setEditable:NO];
|
||||||
|
@@ -136,11 +136,8 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSTextField* v = [[wxNSTextField alloc] initWithFrame:r];
|
wxNSTextField* v = [[wxNSTextField alloc] initWithFrame:r];
|
||||||
[sv addSubview:v];
|
|
||||||
|
|
||||||
if ( style & wxNO_BORDER )
|
if ( style & wxNO_BORDER )
|
||||||
{
|
{
|
||||||
|
@@ -34,14 +34,11 @@ wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
[v setBezelStyle:NSRoundedBezelStyle];
|
[v setBezelStyle:NSRoundedBezelStyle];
|
||||||
[v setButtonType:NSOnOffButton];
|
[v setButtonType:NSOnOffButton];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
@@ -56,14 +53,11 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long extraStyle)
|
long extraStyle)
|
||||||
{
|
{
|
||||||
NSView* sv = (wxpeer->GetParent()->GetHandle() );
|
|
||||||
|
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
|
||||||
|
|
||||||
[v setBezelStyle:NSRegularSquareBezelStyle];
|
[v setBezelStyle:NSRegularSquareBezelStyle];
|
||||||
[v setButtonType:NSOnOffButton];
|
[v setButtonType:NSOnOffButton];
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
[v setImplementation:c];
|
||||||
return c;
|
return c;
|
||||||
|
@@ -718,6 +718,10 @@ void wxWidgetCocoaImpl::SetFont(wxFont const&, wxColour const&, long, bool)
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Factory methods
|
// Factory methods
|
||||||
//
|
//
|
||||||
|
@@ -274,19 +274,11 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSiz
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid mac control") ) ;
|
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid mac control") ) ;
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
m_peer->SetReference( (URefCon) this ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GetParent()->AddChild( this );
|
GetParent()->AddChild( this );
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
m_peer->InstallEventHandler();
|
m_peer->InstallEventHandler();
|
||||||
|
m_peer->Embed(GetParent()->GetPeer());
|
||||||
|
|
||||||
ControlRef container = (ControlRef) GetParent()->GetHandle() ;
|
|
||||||
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
|
||||||
::EmbedControl( m_peer->GetControlRef() , container ) ;
|
|
||||||
#endif
|
|
||||||
GetParent()->MacChildAdded() ;
|
GetParent()->MacChildAdded() ;
|
||||||
|
|
||||||
// adjust font, controlsize etc
|
// adjust font, controlsize etc
|
||||||
|
Reference in New Issue
Block a user