Beispiel #1
0
	void Button::mouseReleased(const event::MouseEvent& e)
	{
		if(e.getButton() == event::MouseEvent::MOUSE_BUTTON2)
		{
			setSelected(false);
		}
	}
Beispiel #2
0
	void CFrame::emitMouseEvent(event::MouseEvent mouseEvent){
		TMLterator
			it(_mouseListeners.begin()),
			end(_mouseListeners.end());

		for(;it!=end; ++it){
			switch(mouseEvent.getEvent()){

			case event::MouseEvent::MOUSE_PRESSED:
				(*it)->mousePressed(mouseEvent);
				break;

			case event::MouseEvent::MOUSE_RELEASED:
				(*it)->mouseReleased(mouseEvent);
				break;

			case event::MouseEvent::MOUSE_ENTERED:
				(*it)->mouseEntered(mouseEvent);
				break;

			case event::MouseEvent::MOUSE_EXITED:
				(*it)->mouseExited(mouseEvent);
				break;

			default:
				break;

			}
		}
	}
Beispiel #3
0
	void Button::mousePressed(const event::MouseEvent& e)
	{
		if(e.getButton() == event::MouseEvent::MOUSE_BUTTON2)
		{
			setSelected(true);
		}
	}
Beispiel #4
0
			void SliderTheme::mouseMotion(const event::MouseEvent &e)
			{
				Slider *slider = static_cast<Slider*>(e.getSource());
				if(slider->isAdjusting())
				{
					int x = e.getX() - slider->getLocationOnScreen().x;
					float distance = static_cast<float>((static_cast<float>(x) / static_cast<float>(slider->getBounds().width) * static_cast<float>(slider->getMaximum()-slider->getMinimum()) + static_cast<float>(slider->getMinimum())));
					slider->setValue(distance);
				}
				else
				{
					int y = e.getY() - slider->getLocationOnScreen().y;
					float distance = static_cast<float>((static_cast<float>(y) / static_cast<float>(slider->getBounds().height) * static_cast<float>(slider->getMaximum()-slider->getMinimum()) + static_cast<float>(slider->getMinimum())));
					slider->setValue(distance);
				}
			}
Beispiel #5
0
	void Component::processMouseEvent(const event::MouseEvent& e)
	{
		if(!isEnabled())
		{
			return;
		}

		event::MouseListenerList::iterator iterator;
								
		for(iterator = mouseListeners.begin(); iterator != mouseListeners.end(); ++iterator)
		{
			switch(e.getID())
			{
				case event::MouseEvent::MOUSE_PRESSED:
				{
					(*iterator)->mousePressed(e);
					break;
				}
				case event::MouseEvent::MOUSE_RELEASED:
				{
					(*iterator)->mouseReleased(e);
					break;
				}
				case event::MouseEvent::MOUSE_ENTERED:
				{
					(*iterator)->mouseEntered(e);
					break;
				}
				case event::MouseEvent::MOUSE_EXITED:
				{
					(*iterator)->mouseExited(e);
					break;
				}
				case event::MouseEvent::MOUSE_CLICKED:
				{
					(*iterator)->mouseClicked(e);
					break;
				}
				case event::MouseEvent::MOUSE_DRAGGED:
				{
					(*iterator)->mouseDragged(e);
					break;
				}
				case event::MouseEvent::MOUSE_MOTION:
				{
					(*iterator)->mouseMotion(e);
					break;
				}
			}
		}
	}
Beispiel #6
0
	void CButton::mouseReleased(const event::MouseEvent& e){
		if(e.getSource() == this)
			emitReleasedButton();
	}
Beispiel #7
0
	void CButton::mouseEntered(const event::MouseEvent& e){
		if(e.getSource() == this)
			emitHighlightedButton();
	}