Пример #1
0
void CVisualStudioDemoDoc::OnDummySelectActiveConfiguration()
{
	CMFCToolBarComboBoxButton* pSrcCombo = NULL;

	CObList listButtons;
	if (CMFCToolBar::GetCommandButtons(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, listButtons) > 0)
	{
		for (POSITION posCombo = listButtons.GetHeadPosition();
			pSrcCombo == NULL && posCombo != NULL;)
		{
			CMFCToolBarComboBoxButton* pCombo = DYNAMIC_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));

			if (pCombo != NULL && CMFCToolBar::IsLastCommandFromButton(pCombo))
			{
				pSrcCombo = pCombo;
			}
		}
	}

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

		LPCTSTR lpszSelItem = pSrcCombo->GetItem();
		CString strSelItem = (lpszSelItem == NULL) ? _T("") : lpszSelItem;

		AfxMessageBox(strSelItem);
	}
	else
	{
		AfxMessageBox(_T("Show \"Set Active Configuration\" dialog...."));
	}
}
Пример #2
0
void CTextPropertyToolBar::OnFontNameChanged()
{
	CMFCToolBarComboBoxButton *pButton = (CMFCToolBarComboBoxButton*)this->GetButton(GetButtonIndex(ID_FONTCOMBO_TEXT));
	CString name = pButton->GetItem(pButton->GetCurSel());
	m_pObserver->PropertyChanged(TextPropertyBuilder::CreateTextProperty(PropertyEnum_FontName, name));
}
Пример #3
0
void CTextPropertyToolBar::OnFontSizeChanged()
{
	CMFCToolBarComboBoxButton *pButton = (CMFCToolBarComboBoxButton*)this->GetButton(GetButtonIndex(ID_SIZECOMBO_TEXT));
	CString size = pButton->GetItem(pButton->GetCurSel());
	m_pObserver->PropertyChanged(TextPropertyBuilder::CreateTextProperty<int>(PropertyEnum_FontSize, std::stoi(size.GetBuffer())));
}