示例#1
0
文件: Button.cpp 项目: bramstein/ui
	void Button::mouseReleased(const event::MouseEvent& e)
	{
		if(e.getButton() == event::MouseEvent::MOUSE_BUTTON2)
		{
			setSelected(false);
		}
	}
示例#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;

			}
		}
	}
示例#3
0
文件: Button.cpp 项目: bramstein/ui
	void Button::mousePressed(const event::MouseEvent& e)
	{
		if(e.getButton() == event::MouseEvent::MOUSE_BUTTON2)
		{
			setSelected(true);
		}
	}
示例#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);
				}
			}
示例#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;
				}
			}
		}
	}
示例#6
0
	void CButton::mouseReleased(const event::MouseEvent& e){
		if(e.getSource() == this)
			emitReleasedButton();
	}
示例#7
0
	void CButton::mouseEntered(const event::MouseEvent& e){
		if(e.getSource() == this)
			emitHighlightedButton();
	}