예제 #1
0
파일: SkinManager.cpp 프로젝트: Ocode/boinc
bool CSkinImage::Validate() {
    if (!m_bmpBitmap.Ok()) {
        if (!m_strDesiredBitmap.IsEmpty()) {
            wxImage img = wxImage(m_strDesiredBitmap, wxBITMAP_TYPE_ANY);
            if (img.IsOk()) {
#ifdef __WXMSW__
// TODO: Choose from multiple size images if provided, else resize the closest one
                if ((GetXDPIScaling() > 1.05) || (GetYDPIScaling() > 1.05)) {
                    img.Rescale((int) (img.GetWidth()*GetXDPIScaling()), 
                                (int) (img.GetHeight()*GetYDPIScaling()), 
                                wxIMAGE_QUALITY_BILINEAR
                            );
                }
#endif
                m_bmpBitmap = wxBitmap(img);
            }
        }
        if (!m_bmpBitmap.Ok()) {
            if (show_error_msgs) {
                fprintf(stderr, "Skin Manager: Failed to load '%s' image. Using default.\n", (const char *)m_strComponentName.mb_str());
            }
            m_bmpBitmap = GetScaledBitmapFromXPMData(m_ppDefaultBitmap);
            wxASSERT(m_bmpBitmap.Ok());
        }
    }
    if (!m_colBackgroundColor.Ok()) {
        if (!m_strDesiredBackgroundColor.IsEmpty()) {
            m_colBackgroundColor = ParseColor(m_strDesiredBackgroundColor);
        }
        if (!m_colBackgroundColor.Ok()) {
            if (show_error_msgs) {
                fprintf(stderr, "Skin Manager: Failed to load '%s' background color. Using default.\n", (const char *)m_strComponentName.mb_str());
            }
            m_colBackgroundColor = ParseColor(m_strDefaultBackgroundColor);
            wxASSERT(m_colBackgroundColor.Ok());
        }
    }
    return true;
}
예제 #2
0
wxBitmap CProjectProcessingPage::GetBitmapResource( const wxString& name )
{
// TODO: Choose from multiple size images if provided, else resize the closest one
    // Bitmap retrieval
    if (name == wxT("res/wizprogress01.xpm"))
    {
        wxBitmap bitmap(GetScaledBitmapFromXPMData(wizprogress01_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress02.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress02_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress03.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress03_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress04.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress04_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress05.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress05_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress06.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress06_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress07.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress07_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress08.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress08_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress09.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress09_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress10.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress10_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress11.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress11_xpm));
        return bitmap;
    }
    else if (name == wxT("res/wizprogress12.xpm"))
    {
        wxBitmap  bitmap(GetScaledBitmapFromXPMData(wizprogress12_xpm));
        return bitmap;
    }
    return wxNullBitmap;
}