• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxIconBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SetIcons

void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
{
    wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

    wxTopLevelWindowBase::SetIcons( icons );

    if ( icons.IsEmpty() )
        return;

    GdkWindow* window = m_widget->window;
    if (!window)
        return;

    wxIcon icon = icons.GetIcon(-1);
    if (icon.IsOk())
    {
        wxMask *mask = icon.GetMask();
        GdkBitmap *bm = NULL;
        if (mask) bm = mask->GetBitmap();

        gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
    }

    wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
                   (WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
}
开发者ID:CobaltBlues,项目名称:wxWidgets,代码行数:26,代码来源:toplevel.cpp


示例2: 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 );
}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:11,代码来源:toplevel.cpp


示例3: 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);
    }
}
开发者ID:raydtang,项目名称:wxWidgets,代码行数:16,代码来源:toplevel.cpp


示例4: DoSetIcon

void wxTopLevelWindowX11::SetIcons(const wxIconBundle& icons )
{
    // this sets m_icon
    wxTopLevelWindowBase::SetIcons( icons );

    DoSetIcon( icons.GetIcon( -1 ) );
    wxSetIconsX11( wxGlobalDisplay(), X11GetMainWindow(), icons );
}
开发者ID:chromylei,项目名称:third_party,代码行数:8,代码来源:toplevel.cpp


示例5: GetDolphinIconBundle

wxIconBundle GetDolphinIconBundle()
{
  static wxIconBundle s_bundle;
  if (!s_bundle.IsEmpty())
    return s_bundle;

#ifdef _WIN32

  // Convert the Windows ICO file into a wxIconBundle by tearing it apart into each individual
  // sub-icon using the Win32 API. This is necessary because WX uses its own wxIcons internally
  // which (unlike QIcon in Qt) only contain 1 image per icon, hence why wxIconBundle exists.
  HINSTANCE dolphin = GetModuleHandleW(nullptr);
  for (int size : {16, 32, 48, 256})
  {
    // Extract resource from embedded DolphinWX.rc
    HANDLE win32_icon =
        LoadImageW(dolphin, L"\"DOLPHIN\"", IMAGE_ICON, size, size, LR_CREATEDIBSECTION);
    if (win32_icon && win32_icon != INVALID_HANDLE_VALUE)
    {
      wxIcon icon;
      icon.CreateFromHICON(reinterpret_cast<HICON>(win32_icon));
      s_bundle.AddIcon(icon);
    }
  }

#else

  for (const char* fname : {"Dolphin.png", "dolphin_logo.png", "[email protected]"})
  {
    wxImage image{StrToWxStr(File::GetSysDirectory() + RESOURCES_DIR DIR_SEP + fname),
                  wxBITMAP_TYPE_PNG};
    if (image.IsOk())
    {
      wxIcon icon;
      icon.CopyFromBitmap(image);
      s_bundle.AddIcon(icon);
    }
  }

#endif

  return s_bundle;
}
开发者ID:DINKIN,项目名称:dolphin,代码行数:43,代码来源:WxUtils.cpp


示例6: 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 );
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:20,代码来源:toplevel.cpp


示例7: SetIcons

void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{
    wxTopLevelWindowBase::SetIcons(icons);

    if ( icons.IsEmpty() )
    {
        // FIXME: SetIcons(wxNullIconBundle) should unset existing icons,
        //        but we currently don't do that
        wxASSERT_MSG( m_icons.IsEmpty(), "unsetting icons doesn't work" );
        return;
    }

    DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
    DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
}
开发者ID:nwhitehead,项目名称:wxWidgets,代码行数:15,代码来源:toplevel.cpp


示例8: size

bool wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
                                             int smX,
                                             int smY,
                                             int i)
{
    const wxSize size(::GetSystemMetrics(smX), ::GetSystemMetrics(smY));

    wxIcon icon = icons.GetIcon(size, wxIconBundle::FALLBACK_NEAREST_LARGER);

    if ( !icon.IsOk() )
        return false;

    ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
    return true;
}
开发者ID:nwhitehead,项目名称:wxWidgets,代码行数:15,代码来源:toplevel.cpp


示例9: wxSetIconsX11

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 );
    }
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:78,代码来源:utilsx11.cpp


示例10: SetIcons

void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons)
{
    // get icon with the system icon size
    SetIcon(icons.GetIcon(-1));
    m_icon_bundle = icons;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:6,代码来源:tabmdi.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxIdleEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxIcon类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap