Xtreme Toolkit v1.2 Demo

Release Notes:

The following notes are to help users of the CJLibrary migrate to using the Xtreme Toolkit. Not every possible scenario could be covered here, however in the event that you experience trouble migrating your application from CJLibrary, please contact customer support at support@codejock.com.

 For your convenience, the file CJLibrary.h file has been included in the include subdirectory. This file contains several macros that will help make your conversion from CJLibrary to Xtreme Toolkit much easier.

If you are a Visual C++ 5.0 user, make sure you use the *.dsp.v5 project files (you will need to rename them to *.dsp).

Getting Started:


To get started to used the toolkit with your existing application, make sure that the .\lib, .\bin and .\include directories where the toolkit was installed have been added to DevStudio's directories list, also, you should include the .\bin directory in your systems path, or build your executable to this directory so that your application can find the Xtreme Toolkit dll.

Next, make you have included the following line in your stdafx.h file:


#include <XTToolkit.h>		// Xtreme Toolkit MFC extensions

Next, make sure that you have done the following:

  • Your frame class is derived either from CXTFrameWnd or CXTMDIFrameWnd
  • Your child frame class is derived from CXTMDIChildWnd
  • All of your toolbars are derived from CXTToolBar
  • Your dialog bars are derived from CXTDialogBar
  • Your docking windows are derived from CXTDockWindow
  • Your tab bar is derived from CXTTabCtrlBar

You may find other standard MFC class that you will want to use the Xtreme Toolkit version of as well, if this is an older CJLibrary application, you can search and replace CCJ with CXT, or use the CCJLibrary.h file that has been included.

Menus:


Cool menu support has never been easier, you can forget about overriding such methods as OnMeasureItem(), OnMenuChar() and OnInitMenuPopup(), or having to instantiate a CCJMenu object each time you need a popup menu and calling InitializeMenu(), the CCJMenu class is obsolete in this release.

To use the new cool menus, call InstallCoolMenus(const UINT* nIDToolBars, int nSize) where nIDToolBars points to an array of toolbar resource ids, and nSize indicates the number of members in the array. You can also call InstallCoolMenus(const UINT nIDToolBar) if you just want to pass in a single toolbar id. The best place to do this is just before your CMainFrame::OnCreate method looses scope.

Toolbars and Control Bars:


When creating a control bar based object such as a toolbar or docking window, you must  define a unique resource id for each control bar that you create.  These ids must fall in the range between 0x04268 ( XT_IDW_CONTROLBAR_MIN ) and 0x0445C ( XT_IDW_CONTROLBAR_MAX ).

It is not necessary to define a unique id for the menubar since it already uses the constant AFX_IDW_MENUBAR, or if your application only has one toolbar, you can just use the constant AFX_IDW_TOOLBAR. Keep in mind that all docking windows must fall in this range as well, you can simply add these definitions to your resource.h file, for example:


#define IDR_TOOLBAR1    0x04268
#define IDR_TOOLBAR2    0x04269
#define IDR_TOOLBAR3    0x0426A
#define IDR_TOOLBAR4    0x0426B

And your toolbar creation code might look something like:


// Menubar uses a default resource id.
if (!m_wndMenuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndMenuBar.LoadMenuBar(IDR_MAINFRAME))
{
    TRACE0("Failed to create menubar\n");
    return -1;      // fail to create
}

// Toolbar 1
if (!m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), IDR_TOOLBAR1) ||
!m_wndToolBar1.LoadToolBar(IDR_MAINBAR1))
{
    TRACE0("Failed to create file toolbar\n");
    return -1;      // fail to create
}
m_wndToolBar1.SetWindowText(_T("Toolbar One"));

// Toolbar 2
if (!m_wndToolBar2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), IDR_TOOLBAR2) ||
!m_wndToolBar2.LoadToolBar(IDR_MAINBAR2))
{
    TRACE0("Failed to create file toolbar\n");
    return -1;      // fail to create
}
m_wndToolBar2.SetWindowText(_T("Toolbar Two"));

// Toolbar 3
if (!m_wndToolBar3.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), IDR_TOOLBAR3) ||
!m_wndToolBar3.LoadToolBar(IDR_MAINBAR3))
{
    TRACE0("Failed to create file toolbar\n");
    return -1;      // fail to create
}
m_wndToolBar3.SetWindowText(_T("Toolbar Three"));

// Toolbar 4
if (!m_wndToolBar4.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), IDR_TOOLBAR4) ||
!m_wndToolBar4.LoadToolBar(IDR_MAINBAR4))
{
    TRACE0("Failed to create file toolbar\n");
    return -1;      // fail to create
}
m_wndToolBar4.SetWindowText(_T("Toolbar Four"));

Your application will give you some very strange results if you do not follow these guidelines. Some of the things you may experience are not saving or restoring control position correctly or right click popup menu activation will not working correctly.

Toolbars:


Many things have changed with the toolbar classes. A couple of things that you should be aware of is that the method InsertControl has changed in that it is now your responsibility to create the control first, then pass in the address of the control to be inserted for example:


