On Nov 20, 2007 4:07 PM, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
>
> John Labenski wrote:
> > On Nov 16, 2007 8:47 AM, Hakki Dogusan <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> Is it possible to extend wxArtProvider in wxLua? wx's document shows
> >> following sample:
> >>

Added in CVS.

-- get some sort of bitmap for testing
b = wx.wxArtProvider.GetBitmap(wx.wxART_NEW, wx.wxART_TOOLBAR)

-- make new art provider and return above bitmap for everything
a = wx.wxLuaArtProvider()
a.CreateBitmap = function(self, id, client, size)
     return b
end
wx.wxArtProvider.Push(a)

--------------

Remember that if you create a new wxBitmap for each call to
CreateBitmap(...) that you .delete() it if you are not using it
elsewhere so they don't build up. You can very quickly run out of GDI
resources in MSW (even XP).

The problem is how to conveniently do this? You could use a single
global variable like below.

Note: The wxArtProvider caches the bitmaps itself so you do not need
to keep a copy in Lua.

single_global_art_bmp = nil
a.CreateBitmap = function(self, id, client, size)
    if (single_global_art_bmp) then single_global_art_bmp.delete() end

    create new single_global_art_bmp...

     return single_global_art_bmp
end




Regards,
    John

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to