- Rect bounds ;
- Str255 title ;
-
- MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
- int tabstyle = kControlTabSmallNorthProc ;
- if ( HasFlag(wxNB_LEFT) )
- tabstyle = kControlTabSmallWestProc ;
- else if ( HasFlag( wxNB_RIGHT ) )
- tabstyle = kControlTabSmallEastProc ;
- else if ( HasFlag( wxNB_BOTTOM ) )
- tabstyle = kControlTabSmallSouthProc ;
-
-
- m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
- tabstyle , (long) this ) ;
-
- MacPostControlCreate() ;
- return TRUE ;
+ m_macIsUserPane = false ;
+
+ if ( !wxNotebookBase::Create( parent, id, pos, size, style, name ) )
+ return false;
+
+ Rect bounds = wxMacGetBoundsForControl( this, pos, size );
+
+ if ( bounds.right <= bounds.left )
+ bounds.right = bounds.left + 100;
+ if ( bounds.bottom <= bounds.top )
+ bounds.bottom = bounds.top + 100;
+
+ UInt16 tabstyle = kControlTabDirectionNorth;
+ if ( HasFlag(wxBK_LEFT) )
+ tabstyle = kControlTabDirectionWest;
+ else if ( HasFlag( wxBK_RIGHT ) )
+ tabstyle = kControlTabDirectionEast;
+ else if ( HasFlag( wxBK_BOTTOM ) )
+ tabstyle = kControlTabDirectionSouth;
+
+ ControlTabSize tabsize;
+ switch (GetWindowVariant())
+ {
+ case wxWINDOW_VARIANT_MINI:
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ tabsize = 3 ;
+ else
+ tabsize = kControlSizeSmall;
+ break;
+
+ case wxWINDOW_VARIANT_SMALL:
+ tabsize = kControlTabSizeSmall;
+ break;
+
+ default:
+ tabsize = kControlTabSizeLarge;
+ break;
+ }
+
+ m_peer = new wxMacControl( this );
+ OSStatus err = CreateTabsControl(
+ MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
+ tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
+ verify_noerr( err );
+
+ MacPostControlCreate( pos, size );
+
+ return true ;