if (!m_wndComboBox.Create( WS_CHILD|WS_VISIBLE|CBS_DROPDOWN,
  CRect(0,0,200,150), &m_wndToolBar, ID_PLACEHOLDER ))
{
  TRACE0("Failed to create flat toolbar.\n");
  return -1;      // fail to create
}

m_wndToolBar.InsertControl(&m_wndComboBox);

This allows much more flexibility with adding controls to toolbars. Additionally, you no longer need to define a TOOLBARINFO struct array if you want to add customization to your toolbars, customization is automatic now, and you can remove these calls.

Docking Windows:


CCJSizeDockBar class has been removed and merged with the class CXTDockBar. EnableDockingSizeBar() has been removed from the CXTFrameWnd classes and is no longer needed. EnableDockingOnSizeBar() and DockSizeBar() methods have been removed and replaced with the default EnableDocking() and DockControlBar(). These changes were necessary in order to remove code redundancy and to implement standard CControlBar styles and behavior. The  CXTControlBars now will dock with standard control bars and toolbars.

m_eChildBorder to set the control bar display style for the child area has been removed. In order to set the control bars styles you can now make a call to SetXTBarStyle( DWORD dwStyle ) to set the desired CBRS_XT_ styles for the control  bar. Does not affect the WS_ (window style) or or CBRS_ control bar style) settings.

The control bar style can be one or more of the following:

CBRS_XT_BUTTONS:
The control bar has a minimize and close button when docked.

CBRS_XT_GRIPPER:
The control bar has a gripper when docked.

CBRS_XT_GRIPPER_FLAT:
The control bar has a flat gripper, use with CBRS_XT_GRIPPER.

CBRS_XT_GRIPPER_GRAD:
The control bar has a gradient flat gripper use with CBRS_XT_GRIPPER_FLAT.

CBRS_XT_GRIPPER_TEXT:
The control bar draws text in the gripper area, use with CBRS_XT_GRIPPER.

CBRS_XT_BUTTONS_FLAT:
The control bar min and max buttons are flat, use with CBRS_XT_BUTTONS.

CBRS_XT_BORDERS_FLAT:
The control bar borders are flat.

CBRS_XT_CLIENT_OUTLINE:
Draw an edge outline around the client area.

CBRS_XT_CLIENT_STATIC:
Draw a static rect around the client area.

CBRS_XT_CLIENT_MODAL:
Draw a modal rect around the client area.

CBRS_XT_ALL_FLAT:
The following styles combined by using the bitwise OR (|) operator CBRS_XT_GRIPPER_FLAT, CBRS_XT_BUTTONS_FLAT and CBRS_XT_BORDERS_FLAT.

CBRS_XT_DEFAULT:
The following styles combined by using the bitwise OR (|) operator CBRS_XT_BUTTONS, CBRS_XT_GRIPPER, CBRS_XT_GRIPPER_TEXT.

You can set the styles for the splitter bars that separate the docked control bars by calling: CXTFrameWnd::EnableDockingEx (DWORD dwDockStyle, DWORD dwFlatStyle); instead of CXTFrameWnd::EnableDocking(). You can also the control bar style by calling the same method CXTControlBar::EnableDockingEx(DWORD dwDockStyle, DWORD dwFlatStyle);

Your docking window creation code might look something like:


// Initialize docking window m_wndWorkspace
if( !m_wndWorkspace.Create(this, ID_VIEW_WORKSPACE,
	_T("Workspace"), CSize(225,100), CBRS_LEFT ))
{
	TRACE0("Failed to create dialog bar m_wndWorkspace\n");
	return -1;		// fail to create
}

// You can just use EnableDocking if you don't want to change the
// default appearance of the control bars.

m_wndWorkspace.EnableDockingEx( CBRS_ALIGN_ANY, CBRS_XT_SEMIFLAT );
EnableDockingEx( CBRS_ALIGN_ANY, CBRS_XT_SEMIFLAT );
DockControlBar( &m_wndWorkspace );

Outlook Bar Control:


These definitions replace the following enums found in the Outlook Bar Control.


#define WS_OB_SMALLICON        0x00000001L            // fSmallIcon
#define WS_OB_LARGEICON        0x00000002L            // fLargeIcon
#define WS_OB_EDITGROUPS       0x00000004L            // fEditGroups
#define WS_OB_EDITITEMS        0x00000008L            // fEditItems
#define WS_OB_REMOVEGROUPS     0x00000010L            // fRemoveGroups
#define WS_OB_REMOVEITEMS      0x00000020L            // fRemoveItems
#define WS_OB_ADDGROUPS        0x00000040L            // fAddGroups
#define WS_OB_DRAGITEMS        0x00000080L            // fDragItems
#define WS_OB_ANIMATION        0x00000100L            // fAnimation
#define WS_OB_SELHIGHLIGHT     0x00000200L            // fSelHighlight
#define WS_OB_DEFAULT          0x000001FCL

#define RC_OB_ICON             0x00000001L            // ircIcon
#define RC_OB_LABEL            0x00000002L            // ircLabel
#define RC_OB_BOTH             0x00000003L            // ircAll