예제 #1
0
void phdShapeGroup::onMouseMoved(ofMouseEventArgs& args) {

	if(!visible)  return;

	// if popup has focus
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible()) {
		ofMouseEventArgs _args = args; _args.x = ofGetMouseX(); _args.y = ofGetMouseY();
		getPopupMenu()->onMouseMoved(_args);
		return;
	}

	if(focused != NULL && focused->updateHitTestInfo(args.x, args.y)) return;

	phdShapeBase * _shape = NULL;
	for(int i = 0; i < shapes.size(); i++) {
		if(shapes[i] != NULL && shapes[i]->updateHitTestInfo(args.x, args.y)) {
			_shape = shapes[i];
			break;
		}
	}

	setFocused(_shape);

	if(focused != NULL) focused->onMouseMoved(args);
}
void phdControlManager::mouseDragged(ofMouseEventArgs& args) {
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible() && getPopupMenu()->updateHitTestInfo(args.x,args.y)) {
		getPopupMenu()->onMouseDragged(args);
		return;
	}

	if(selectedControl != NULL) selectedControl->onMouseDragged(args);
}
예제 #3
0
void phdShapeGroup::onMouseDragged(ofMouseEventArgs& args) {

	if(!visible)  return;

	// if popup has focus
	ofMouseEventArgs _args = args; _args.x = ofGetMouseX(); _args.y = ofGetMouseY();
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible()) {
		getPopupMenu()->onMouseDragged(_args);
		return;
	}

	if(selected != NULL) { selected->onMouseDragged(args); }
}
void phdControlManager::mousePressed(ofMouseEventArgs& args) {
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible()) {
		getPopupMenu()->onMousePressed(args);
		return;
	}

	if(selectedControl != NULL && selectedControl->updateHitTestInfo(args.x, args.y)) {
		selectedControl->onMousePressed(args);
	} else {
		setSelectedControl(focusedControl);
		if(selectedControl != NULL) selectedControl->onMousePressed(args);
	}
}
예제 #5
0
void Component::mousePressed(MouseEventDetails* const e)
{
    produceMousePressed(e);

    if(e->getButton() == MouseEventDetails::BUTTON3
       && getPopupMenu() != NULL)
    {
        getPopupMenu()->setInvoker(this);
        getPopupMenu()->setVisible(true);
        getPopupMenu()->setPosition(ViewportToComponent(e->getLocation(),getParentWindow(),e->getViewport()));

        getParentWindow()->pushToActivePopupMenus(getPopupMenu());
    }
}
void phdControlManager::mouseMoved(ofMouseEventArgs& args) {

	if(getPopupMenu() != NULL && getPopupMenu()->getVisible() && getPopupMenu()->updateHitTestInfo(args.x,args.y)) {
		getPopupMenu()->onMouseMoved(args);
		return;
	}

	if(selectedControl != NULL && selectedControl->updateHitTestInfo(args.x, args.y)) {
		selectedControl->onMouseMoved(args);
		return;
	}

	phdControlBase * _control = NULL;

	if(drawMode == cmdmControls || drawMode == cmdmBoth) {
		for(int i = 0; i < controls.size(); i++) {
			if(controls[i] != NULL && controls[i]->getClassName() != "PHDPROJECTOR" &&
				controls[i]->updateHitTestInfo(args.x, args.y)) {
				_control = controls[i];
				break;
			}
		}
	}

	if(drawMode == cmdmWarpers || drawMode == cmdmBoth) {
		if(_control == NULL) {
			for(int i = 0; i < controls.size(); i++) {
				if(controls[i] != NULL && controls[i]->getClassName() == "PHDPROJECTOR" &&
					controls[i]->updateHitTestInfo(args.x, args.y)) {
					_control = controls[i];
					break;
				}
			}
		}
	}

	setFocusedControl(_control);

	if(focusedControl != NULL) focusedControl->onMouseMoved(args);
}
void phdControlManager::mouseReleased(ofMouseEventArgs& args) {
	// if popup has focus
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible()) {
		getPopupMenu()->onMouseReleased(args);
		ofRemoveListener(getPopupMenu()->popEvent, this, &phdControlManager::onPopupClick);
		getPopupMenu()->setVisible(false);
		return;
	}

	if(selectedControl == NULL) {
		if(args.button == 2 && getPopupMenu() != NULL) { // right click
			getPopupMenu()->setOwner(this);
			getPopupMenu()->popup(args.x, args.y, (void*)this, "MANAGER");
			ofAddListener(getPopupMenu()->popEvent, this, &phdControlManager::onPopupClick);
			return;
		}
	}

	if(selectedControl != NULL) selectedControl->onMouseReleased(args);
}
예제 #8
0
void phdShapeGroup::onMouseReleased(ofMouseEventArgs& args) {

	if(!visible)  return;

	// if popup has focus
	if(getPopupMenu() != NULL && getPopupMenu()->getVisible()) {
		ofMouseEventArgs _args = args; _args.x = ofGetMouseX(); _args.y = ofGetMouseY();
		getPopupMenu()->onMouseReleased(_args);
		ofRemoveListener(getPopupMenu()->popEvent, this, &phdShapeGroup::onPopupClick);
		return;
	}

	if(selected != NULL && selected == focused) {
		if(args.button == 2 && getPopupMenu() != NULL) { // right click
			getPopupMenu()->setOwner(selected);
			getPopupMenu()->popup(ofGetMouseX(), ofGetMouseY(), (void*)selected, "SHAPE");
			ofAddListener(getPopupMenu()->popEvent, this, &phdShapeGroup::onPopupClick);
			return;
		}
	}

	if(selected != NULL) selected->onMouseReleased(args);
}