コード例 #1
0
void DropDownMenu::SetCurrentSelection( const char *selection )
{
	bool bGotTextFromCommand = false;

	char szDescription[MAX_PATH] = "";

	FlyoutMenu *pFlyout = GetCurrentFlyout();
	if ( pFlyout )
	{
		Button *pCurrentButton = m_hCurrentFlyout->FindChildButtonByCommand( selection );

		if ( pCurrentButton )
		{
			bGotTextFromCommand = true;
			V_strncpy( m_curSelText, selection, sizeof( m_curSelText ) );
			pCurrentButton->GetText( szDescription, sizeof( szDescription ) );
		}
	}

	if ( !bGotTextFromCommand )
	{
		V_strncpy( m_curSelText, selection, sizeof( m_curSelText ) );
		V_strncpy( szDescription, selection, sizeof( szDescription ) );
	}

	if ( m_pButton && m_SelectedTextEnabled )
	{
		m_pButton->SetDropdownSelection( szDescription );
	}

	//when we set a new selection make sure we notify the parent
	GetParent()->OnCommand( selection );
}
コード例 #2
0
void ButtonMouseOutListener::Act(sf::Event)
{
	Button* button = (Button*)_guiItem;
    button->GetText().SetColor(sf::Color(0, 0, 0));
}