void PretzelRoot::onMouseDown(ci::app::MouseEvent &event) { PretzelGui *pg; // only click the top-most gui for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ pg = *it; console() << pg->getGlobalBounds() << endl; if( pg->isVisible() && pg->getGlobalBounds().contains( event.getPos() ) ){ pg->mouseDown( event.getPos() ); break; } } // If this gui isn't on top, do z sorting to bring it up if( pg && pg != mGuiList[0] ){ for( auto it = mGuiList.begin(); it!=mGuiList.end(); ){ if( *it == pg ){ it = mGuiList.erase(it); }else{ ++it; } } mGuiList.push_front(pg); } }
void PretzelRoot::onMouseMoved(ci::app::MouseEvent &event) { // for( auto it=mGuiList.begin(); it!=mGuiList.end(); ++it){ // (*it)->mouseMoved( event.getPos() ); // } for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ PretzelGui *pg = *it; if( pg->getGlobalBounds().contains( event.getPos() ) ){ (*it)->mouseMoved( event.getPos() ); break; } } }
void PretzelRoot::onMouseWheel(ci::app::MouseEvent &event) { // TODO: this should only happen on the front gui. Make sure to hit test it though. // mGuiList[0]->mouseWheel( event.getWheelIncrement() ); for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ PretzelGui *pg = *it; if( pg->getGlobalBounds().contains( event.getPos() ) ){ (*it)->mouseWheel( event.getWheelIncrement() ); break; } } }