· by Steve · Read in about 4 min · (689 Words)

So, one of the things I’ve been doing over the last couple of days is getting to know wxWidgets a little. I’d always said that if I was going to write a cross-platform GUI tool, that wxWidgets would be my first port of call because it’s native code and is proven to work well on the major platforms I’m interested in - Code::Blocks is the primary poster child there.

Sure, I could have used .Net (or rather Mono, if I want to stay portable) but then to get to my other libraries I’d have to go via an intermediate binding layer such as MOGRE, which I personally would prefer to avoid, since everything I want to get to is in C++. That’s no reflection on MOGRE, it’s very good and indeed pjcast uses it for his Ogre Studio, but my personal preference is to avoid any intermediate translation layers I don’t need. Perhaps it’s just  from my previous work experience doing a ton of system integration between different platforms (mainframes, *nix, Windows) and across runtime systems (Win32, COM, .Net, Java) that makes me reluctant to expose myself to translation issues if I don’t have to. I’ve had a lot of those bite me on the arse over the years.

Anyway, I had a wander around and did some experiments. wxWidgets seems quite nice to use, and everything I’ve tried has worked quite easily so far, which is good. There are a few things I don’t like so much, like the extensive use of macros for event wiring (reminds me a bit of MFC, although it’s nowhere near as messy), and the fact that since they have a principle of supporting ancient compilers they haven’t used any of the more recent C++ standards like templates and RTTI. But, overall you can’t complain. And, a significant point in their favour - I laughed when I saw they spelled wxColour the ‘right way’ 😀So we’re not the only ones holding out against the tidal wave of SDK ‘misspellings’ out there 😉

I hit a mini brick wall yesterday when I discovered there was no generally available ‘four way splitter’ widget. That is, a CAD-style widget which splits a window into 4 panels where the size of the panels is controlled by a ‘cross’ sash that you can drag horizontally, vertically or both at once. You have all the nice docking widgets of the AUI, and 2-ways splitters of the form you get in Visual Studio / Code::Blocks etc, but no 4-ways split of the CAD form, which is what I wanted (for obvious reasons). I was surprised no-one had solved this already - there were a few posts in the wxWidgets forum about it but all that was provided was hacks using 2-way splitters, which don’t work the same way (you can’t drag the centre divider for example). So, I’ve been working on that and my first contribution to the wxWidgets community will be a proper 4-way CAD splitter widget - I found one for wxPython in fact which I’ve rewritten in C++ (and fixed a few bugs I spotted). It also allows you to maximise one of the 4 panels and then jump back again to the 4-view, keeps proportions on parent resizing, like all the modellers do. Seems to work well but I probably need to test it with more parent / child window types before I release it to the community. It’s been a good way to learn how the internals work anyway.

Once I’ve done that I want to play a bit more with getting a nice dockable & flexible UI system up with Ogre running inside, really just the framework. I like the XSI & Houdini approaches to this so I’ll probably copy elements of them shamelessly. Once that’s done I’ll have a nice base to start developing the world geometry tool I’ve had knocking about in my head for a while but which I’ve had no time for yet; I’ve decided that it’s time to make that time because Ogre’s never going to just step aside and make room off its own back 😀Time to share, big guy.