I like wxWidgets; it is a nice way to write interfaces in C++ (though some people will say that writing interfaces in C++ is stupid, and that you should use C# instead, but I digress). In particular, wxAUI is a nice quick way to create interfaces with draggable/resizable/floatable/dockable/splittable panes/tabs and all that jazz, and wxScintilla/wxSTC is a nice wrapper around Scintilla to give you the basis for a very nice code editor control. One problem with wxAUI is that most people use the default theme, so the default theme begins to look common once you've seen a few wxAUI-based applications. The default theme is also starting to look a little bit dated and old. Conveniently, wxAUI was structured to have pluggable art providers, meaning that it really isn't too hard to write a completely different theme for it. I've taken advantage of this feature of wxAUI to give a Visual Studio 2010 theme to applications written with wxAUI. The end result looks like the following:

For reference, the same application using the default wxAUI theme looks like:

For reference, Visual Studio 2010 looks like:

Most of the process of implementing this is obvious: take the code for the default art providers, rip out most of their innards, and replace them with new drawing code. There are however a few difficult steps:
- Changing the colour of the text in the status bar is only possible by using an owner-drawn status bar, which wxWidgets doesn't support by default. To support this, I derived a new class from wxStatusBar and overwrote the virtual methods which send the configuration windows messages to the native status bar, in order to add the SBT_OWNERDRAW flag to them. Then, as wxWidgets' built-in owner-drawn support only covers menus and controls, I added some logic to wxFrame to detect owner-draw messages intended for the status bar and send them to it. Then the derived class receives this message and writes the correct text in the correct colour.
- wxAuiNotebook creates its own wxAuiManager internally, so even if you call SetArtProvider on the wxAuiNotebook, you only replace the default tab art with your custom tab art. You also need to replace the default dock art of the notebook with your custom dock art. The best way I've found to do this is call SetArtProvider on the notebook to set the tab art, then call GetAuiManager on the wxAuiNotebook, do a cast to remove the const-ness of the resulting object, and then call SetArtProvider on that to set the dock art. It seems ugly to do that cast, but I can't see a cleaner way without adding a new method to wxAuiNotebook, which I try to avoid doing.
- To allow the active tab / pane to be drawn slightly differently, you're meant to pass the wxAUI_MGR_ALLOW_ACTIVE_PANE flag to wxAuiManager. As far as I can tell, this isn't currently working correctly in the trunk version of wxWidgets, and I'm still trying to get it work fully correctly. So far, I've tweaked wxAuiManager::OnChildFocus to better find the focused panel from the focused window, which improves the behaviour a fair bit.
- The current notebook implementation keeps track of a normal/hover/active state for buttons, but only normal/active for tabs. To get the styling I wanted, I extended the notebook implementation to track a hover state for tabs - this just needs a few extensions to wxAuiTabCtrl::OnMotion and wxAuiTabCtrl::OnLeaveWindow.
- Related other changes to wxWidgets: ticket 11552 and ticket 12014.
PS. Yes, my current project is a Lua IDE / debugger.
Comments
vs themes
But who uses the default VS themes? black on white! Kills eyes eventually for backlit displays. I use slightly adjusted ZenBurn: background 35,35,35 (decimals), text 211,211,118 and various other gentle/soft colors but still easy to read even if sun glasses on (helps a lot when staring the screen 16 hours a day year round).
don't need to change the dock art of wxAuiNotebook
So I have been reading about this potential bug in wxAuiNotebook and problems with custom drawing the Tabs.
Problem:
One of the common problems was using a custom TabArt (wxAuiMyTabArt : public wxAuiDefaultTabArt) and the overridden drawing functions ( like DrawTab , DrawBackground() ...etc) not getting called even after calling wxAuiNotebook::setArtProvider(new wxAuiMyArtProvider).
WorkAround suggested by many :
use the SetArtProvider of the wxAuiManager which wxAuiNoteBook internallly uses to set the DockArt also change the TabArt for wxAuiNotebook
But its still not an intutive solution .
My Solution is :
override wxAuiDefaultTabArt::Clone() in your derived class , potentially,implement the function as
wxAuiTabArt* wxAuiMyArt::Clone()
{
wxAuiMyTabArt* art = new wxAuiMyTabArt; /// In base class this line looks like wxAuiDefaultTabArt* art = new wxAuiDefaultTabArt;
art->SetNormalFont(m_normal_font);
art->SetSelectedFont(m_selected_font);
art->SetMeasuringFont(m_measuring_font);
return art;
}
and then set this as art provider immediately after creation of the wxAuiNoteBook.
Worked for me.
Would you be kind enough to
Would you be kind enough to share your Art provider sources (inc graphics)?
Nice one
Can you develop wxwidgets IDE for C++. There are many but not so good. Yours for lua seems to have advanced look and feel. Thanks
please share your wxAui code
Hi.
I'm developing Tcl/Tk IDE using wxWidgets.
http://lab.tcltk.co.kr/mytcl.php
Fantastic customizing your wxAui widget.
Is it possible your wxAui customizing code sharing? :-)
Interesting, but without the
Interesting, but without the source as an example I'm not sure what the point of this is...
Corsix Mod studio not working
Hi I've downloaded the Corsix mod studio and it's not working when I try to install it.
I'm running Windows 7 64 and says I'm missing a Dll.file
Can't remember the name but I get back posting the file.
Cheers.
This looks very nice
Would you please give a more detailed description how to realise this style with wxwidgets?
...Or post some source.
Thank you very much :)
please help
im using your studio and asked so many people to help but no one will. you are my last option. i am modding dawn of war soulstorm and all i want to know is how to get unlimited generators and turrets and units that are locked like termies or possessed squads. i have a few unlimited and various mods but i would like to make my own. i found the population and changed to 0 on all units so no worries on that. please just give me a little direction to go with and il try to figure it out. my email is t2thewiggy@hotmail.com PLEASE HELP thank you
Do you plan to release the
Do you plan to release the code for this wxArtProvider?
Quite interesting. I'm also
Quite interesting. I'm also doing an application built on top of wxWidgets and this might be useful later when I want to skin it :D
Also have more information on your Lua debugger? I'm interested :)
Post new comment