当前位置: 首页>>代码示例>>C++>>正文


C++ CSkinSimple::GetWorkunitAnimationImage方法代码示例

本文整理汇总了C++中CSkinSimple::GetWorkunitAnimationImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CSkinSimple::GetWorkunitAnimationImage方法的具体用法?C++ CSkinSimple::GetWorkunitAnimationImage怎么用?C++ CSkinSimple::GetWorkunitAnimationImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSkinSimple的用法示例。


在下文中一共展示了CSkinSimple::GetWorkunitAnimationImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AdvanceSlideShow

void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) {
    double xRatio, yRatio, ratio;
    unsigned int i;
    wxString s;
    TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
    if (selData == NULL) return;

    if (reload) {
        m_bCurrentSlideIsDefault = false;
        selData->lastSlideShown = -1;
    }

    int numSlides = (int)selData->slideShowFileNames.size();
#if TESTALLDESCRIPTIONS // For testing
numSlides = 0;
#endif
    if (numSlides <= 0) {
#if HIDEDEFAULTSLIDE
        if (!reload) {
            return;
        }
        wxRect r = GetRect();
        wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r);
        wxWindowDC dc(this);
        dc.DrawBitmap(backgroundBitmap, 0, 0);

        // Force redraws if text unchanged; hide all if not in all-projects list
        m_institution->Show(false);
        m_scienceArea->Show(false);
        m_description->Show(false);
        Enable( false );
        
        if (!m_bGotAllProjectsList) {
            CMainDocument* pDoc = wxGetApp().GetDocument();
            wxASSERT(pDoc);

            pDoc->rpc.get_all_projects_list(m_AllProjectsList);
            m_bGotAllProjectsList = true;
        }
        
        for (i=0; i<m_AllProjectsList.projects.size(); i++) {
            if (!strcmp(m_AllProjectsList.projects[i]->url.c_str(), selData->project_url)) {
                s = wxString(m_AllProjectsList.projects[i]->home.c_str(), wxConvUTF8);
                m_institution->SetLabel(wxGetTranslation(s));
                s = wxString(m_AllProjectsList.projects[i]->specific_area.c_str(), wxConvUTF8);
                m_scienceArea->SetLabel(wxGetTranslation(s));
                s = wxString(m_AllProjectsList.projects[i]->description.c_str(), wxConvUTF8);
                m_description->SetValue(wxGetTranslation(s));

                m_institution->Show(true);
                m_scienceArea->Show(true);
                m_description->Show(true);
                Enable( true );
                m_description->Enable();
                this->Layout();
                break;
            }
        }
        return;
#else   // HIDEDEFAULTSLIDE
        SetBackgroundColour(*wxBLACK);

        if (m_bCurrentSlideIsDefault) return;
        
        CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
        wxASSERT(pSkinSimple);
        wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));

        m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap();
        if (m_SlideBitmap.Ok()) {
            m_bCurrentSlideIsDefault = true;
        }
#endif  // HIDEDEFAULTSLIDE
    } else {
#if HIDEDEFAULTSLIDE
        m_institution->Show(false);
        m_scienceArea->Show(false);
        m_description->Show(false);
        Enable( false );

#endif  // HIDEDEFAULTSLIDE
        // TODO: Should we allow slide show to advance if task is not running?
        int newSlide = selData->lastSlideShown;
        
        if (selData->dotColor == runningIcon) {    // Advance only if running
            if (changeSlide) {
                if (++newSlide >= numSlides) {
                    newSlide = 0;
                }
            }
        }
        if (newSlide < 0) {
            newSlide = 0;
        }
        
        if (selData->lastSlideShown != newSlide) {  // Don't update if only one slide
        
            selData->lastSlideShown = newSlide;

            wxBitmap *bm = new wxBitmap();
//.........这里部分代码省略.........
开发者ID:Milkyway-at-home,项目名称:BOINC,代码行数:101,代码来源:sg_TaskPanel.cpp

示例2: AdvanceSlideShow

void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) {
    double xRatio, yRatio, ratio;
    TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData();
    if (selData == NULL) return;

    if (reload) {
        m_bCurrentSlideIsDefault = false;
        selData->lastSlideShown = -1;
    }

    int numSlides = (int)selData->slideShowFileNames.size();
#if TESTALLDESCRIPTIONS // For testing
numSlides = 0;
#endif
    if (numSlides <= 0) {
#if HIDEDEFAULTSLIDE
        if (!reload) {
            return;
        }
        wxRect r = GetRect();
        wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r);
        wxWindowDC dc(this);
        dc.DrawBitmap(backgroundBitmap, 0, 0);

        // Force redraws if text unchanged; hide all if not in all-projects list
        m_description->Show(false);
        Enable( false );
        
        if (!m_bGotAllProjectsList) {
            CMainDocument* pDoc = wxGetApp().GetDocument();
            wxASSERT(pDoc);

            pDoc->rpc.get_all_projects_list(m_AllProjectsList);
            m_bGotAllProjectsList = true;
        }
        
        SetDescriptionText();

        return;
#else   // HIDEDEFAULTSLIDE
        SetBackgroundColour(*wxBLACK);

        if (m_bCurrentSlideIsDefault) return;
        
        CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
        wxASSERT(pSkinSimple);
        wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));

        m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap();
        if (m_SlideBitmap.Ok()) {
            m_bCurrentSlideIsDefault = true;
        }
#endif  // HIDEDEFAULTSLIDE
    } else {
#if HIDEDEFAULTSLIDE
        m_description->Show(false);
        Enable( false );

#endif  // HIDEDEFAULTSLIDE
        // TODO: Should we allow slide show to advance if task is not running?
        int newSlide = selData->lastSlideShown;
        
        if (selData->dotColor == runningIcon) {    // Advance only if running
            if (changeSlide) {
                if (++newSlide >= numSlides) {
                    newSlide = 0;
                }
            }
        }
        if (newSlide < 0) {
            newSlide = 0;
        }
        
        if (selData->lastSlideShown != newSlide) {  // Don't update if only one slide
        
            selData->lastSlideShown = newSlide;

            wxBitmap *bm = new wxBitmap();
            bm->LoadFile(selData->slideShowFileNames[newSlide], wxBITMAP_TYPE_ANY);
            if (bm->Ok()) {
                m_SlideBitmap = *bm;
                delete bm;
                m_bCurrentSlideIsDefault = false;
            }
        }
    }
    if (m_SlideBitmap.Ok()) {
        // Check to see if they need to be rescaled to fit in the window
        ratio = 1.0;
        xRatio = (double)SLIDESHOWWIDTH / (double)m_SlideBitmap.GetWidth();
        yRatio = (double)SLIDESHOWHEIGHT / (double)m_SlideBitmap.GetHeight();
        ratio = xRatio;
        if ( yRatio < ratio ) {
            ratio = yRatio;
        }
        if ( (ratio < 0.95) || (ratio > 1.05) ) {
            wxImage img = m_SlideBitmap.ConvertToImage();
            img.Rescale((int) (m_SlideBitmap.GetWidth()*ratio), 
						(int) (m_SlideBitmap.GetHeight()*ratio), 
						(ratio > 1.0) ? wxIMAGE_QUALITY_BILINEAR : wxIMAGE_QUALITY_BOX_AVERAGE
//.........这里部分代码省略.........
开发者ID:WilliamStilte,项目名称:boinc,代码行数:101,代码来源:sg_TaskPanel.cpp


注:本文中的CSkinSimple::GetWorkunitAnimationImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。