//***************************************************************************
int CBCGPDropDownList::GetCurSel()
{
	ASSERT_VALID (this);

	if (GetSafeHwnd () == NULL)
	{
		return m_nCurSel;
	}

	CBCGPPopupMenuBar* pMenuBar = ((CBCGPDropDownList*) this)->GetMenuBar ();
	ASSERT_VALID (pMenuBar);

	CBCGPToolbarButton* pSel = pMenuBar->GetHighlightedButton ();
	if (pSel == NULL)
	{
		return -1;
	}

	int nIndex = 0;

	for (int i = 0; i < pMenuBar->GetCount (); i++)
	{
		CBCGPToolbarButton* pItem = pMenuBar->GetButton (i);
		ASSERT_VALID (pItem);

		if (!(pItem->m_nStyle & TBBS_SEPARATOR))
		{
			if (pSel == pItem)
			{
				m_nCurSel = nIndex;
				return nIndex;
			}

			nIndex++;
		}
	}

	return -1;
}