calling wxInitializeStockObjects early

Vadim Zeitlin vadim at wxwindows.org
Thu Jan 4 14:00:20 PST 2007


[please set your word wrap to 76 or less, thank you]

On Thu, 04 Jan 2007 20:39:15 +0000 Alex Fenton <alex at deleteme.pressure.to> wrote:

AF> I am looking for a way to do enough initialization of wxWidgets (2.6.3,
AF> for now) in C++ so that I can call wxInitializeStockObjects, but
AF> without committing myself to running a particular wxApp object.

 First remark is that wxInitializeStockObjects() doesn't even exist any
more in 2.8, where the stock objects are created on demand, so it might not
make sense to spend a lot of effort on this if you plan to upgrade to 2.8
anyhow (and it would be really nice if you could do it, we simply don't
have resources to support both 2.6 and 2.8 versions in parallel).

AF> The need for this is in wxRuby. We want constants such as Wx::RED,
AF> Wx::NULL_BITMAP (which correspond to wx stock objects) to be available
AF> as soon as the ruby library (wxruby2.so) is loaded, which is before
AF> we're able to create in C++ the instance of wxRubyApp that will
AF> actually be run.

 I'm pretty sure you're not going to be able to create/use things like
brushes and pens before starting the GUI (i.e. connecting to X server in
wxGTK case). For the colours it might or not work.

AF> The wrapper code currently does call wxInitializeStockObjects before
AF> there is an wxApp, and before we use Entry() to enter the main loop in
AF> a platform specific way. However, this causes a load of serious
AF> warnings on GTK, eg
AF> 
AF> (process:11017): GLib-GObject-CRITICAL **: gtype.c:2240: initialization
AF> assertion failed, use IA__g_type_init() prior to this function
AF> 
AF> Is there some way to do enough initialization to avoid these warnings,
AF> without instantiating the App that will eventually be run?

 I don't think so. But in 2.8 you should be able to use Wx::RED if I'm
reading the code correctly.

AF> PS - there have been a couple of wxruby2-preview releases since our
AF> last announcement to this newsgroup. Recent major additions to the port
AF> include the printing framework, the html framework, plus the usual
AF> fixes and extra features.

 It's pretty nice to see wxBuby making progress, thanks for posting here
about it!

AF> It's still not quite ready for production use

 I'd like to reiterate my recommendation to make its 1.0 release using wx
2.8.0 then -- if you don't have to worry about existing code, it would be
surely better to start with the latest wx release.

 Good luck!
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/





More information about the wx-users mailing list