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


C++ wxBitmap::IsNull方法代码示例

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


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

示例1: SetBitmap

void CslBufferedStaticBitmap::SetBitmap(const wxBitmap& bmp)
{
    if (!bmp.IsNull())
    {
        wxSize bmpSize(bmp.GetWidth(), bmp.GetHeight());
        wxASSERT(m_size.x >= m_bmpSize.x || m_size.y >= m_bmpSize.y);

        m_bmp = bmp;
        m_bmpSize = bmpSize;
    }

    Refresh(false);
}
开发者ID:aurhat,项目名称:cubelister,代码行数:13,代码来源:CslGuiTools.cpp

示例2: DoSetBitmap

void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which)
{
    if ( !bitmap.IsOk() )
    {
        if ( m_imageData  )
        {
            // Normal image is special: setting it enables images for the
            // button and resetting it to nothing disables all of them.
            if ( which == State_Normal )
            {
                delete m_imageData;
                m_imageData = NULL;
            }
            else
            {
                // Replace the removed bitmap with the normal one.
                wxBitmap bmpNormal = m_imageData->GetBitmap(State_Normal);
                m_imageData->SetBitmap(which == State_Disabled
                                            ? bmpNormal.ConvertToDisabled()
                                            : bmpNormal,
                                       which);
            }
        }

        return;
    }

#if wxUSE_UXTHEME
    wxXPButtonImageData *oldData = NULL;
#endif // wxUSE_UXTHEME

    // Check if we already had bitmaps of different size.
    if ( m_imageData &&
          bitmap.GetSize() != m_imageData->GetBitmap(State_Normal).GetSize() )
    {
        wxASSERT_MSG( (which == State_Normal) || bitmap.IsNull(),
                      "Must set normal bitmap with the new size first" );

#if wxUSE_UXTHEME
        if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() )
        {
            // We can't change the size of the images stored in wxImageList
            // in wxXPButtonImageData::m_iml so force recreating it below but
            // keep the current data to copy its values into the new one.
            oldData = static_cast<wxXPButtonImageData *>(m_imageData);
            m_imageData = NULL;
        }
#endif // wxUSE_UXTHEME
        //else: wxODButtonImageData doesn't require anything special
    }

    // allocate the image data when the first bitmap is set
    if ( !m_imageData )
    {
#if wxUSE_UXTHEME
        // using image list doesn't work correctly if we don't have any label
        // (even if we use BUTTON_IMAGELIST_ALIGN_CENTER alignment and
        // BS_BITMAP style), at least under Windows 2003 so use owner drawn
        // strategy for bitmap-only buttons
        if ( ShowsLabel() && wxUxThemeEngine::GetIfActive() )
        {
            m_imageData = new wxXPButtonImageData(this, bitmap);

            if ( oldData )
            {
                // Preserve the old values in case the user changed them.
                m_imageData->SetBitmapPosition(oldData->GetBitmapPosition());

                const wxSize oldMargins = oldData->GetBitmapMargins();
                m_imageData->SetBitmapMargins(oldMargins.x, oldMargins.y);

                // No need to preserve the bitmaps though as they were of wrong
                // size anyhow.

                delete oldData;
            }
        }
        else
#endif // wxUSE_UXTHEME
        {
            m_imageData = new wxODButtonImageData(this, bitmap);
            MakeOwnerDrawn();
        }
    }
    else
    {
        m_imageData->SetBitmap(bitmap, which);
    }

    // it should be enough to only invalidate the best size when the normal
    // bitmap changes as all bitmaps assigned to the button should be of the
    // same size anyhow
    if ( which == State_Normal )
        InvalidateBestSize();

    Refresh();
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:97,代码来源:anybutton.cpp


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