Пример #1
0
	void ConversationWindow::mouseClicked(MouseEvent& evt)
	{
		ButtonPtr b = boost::shared_dynamic_cast<gcn::Button>( evt.GetSource());
		if (b)
		{
			story::PhrasePtr answer = mAnswers[b];
			answer->RunAction(mSpeaker);
			SetCurrentPhrase(answer->AutoChooseAnswer(mSpeaker));
		}
	}
Пример #2
0
void TitleBar::MouseDragged(const MouseEvent& lEvent)
{
	// Don't allow moving if we have disabled this
	if(m_pParent->m_bAllowMoving)
	{
		if(lEvent.GetSource() == this)
		{
			if(m_bDragging)
			{
				m_nextX = GetParent()->GetLocationOnScreen().m_x + lEvent.GetX();
				m_nextY = GetParent()->GetLocationOnScreen().m_y + lEvent.GetY();
				GetParent()->SetLocation(m_nextX, m_nextY);
			}
		}
	}

	OnMouseDragged();
}
Пример #3
0
void TitleBar::MouseDraggedOutside(const MouseEvent& lEvent)
{
	if(!m_bFirstOutsideDrag)
	{
		m_lastX = lEvent.GetX();
		m_lastY = lEvent.GetY();
		m_bFirstOutsideDrag = true;
	}

	if(m_pParent->m_bAllowMoving)
	{
		if(lEvent.GetSource() == this)
		{
			if(m_bDragging)
			{
				int lNewX = lEvent.GetX();
				int lNewY = lEvent.GetY();

				int l_ChangeX = lNewX - m_lastX;
				int l_ChangeY = lNewY - m_lastY;

				if(l_ChangeX == 0 && l_ChangeY == 0)
					return;

				m_nextX = GetParent()->GetLocationOnScreen().m_x + l_ChangeX;
				m_nextY = GetParent()->GetLocationOnScreen().m_y + l_ChangeY;
				GetParent()->SetLocation(m_nextX, m_nextY);

				m_lastX = lNewX;
				m_lastY = lNewY;
			}
		}
	}

	OnMouseDraggedOutside();
}