bool wxToolBar::DoInsertTool( size_t WXUNUSED(nPos),
                              wxToolBarToolBase* pToolBase )
{
    wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;

    pTool->m_vX = m_vXPos;
    if (pTool->m_vX == -1)
        pTool->m_vX = m_xMargin;

    pTool->m_vY = m_vYPos;
    if (pTool->m_vY == -1)
        pTool->m_vX = m_yMargin;

    pTool->SetSize(GetToolSize());

    if (pTool->IsButton())
    {
        //
        // Calculate reasonable max size in case Layout() not called
        //
        if ((pTool->m_vX + pTool->GetNormalBitmap().GetWidth() + m_xMargin) > m_vMaxWidth)
            m_vMaxWidth = (wxCoord)((pTool->m_vX + pTool->GetWidth() + m_xMargin));

        if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
            m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
    }
    return true;
} // end of wxToolBar::DoInsertTool
Exemple #2
0
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
{
    wxToolBarTool *tool = (wxToolBarTool *)t;
    if ( tool->IsButton() )
    {
        tool->UpdateToggleImage( toggle ) ;
    }
}

bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
                             wxToolBarToolBase *toolBase)
{
    wxToolBarTool* tool = wx_static_cast( wxToolBarTool* , toolBase ) ;
    
    WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;    
    wxSize toolSize = GetToolSize() ;    
    Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
    ControlRef controlHandle = NULL ;

    switch( tool->GetStyle() )
    {
        case wxTOOL_STYLE_SEPARATOR :
            {
                wxASSERT( tool->GetControlHandle() == NULL ) ;
                toolSize.x /= 4 ;
                toolSize.y /= 4 ;
                if ( GetWindowStyleFlag() & wxTB_VERTICAL )
                {
                    toolrect.bottom = toolSize.y ;
                }
                else