コード例 #1
0
ファイル: statusbr.cpp プロジェクト: 252525fb/rpcs3
void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[])
{
    // only set status widths, when n == number of statuswindows
    wxCHECK_RET( n == m_nFields, _T("status bar field count mismatch") );

    // delete the old widths in any case - this function may be used to reset
    // the widths to the default (all equal)
    // MBN: this is incompatible with at least wxMSW and wxMAC and not
    //      documented, but let's keep it for now
    ReinitWidths();

    // forget the old cached pixel widths
    m_widthsAbs.Empty();

    if ( !widths_field )
    {
        // not an error, see the comment above
        Refresh();
        return;
    }

    wxStatusBarBase::SetStatusWidths(n, widths_field);
}
コード例 #2
0
ファイル: statbar.cpp プロジェクト: Blackbird88/pcsx2
void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
{
    wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") );

    bool refresh = false;

    if ( number != m_nFields )
    {
        // copy stacks if present
        if(m_statusTextStacks)
        {
            wxListString **newStacks = new wxListString*[number];
            size_t i, j, max = wxMin(number, m_nFields);

            // copy old stacks
            for(i = 0; i < max; ++i)
                newStacks[i] = m_statusTextStacks[i];
            // free old stacks in excess
            for(j = i; j < (size_t)m_nFields; ++j)
            {
                if(m_statusTextStacks[j])
                {
                    m_statusTextStacks[j]->Clear();
                    delete m_statusTextStacks[j];
                }
            }
            // initialize new stacks to NULL
            for(j = i; j < (size_t)number; ++j)
                newStacks[j] = 0;

            m_statusTextStacks = newStacks;
        }

        // Resize styles array
        if (m_statusStyles)
        {
            int *oldStyles = m_statusStyles;
            m_statusStyles = new int[number];
            int i, max = wxMin(number, m_nFields);

            // copy old styles
            for (i = 0; i < max; ++i)
                m_statusStyles[i] = oldStyles[i];

            // initialize new styles to wxSB_NORMAL
            for (i = max; i < number; ++i)
                m_statusStyles[i] = wxSB_NORMAL;

            // free old styles
            delete [] oldStyles;
        }


        m_nFields = number;

        ReinitWidths();

        refresh = true;
    }
    //else: keep the old m_statusWidths if we had them

    if ( widths )
    {
        SetStatusWidths(number, widths);

        // already done from SetStatusWidths()
        refresh = false;
    }

    if ( refresh )
        Refresh();
}