本文整理汇总了C++中wxIconBundle::GetIconByIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ wxIconBundle::GetIconByIndex方法的具体用法?C++ wxIconBundle::GetIconByIndex怎么用?C++ wxIconBundle::GetIconByIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxIconBundle
的用法示例。
在下文中一共展示了wxIconBundle::GetIconByIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetIcons
void wxTopLevelWindowQt::SetIcons( const wxIconBundle& icons )
{
wxTopLevelWindowBase::SetIcons( icons );
QIcon qtIcons;
for ( size_t i = 0; i < icons.GetIconCount(); i++ )
{
qtIcons.addPixmap( *icons.GetIconByIndex( i ).GetHandle() );
}
GetHandle()->setWindowIcon( qtIcons );
}
示例2: SetIcons
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{
base_type::SetIcons(icons);
// Setting icons before window is realized can cause a GTK assertion if
// another TLW is realized before this one, and it has this one as its
// transient parent. The life demo exibits this problem.
if (m_widget && gtk_widget_get_realized(m_widget))
{
GList* list = NULL;
for (size_t i = icons.GetIconCount(); i--;)
list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf());
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
g_list_free(list);
}
}
示例3: SetIcons
void wxTopLevelWindowQt::SetIcons( const wxIconBundle& icons )
{
wxTopLevelWindowBase::SetIcons( icons );
QIcon qtIcons;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( size_t i = 0; i < icons.GetIconCount(); i++ )
{
qtIcons.addPixmap( *icons.GetIconByIndex( i ).GetHandle() );
}
GetHandle()->setWindowIcon( qtIcons );
}
示例4: while
void
wxSetIconsX11(WXDisplay* display, WXWindow window, const wxIconBundle& ib)
{
size_t size = 0;
const size_t numIcons = ib.GetIconCount();
for ( size_t i = 0; i < numIcons; ++i )
{
const wxIcon icon = ib.GetIconByIndex(i);
size += 2 + icon.GetWidth() * icon.GetHeight();
}
wxMAKE_ATOM(_NET_WM_ICON, (Display*)display);
if ( size > 0 )
{
unsigned long* data = new unsigned long[size];
unsigned long* ptr = data;
for ( size_t i = 0; i < numIcons; ++i )
{
const wxImage image = ib.GetIconByIndex(i).ConvertToImage();
int width = image.GetWidth(),
height = image.GetHeight();
unsigned char* imageData = image.GetData();
unsigned char* imageDataEnd = imageData + ( width * height * 3 );
bool hasMask = image.HasMask();
unsigned char rMask, gMask, bMask;
unsigned char r, g, b, a;
if( hasMask )
{
rMask = image.GetMaskRed();
gMask = image.GetMaskGreen();
bMask = image.GetMaskBlue();
}
else // no mask, but still init the variables to avoid warnings
{
rMask =
gMask =
bMask = 0;
}
*ptr++ = width;
*ptr++ = height;
while ( imageData < imageDataEnd )
{
r = imageData[0];
g = imageData[1];
b = imageData[2];
if( hasMask && r == rMask && g == gMask && b == bMask )
a = 0;
else
a = 255;
*ptr++ = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b;
imageData += 3;
}
}
XChangeProperty( (Display*)display,
WindowCast(window),
_NET_WM_ICON,
XA_CARDINAL, 32,
PropModeReplace,
(unsigned char*)data, size );
delete[] data;
}
else
{
XDeleteProperty( (Display*)display,
WindowCast(window),
_NET_WM_ICON );
}
}