- Rect bounds ;
- Str255 title ;
-
- MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
- m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
- kControlTabSmallProc , (long) this ) ;
-
- MacPostControlCreate() ;
- return TRUE ;
+ m_macIsUserPane = false ;
+
+ if (! (style & wxBK_ALIGN_MASK))
+ style |= wxBK_TOP;
+
+ 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:
+ tabsize = 3 ;
+ 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 ;