- if (m_tools.Number() == 0)
- return FALSE;
-
- Rect toolbarrect = { m_y , m_x , m_y + m_height , m_x + m_width } ;
- ControlFontStyleRec controlstyle ;
- WindowPtr window = GetMacRootWindow() ;
- controlstyle.flags = kControlUseFontMask ;
- controlstyle.font = kControlFontSmallSystemFont ;
-
- wxNode *node = m_tools.First();
- int noButtons = 0;
- int x = 0 ;
-
- while (node)
- {
- wxToolBarTool *tool = (wxToolBarTool *)node->Data();
- wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->m_bitmap1.GetRefData()) ;
-
- if( tool->m_toolStyle != wxTOOL_STYLE_SEPARATOR )
- {
- Rect toolrect = { toolbarrect.top + kwxMacToolBarTopMargin , toolbarrect.left + x + kwxMacToolBarLeftMargin , 0 , 0 } ;
- toolrect.right = toolrect.left + m_defaultWidth ;
- toolrect.bottom = toolrect.top + m_defaultHeight ;
-
- PicHandle icon = NULL ;
- if ( bmap )
- {
- if ( bmap->m_bitmapType == kMacBitmapTypePict )
- icon = bmap->m_hPict ;
- else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
- {
- icon = MakePict( bmap->m_hBitmap ) ;
- }
- }
-
- ControlHandle m_macToolHandle ;
-
- if ( icon )
- {
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
- kControlBehaviorOffsetContents + kControlContentPictHandle , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
- ControlButtonContentInfo info ;
-
- info.contentType = kControlContentPictHandle ;
- info.u.picture = icon ;
-
- UMASetControlData( m_macToolHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
- }
- else
- {
- m_macToolHandle = UMANewControl( window , &toolrect , "\p" , true , 0 ,
- kControlBehaviorOffsetContents , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
- }
- m_macToolHandles.Add( m_macToolHandle ) ;
- UMASetControlFontStyle( m_macToolHandle , &controlstyle ) ;
- UMAEmbedControl( m_macToolHandle , m_macControl ) ;
-
- x += (int)m_defaultWidth;
- noButtons ++;
- }
- else
- {
- m_macToolHandles.Add( NULL ) ;
- x += (int)m_defaultWidth / 4;
- }
- node = node->Next();
- }
-
- return TRUE;