I would like to save state of control bars in CChildFrame when it changes, so that when new child is created it will have same layout.
To do it I have to overwrite some functions.
in class derived from CExtControlBar
/*virtual*/ void _DraggingStop( bool bCancel ); //to catch changes in docking layout
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing when docked by itself
/*virtual*/ void _RowRecalcingStop( bool bCancel ); //to catch resizing within CExtDynControlBars
in class derived from CExtBarNcAreaButtonAutoHide and used in OnNcAreaButtonsReinitialize when creating autohidden buttons for my controlbar and tabbedbar
/*virtual*/ bool OnNcAreaClicked( CPoint point ); //to catch when bars are autohidden/restored by user
As I can see from the code Prof-UIS creates two "internal containers" when docking control bars: CExtDynTabControlBar and CExtDynControlBars
With CExtDynTabControlBar it is easy:
class derived from CExtDynTabControlBar and created on CExtControlBar::g_nMsgCreateTabbedBar message
/*virtual*/ void _DraggingStop( bool bCancel ); //to catch changes in docking layout when controlBars are in tab bar
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing when controlBars are in tab bar
But there is no message when CExtDynControlBars are created dynamicaly. With such message it will be possible to overwrite needed functions
in class derived from CExtDynControlBars and created on CExtControlBar::g_nMsgCreateDynBar message
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing of dynamic bar
I’ve done some modifications in current version of the library and everything seems to work fine. If you think it is appropriate, could you please add folowing modifications to the library? Thank you in advance.
1. add variable to CExtControlBar
static const UINT g_nMsgCreateDynBar;
const UINT CExtControlBar::g_nMsgCreateDynBar =
::RegisterWindowMessage(
_T("CExtControlBar::g_nMsgCreateDynBar")
);
2. replace in CExtControlBar::_DraggingDoDeepHalfSplit
CExtDynControlBar* pDynBar = new CExtDynControlBar;
with
CExtDynControlBar* pDynBar = NULL;
m_pDockSite->SendMessage(
g_nMsgCreateDynBar,
WPARAM( &pDynBar )
);
#ifdef _DEBUG
if( pDynBar != NULL )
{
ASSERT_VALID( pDynBar );
ASSERT_KINDOF( CExtDynControlBar, pDynBar );
} // if( pDynBar != NULL )
#endif // _DEBUG
if( pDynBar == NULL )
pDynBar = new CExtDynControlBar;
3. replace in CExtDynamicBarHookSink::OnHookWndMsg
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
{
lResult = 0L;
CExtDynTabControlBar ** ppTabbedBar =
(CExtDynTabControlBar **)wParam;
ASSERT( ppTabbedBar != NULL );
(*ppTabbedBar) = pDBS->OnDbsCreateTabbedBarInstance();
ASSERT( (*ppTabbedBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
with
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
{
lResult = 0L;
CExtDynTabControlBar ** ppTabbedBar =
(CExtDynTabControlBar **)wParam;
ASSERT( ppTabbedBar != NULL );
(*ppTabbedBar) = pDBS->OnDbsCreateTabbedBarInstance();
ASSERT( (*ppTabbedBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateDynBar )
{
lResult = 0L;
CExtDynControlBar ** ppDynBar =
(CExtDynControlBar **)wParam;
ASSERT( ppDynBar != NULL );
(*ppDynBar) = pDBS->OnDbsCreateDynBarInstance();
ASSERT( (*ppDynBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateDynamicBar )
4. replace in CExtControlBar::InternalDockStateBar::StateSet
m_pHelperBar = new CExtDynControlBar;
with
m_pHelperBar = NULL;
pDockSite->SendMessage(
g_nMsgCreateDynBar,
WPARAM( &m_pHelperBar )
);
#ifdef _DEBUG
if( m_pHelperBar != NULL )
{
ASSERT_VALID( m_pHelperBar );
ASSERT_KINDOF( CExtDynControlBar, m_pHelperBar );
} // if( m_pHelperBar != NULL )
#endif // _DEBUG
if( m_pHelperBar == NULL )
m_pHelperBar = new CExtDynControlBar;
5. add to CExtDynamicBarSite class
virtual CExtDynControlBar * OnDbsCreateNewDynBarInstance() const;
CExtDynControlBar * CExtDynamicBarSite::OnDbsCreateNewDynBarInstance() const
{
ASSERT( this != NULL );
return new CExtDynControlBar;
}