예제 #1
0
void CBCGPRibbonConstructor::ConstructPanel (CBCGPRibbonPanel& panel, const CBCGPRibbonInfo::XPanel& info) const
{
	panel.SetKeys (info.m_strKeys);
	panel.SetJustifyColumns (info.m_bJustifyColumns);
	panel.SetCenterColumnVert (info.m_bCenterColumnVert);

	ConstructElement (panel.GetLaunchButton (), info.m_btnLaunch);

	int i = 0;
	for (i = 0; i < info.m_arElements.GetSize (); i++)
	{
		CBCGPBaseRibbonElement* pElement = 
			CreateElement (*(const CBCGPRibbonInfo::XElement*)info.m_arElements[i]);

		if (pElement != NULL)
		{
			ASSERT_VALID (pElement);

			CBCGPRibbonSeparator* pSeparator = DYNAMIC_DOWNCAST (CBCGPRibbonSeparator, pElement);
			if (pSeparator)
			{
				panel.AddSeparator ();
				delete pSeparator;
			}
			else
			{
				panel.Add (pElement);
			}
		}
	}
}