accessing bitmaps on an .xrc compiled into .cpp

personaje personaje at gmail.com
Mon Oct 15 22:07:05 PDT 2007


Hello everyone!

 I have this .xrc file with a frame that has lots of controls with
<bitmap> childs... I use wxrc -c to create a .cpp file from the .xrc,
this creates a *big* .cpp with all the bitmaps as arrays, and code to
load these arrays into a wxMemoryFS:

----------code---------

#if wxCHECK_VERSION(2,8,5) && wxABI_VERSION >= 20805
    #define XRC_ADD_FILE(name, data, size, mime) \
        wxMemoryFSHandler::AddFileWithMimeType(name, data, size, mime)
#else
    #define XRC_ADD_FILE(name, data, size, mime) \
        wxMemoryFSHandler::AddFile(name, data, size)
#endif

static size_t xml_res_size_0 = 15046;
static unsigned char xml_res_file_0[] = {
47,42,32,88,80,77,32,42,47,10,115,116,97,116,10 ... }

    XRC_ADD_FILE(wxT("XRC_resource/Seymour.cpp$bitmaps_raster.xpm"),
xml_res_file_0, xml_res_size_0, _T("image/x-xpixmap"));

----------end code---------

I would like to be able to load these bitmaps as bitmaps objects, but
I can't, I use wxBitmap::LoadFile(wxT("memory:XRC_resource/Seymour.cpp$bitmaps_raster.xpm"))...

What am I doing wrong? is it possible to do what I want?

Regards.




More information about the wx-users mailing list