Пример #1
0
/**
 * Sets the button as the pressed button if it's part of a group.
 * @param action Pointer to an action.
 * @param state State that the action handlers belong to.
 */
void TextButton::mousePress(Action *action, State *state)
{
	if (action->getDetails()->button.button == SDL_BUTTON_LEFT && _group != 0)
	{
		TextButton *old = *_group;
		*_group = this;
		if (old != 0)
			old->draw();
		draw();
	}

	if (isButtonHandled(action->getDetails()->button.button))
	{		
		if (soundPress != 0 && _group == 0 &&
			action->getDetails()->button.button != SDL_BUTTON_WHEELUP && action->getDetails()->button.button != SDL_BUTTON_WHEELDOWN)
		{
			soundPress->play(Mix_GroupAvailable(0));
		}

		if (_comboBox)
		{
			_comboBox->toggle();
		}

		draw();
		//_redraw = true;
	}
	InteractiveSurface::mousePress(action, state);
}
Пример #2
0
/**
 * Sets the button as the pressed button if it's part of a group.
 * @param action Pointer to an action.
 * @param state State that the action handlers belong to.
 */
void TextButton::mousePress(Action *action, State *state)
{
	if (soundPress != 0 && _group == 0)
		soundPress->play();

	if (_group != 0)
	{
		TextButton *old = *_group;
		*_group = this;
		old->draw();
	}

	InteractiveSurface::mousePress(action, state);
	_redraw = true;
}
Пример #3
0
/**
 * Sets the button as the pressed button if it's part of a group.
 * @param action Pointer to an action.
 * @param state State that the action handlers belong to.
 */
void TextButton::mousePress(Action *action, State *state)
{
	if (soundPress != 0 && _group == 0 &&
		action->getDetails()->button.button != SDL_BUTTON_WHEELUP && action->getDetails()->button.button != SDL_BUTTON_WHEELDOWN)
	{
		soundPress->play();
	}

	if (action->getDetails()->button.button == SDL_BUTTON_LEFT && _group != 0)
	{
		TextButton *old = *_group;
		*_group = this;
		if (old != 0)
			old->draw();
	}
	draw();
	InteractiveSurface::mousePress(action, state);
	//_redraw = true;
}