/** Add a VToolBar control (or a derived class) to the VReBar control.
	This function will determine the size of the toolbar and create a band
	in the rebar that matches the size of the toolbar. The band will be
	identified by the ID that was passed to the Create() method of the
	toolbar. The band containing the default toolbar created by
	VMainWindow will be identified by IDW_TOOLBAR. The nIndex paramater
	specifies the zero based index where the band will be inserted. If you
	set this parameter to -1, the control will add the new band at the last
	location.  The nStyle parameter can be a combination of the
	following styles:

	RBBS_BREAK - The band is on a new line.

	RBBS_CHILDEDGE - The band has an edge at the top and bottom of the
	child window.

	RBBS_FIXEDSIZE - The band can't be sized. With this style, the sizing
	grip is not displayed on the band.

	RBBS_GRIPPERALWAYS - Version 4.71. The band will always have a sizing
	grip, even if it is the only band in the rebar.

	RBBS_HIDDEN - The band will not be visible.

	RBBS_CHEVRON - Version 5.00. The band will have a chevron.

	RBBS_NOGRIPPER - Version 4.71. The band will never have a sizing grip,
	even if there is more than one band in the rebar.

	RBBS_VARIABLEHEIGHT - Version 4.71. The band can be resized by the
	rebar control; cyIntegral and cyMaxChild affect how the rebar will
	resize the band.

	The recommended style for the toolbar that will be added to the rebar
	control is: WS_CHILD | WS_VISIBLE | CCS_NODIVIDER | CCS_NORESIZE |
	TBSTYLE_FLAT | TBSTYLE_TOOLTIPS. If you need more control over the
	method used to insert the band into the rebar control, see either the
	InsertWindow() or InsertBand methods().*/
	VBOOL		InsertToolBar(	VToolBar const&	wndToolbar,
								VINT			nIndex = -1,
								VUINT			nStyle =
												RBBS_GRIPPERALWAYS |
												RBBS_CHILDEDGE |
												RBBS_NOVERT) const
	{
		/** Get the size of the toolbar.*/
		SIZE size;
		wndToolbar.VWINDOW_SM2(TB_GETMAXSIZE, 0, &size);

		/* Initialize the structure needed to add the toolbar control.*/
		REBARBANDINFO rbi;
		VZEROSTRUCT(rbi);
		rbi.cbSize =		sizeof(rbi);
		rbi.fMask =			RBBIM_CHILD | RBBIM_SIZE | RBBIM_CHILDSIZE |
							RBBIM_STYLE | RBBIM_ID | RBBIM_IDEALSIZE;
		rbi.fStyle =		nStyle;
		rbi.cxMinChild =	size.cx;
		rbi.cyMinChild =	size.cy;
		rbi.cyMaxChild =	size.cy;
		rbi.cyChild =		size.cy;
		rbi.cx =			size.cx;
		rbi.cxIdeal =		size.cx;
		rbi.wID =			wndToolbar.Long(GWL_ID);
		rbi.hwndChild =		wndToolbar.GetHandle();

		/* Insert the toolbar into the rebar control.*/
		return InsertBand(rbi, nIndex);
	}
Exemplo n.º 2
0
//////////////////
// Insert band. This overloaded version lets you create a child window band.
//
BOOL CCoolBar::InsertBand(CWnd* pWnd, CSize szMin, int cx,
	LPCTSTR lpText, int iPos, BOOL bNewRow)
{
	CRebarBandInfo rbbi;
	rbbi.fMask = RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_TEXT;
	if (cx>0) {
		rbbi.fMask |= RBBIM_SIZE;
		rbbi.cx = cx;
	}
	if (bNewRow) {
		rbbi.fMask  |= RBBIM_STYLE;
		rbbi.fStyle |= RBBS_BREAK;
	}
	rbbi.hwndChild =  pWnd->GetSafeHwnd();
	rbbi.cxMinChild = szMin.cx;
	rbbi.cyMinChild = szMin.cy;
	rbbi.lpText = (LPTSTR)lpText;
	return InsertBand(iPos, &rbbi);
}
	/** Add any child window derived from VWindow to the VReBar control. This
	function will determine the size of the child window and create a band
	in the rebar that matches the size of the child window. The band will be
	identified by the ID that was passed to the Create() method of the child
	window. The nIndex paramater specifies the zero based index where the
	band will be inserted.  If you set this parameter to -1, the control will
	add the new band at the last location. The pszText parameter can be used
	to add a label to the rebar band, which will be displayed in front of
	the child window. The nIndex paramater specifies the zero based index
	where the band will be inserted. If you set this parameter to -1, the
	control will add the new band at the last location.  The nStyle
	parameter can be a combination of the following styles:

	RBBS_BREAK - The band is on a new line.

	RBBS_CHILDEDGE - The band has an edge at the top and bottom of the
	child window.

	RBBS_FIXEDSIZE - The band can't be sized. With this style, the sizing
	grip is not displayed on the band.

	RBBS_GRIPPERALWAYS - Version 4.71. The band will always have a sizing
	grip, even if it is the only band in the rebar.

	RBBS_HIDDEN - The band will not be visible.

	RBBS_CHEVRON - Version 5.00. The band will have a chevron.

	RBBS_NOGRIPPER - Version 4.71. The band will never have a sizing grip,
	even if there is more than one band in the rebar.

	RBBS_VARIABLEHEIGHT - Version 4.71. The band can be resized by the
	rebar control.

	If you need more control over the method used to insert the band into
	the rebar control, see the InsertBand() method.*/
	VBOOL		InsertWindow(	VWindow const&	window,
								VSTRING_CONST	pszText = NULL,
								VINT			nIndex = -1,
								VUINT			nStyle =
												RBBS_GRIPPERALWAYS |
												RBBS_CHILDEDGE |
												RBBS_NOVERT) const
	{
		/** Get the size of the child window.*/
		VRect r;
		window.GetRect(r);

		/* Initialize the structure needed to add the window.*/
		REBARBANDINFO rbi;
		VZEROSTRUCT(rbi);
		rbi.cbSize     =	sizeof(rbi);
		rbi.fMask      =	RBBIM_CHILD | RBBIM_SIZE | RBBIM_CHILDSIZE |
							RBBIM_STYLE | RBBIM_ID | RBBIM_IDEALSIZE;
		rbi.fStyle     =	nStyle;
		rbi.cxMinChild =	r.GetWidth();
		rbi.cyMinChild =	r.GetHeight();
		rbi.cyMaxChild =	r.GetHeight();
		rbi.cyChild    =	r.GetHeight();
		rbi.cx         =	r.GetWidth();
		rbi.cxIdeal    =	r.GetWidth();
		rbi.wID        =	window.Long(GWL_ID);
		rbi.hwndChild  =	window.GetHandle();

		if ( pszText )
		{
			rbi.fMask |=	RBBIM_TEXT;
			rbi.lpText =	(VSTRING)pszText;
		}

		/* Insert the child window into the rebar control.*/
		return InsertBand(rbi, nIndex);
	}