The floating tabbed toolbar container window currently supports only a static width specified in the CExtTabbedToolControlBar::m_nFloatingWidth
property. This control is designed to contain a large number of command buttons in a set of toolbars inserted as tab pages. In most cases it is used as a control bar statically docked at at the top/bottom of the frame window. So we can consider your question as a feature request.
You can change the tab window properties by making tabbed toolbar using your own tab page container window as its child window and your own tab window inside the tab page container. This means you should use your own CYourTabbedToolControlBar
class derived from the CExtTabbedToolControlBar
class and implementing the following virtual method:
CExtTabPageContainerWnd * CYourTabbedToolControlBar::OnTabPageContainerCreateObject()
{
ASSERT_VALID( this );
ASSERT( GetSafeHwnd() != NULL );
CExtTabPageContainerWnd * pTabPageContainerWnd = NULL;
try
{
pTabPageContainerWnd = new CYourTabPageContainerWnd;
}
catch( CException * pException )
{
ASSERT( FALSE );
pException->Delete();
pTabPageContainerWnd = NULL;
}
return pTabPageContainerWnd;
}
The
CYourTabPageContainerWnd
class is a custom tab page container class:
class CYourTabPageContainerWnd : public CExtTabPageContainerWnd
{
public:
virtual CExtTabWnd * OnTabWndGetTabImpl();
{
ASSERT_VALID( this );
return new CYourTabWnd;
}
};
The
CYourTabWnd
class is a custom tab control to be used inside the tab page container:
class CYourTabWnd : public CExtTWPC < CExtTabWnd >
{
protected:
virtual INT OnTabWndGetParentSizingMargin(
DWORD dwOrientation
) const
{
ASSERT_VALID( this );
if( dwOrientation == __ETWS_ORIENT_RIGHT
|| dwOrientation == __ETWS_ORIENT_BOTTOM
)
return 1;
return 3;
}
virtual void OnTabWndEraseClientArea(
CDC & dc,
CRect & rcClient,
CRect & rcTabItemsArea,
CRect & rcTabNearBorderArea,
DWORD dwOrientation,
bool bGroupedMode
)
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
PmBridge_GetPM()->PaintTabbedTabClientArea(
dc,
rcClient,
rcTabItemsArea,
rcTabNearBorderArea,
dwOrientation,
bGroupedMode,
this
);
}
virtual void OnTabWndDrawItem(
CDC & dc,
CRect & rcTabItemsArea,
LONG nItemIndex,
TAB_ITEM_INFO * pTii,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon
)
{
ASSERT_VALID( this );
ASSERT_VALID( pTii );
pTii;
ASSERT( dc.GetSafeHdc() != NULL );
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
if( (pTii->GetItemStyle() & __ETWI_CENTERED_TEXT) != 0 )
bCenteredText = true;
PmBridge_GetPM()->PaintTabItem(
dc,
rcTabItemsArea,
bTopLeft,
bHorz,
bSelected,
bCenteredText,
bGroupedMode,
bInGroupActive,
bInvertedVerticalMode,
rcEntireItem,
sizeTextMeasured,
pFont,
sText,
pIcon,
this,
nItemIndex,
PmBridge_GetPM()->GetColor( COLOR_BTNTEXT )
);
}
};
The
CYourTabWnd
class is the generic implementation of the tab control which is compatible with the tab page container inside the tabbed toolbar window. You can add other virtual methods into this class for changing its look:
1) The
CExtTabWnd::OnTabWndQueryItemIcon()
virtual method can be added for providing tab items with icons.
2) The
CExtTabWnd::OnTabWndQueryItemText()
virtual method can be added for providing tab items with custom text.
3) The
CExtTabWnd::_GetTabWndFont()
virtual method can be added for changing font of the tab control.
4) The
CExtTabWnd::OnTabWndDrawItem()
and
CExtTabWnd::OnTabWndUpdateItemMeasure()
virtual methods can be added if you want implement your own algorithms for painting and measuring tab items.