本文整理汇总了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);
}
示例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();
}