[xplorer˛] — Docking framework source code
home » blog » 10 April 2011 [programming]
 

Once upon a time people were using a quaint programming language called C++ (anyone?) to develop windows applications. Arguably a poor grasp of windows internals and a low level language like C++ can be a deadly combination leading to crash happy, buggy code. That's why kids nowadays turn to glorified visual basic .NET that is generally idiot proof but unfathomable; where you get all sorts of bolt on libraries for the coolest UI elements like docking toolbars for free.

There are many docking toolbar frameworks for C++ too, some free (the latest MFC comes with all bells and whistles, including docking and ribbon toolbars). The particular framework I work on, WTL, doesn't have docking toolbars. There is a library by Sergey Klimov that many people use in WTL. Personally I find it distasteful — immediately when I saw links to STL and Boost, I knew it wasn't for me, without even bothering to examine the monstrous 250KB code base.

The idea sticking to an old school library like WTL is to be in full awareness of what's going on under the bonnet, all the way to the CPU metal. What's the point relinquishing the absolute control to an incomprehensible, possibly buggy external library for the mere pittance of getting docking toolbars? The purist in oneself will rebel. However it is kind of lame that the old 2xExplorer had docking toolbars 10 years ago and the supposedly powerful xplorer˛ is stuck with splitters!

Enter Bjarke Viksoe. This guy is a legend in the WTL community, his website offering all sorts of useful source code, parts of which have been assimilated in xplorer˛ in the past. Bjarke wrote back in 2001 an entry level docking library, clearly an unfinished project. As 10 years have passed I imagine he won't be adding to it, so I took the plunge and finished the job. Here it is to download within a sample ATL/WTL project that won't offend the purist:

Download docking framework source code (66 KB)
WTL docking toolbar demo

I will not get into a lengthy explanation of what's going on, the source code is there for all interested parties to see. To get docking panes in your WTL project you only need a single header file atldock.h and set your frame's client window to an instance of the docking manager CDockingWindow class. For more details see how things are plumbed together in the demo project's mainfrm.h file. The list of improvements:

  • Better pane positioning
  • Registry persistence of docked state
  • Modern flat look including gripper bar text
  • Compiles with VS6 (ATL3/WTL3) and with more recent versions e.g. VS2010 (ATL7)
  • Compatible with all windows (at least from win98 onwards) and 32/64 bits

There is room for improvement, and you will surely notice the wealth of ATLASSERT which is my trademark for hastily assembled (but somehow robust :) code. Still you get a no-nonsense docking framework with panes that you can drag-rearrange to taste in the four corners of the window (or have them floating). If you discover any bugs please let me know.

Long live WTL, now with extra bon-bons!

Post a comment on this topic

 

 

What would you like to do next?

Reclaim control of your files!
  • browse
  • preview
  • manage
  • locate
  • organize
Download xplorer2 free trial
"This powerhouse file manager beats the pants off Microsoft's built-in utility..."

download.com
© 2002—2011 Nikos Bozinis, all rights reserved