|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Celal Sen
|
Jul 21, 2011 - 6:37 AM
|
Hi, We are using tabbed toolbar in our project. We know a tab has only one toolbar inside it. But we need two or more toolbars inside a tab (one below the other). The demonstration figure is below. imageshack.us/photo/my-images/819/doubletabbedbar.png/ How can we manage to do this? Thanks.
|
|
Celal Sen
|
Jul 25, 2011 - 4:47 PM
|
Thanks for the code. Could you please send a sample project that shows how to use it?
|
|
Technical Support
|
Jul 27, 2011 - 2:22 AM
|
|
|
Technical Support
|
Jul 25, 2011 - 12:27 PM
|
Here it is:
class CYourTabbedBar : public CExtTabbedToolControlBar
{
public:
class LocalToolBar : public CExtTabbedToolControlBar::LocalNoReflectedToolBar
{
public:
virtual bool OnQueryMultiRowLayout() const
{
ASSERT_VALID( this );
return true;
}
};
virtual CExtToolControlBar * CExtTabbedToolControlBar::OnBarCreateObject()
{
ASSERT_VALID( this );
CExtToolControlBar * pToolBar = NULL;
try
{
pToolBar = new LocalToolBar;
} // try
catch( CException * pException )
{
ASSERT( FALSE );
pException->Delete();
pToolBar = NULL;
} // catch( CException * pException )
return pToolBar;
}
virtual int OnCalcMaxToolBarWidth()
{
ASSERT_VALID( this );
ASSERT( GetSafeHwnd() != NULL );
CExtTabPageContainerWnd * pWndTabPageContainer =
GetTabPageContainer();
ASSERT_VALID( pWndTabPageContainer );
ASSERT( pWndTabPageContainer->GetSafeHwnd() != NULL );
int nMaxWidth = 0;
INT nTabIndex, nTabCount = BarGetCount();
for( nTabIndex = 0; nTabIndex < nTabCount; nTabIndex ++ )
{
CExtToolControlBar * pToolBar =
BarGetAt( nTabIndex );
ASSERT_VALID( pToolBar );
CRect rcClient, rcWnd;
pToolBar->GetClientRect( &rcClient );
pToolBar->GetWindowRect( &rcWnd );
CSize sizeNC = rcWnd.Size() - rcClient.Size();
int nMaxInBarWidth = 0;
int nBtnIdx, nCountOfButtons = pToolBar->GetButtonsCount();
for( nBtnIdx = 0; nBtnIdx < nCountOfButtons; nBtnIdx++ )
{
CExtBarButton * pTBB =
pToolBar->GetButton( nBtnIdx );
ASSERT_VALID( pTBB );
if( pTBB->IsSeparator()
|| pTBB->IsKindOf(
RUNTIME_CLASS(
CExtBarContentExpandButton
)
)
)
continue;
CSize sizeBtn = pTBB->Rect().Size();
nMaxInBarWidth = max( nMaxInBarWidth, sizeBtn.cx );
}
nMaxInBarWidth *= 2;
nMaxInBarWidth += sizeNC.cx + 2;
nMaxWidth = max( nMaxWidth, nMaxInBarWidth );
}
return nMaxWidth;
}
int OnCalcMaxToolBarHeight()
{
ASSERT_VALID( this );
ASSERT( GetSafeHwnd() != NULL );
CExtTabPageContainerWnd * pWndTabPageContainer =
GetTabPageContainer();
ASSERT_VALID( pWndTabPageContainer );
ASSERT( pWndTabPageContainer->GetSafeHwnd() != NULL );
int nMaxHeight = 0;
INT nTabIndex, nTabCount = BarGetCount();
for( nTabIndex = 0; nTabIndex < nTabCount; nTabIndex ++ )
{
CExtToolControlBar * pToolBar =
BarGetAt( nTabIndex );
ASSERT_VALID( pToolBar );
CRect rcClient, rcWnd;
pToolBar->GetClientRect( &rcClient );
pToolBar->GetWindowRect( &rcWnd );
CSize sizeNC = rcWnd.Size() - rcClient.Size();
int nMaxInBarHeight = 0;
int nBtnIdx, nCountOfButtons = pToolBar->GetButtonsCount();
for( nBtnIdx = 0; nBtnIdx < nCountOfButtons; nBtnIdx++ )
{
CExtBarButton * pTBB =
pToolBar->GetButton( nBtnIdx );
ASSERT_VALID( pTBB );
if( pTBB->IsSeparator()
|| pTBB->IsKindOf(
RUNTIME_CLASS(
CExtBarContentExpandButton
)
)
)
continue;
CSize sizeBtn = pTBB->Rect().Size();
nMaxInBarHeight = max( nMaxInBarHeight, sizeBtn.cy );
}
nMaxInBarHeight *= 2;
nMaxInBarHeight += sizeNC.cy + 2;
nMaxHeight = max( nMaxHeight, nMaxInBarHeight );
}
return nMaxHeight;
}
};
|
|
Celal Sen
|
Jul 25, 2011 - 1:43 AM
|
Hi, Unfortunately it’s not possible. We’ve already tried to use ribbon bar and decided to use a tabbed toolbar. Tabbed toolbar is easier to use, it’s dockable horizontally and vertically, etc. So we are sticking with the tabbed toolbar. Could you provide a solution for the tabbed toolbar. Thanks.
|
|
Technical Support
|
Jul 22, 2011 - 1:09 PM
|
What do you think about switching to a ribbon bar? It supports a layout of buttons organized into 3 rows.
|
|