//*************************************************************************************
int CBCGPRibbonButtonsGroup::AddToListBox (CBCGPRibbonCommandsListBox* pWndListBox, BOOL bDeep)
{
	ASSERT_VALID (this);

	int nIndex = -1;

	for (int i = 0; i < m_arButtons.GetSize (); i++)
	{
		CBCGPBaseRibbonElement* pButton = m_arButtons [i];
		ASSERT_VALID (pButton);

		nIndex = pButton->AddToListBox (pWndListBox, bDeep);
	}

	return nIndex;
}
//******************************************************************************
void CBCGPRibbonCommandsListBox::FillFromArray (
		const CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*>& arElements, BOOL bDeep,
		BOOL bIgnoreSeparators)
{
	ASSERT_VALID (this);

	ResetContent ();
	m_nTextOffset = 0;

	BOOL bIsRibbonImageScale = globalData.IsRibbonImageScaleEnabled ();
	globalData.EnableRibbonImageScale (FALSE);

	for (int i = 0; i < arElements.GetSize (); i++)
	{
		CBCGPBaseRibbonElement* pElem = arElements [i];
		ASSERT_VALID (pElem);

		if (bIgnoreSeparators && pElem->IsKindOf (RUNTIME_CLASS (CBCGPRibbonSeparator)))
		{
			continue;
		}

		pElem->AddToListBox (this, bDeep);

		int nImageWidth = pElem->GetImageSize (CBCGPBaseRibbonElement::RibbonImageSmall).cx;

		m_nTextOffset = max (m_nTextOffset, nImageWidth + 2);
	}

	if (GetCount () > 0)
	{
		SetCurSel (0);
	}

	globalData.EnableRibbonImageScale (bIsRibbonImageScale);
}