示例#1
0
  bool Component::HandleMouseEvent(const MouseEvent & e)
  {
    /*
     * In this default implementation, you should iterate through the
     * children to see if they can handle the event. As soon as one
     * child handles the event (by returning true), the method should
     * return true. If no child can handle the event, it should return
     * false.
     * 
     * Some caveats and things to keep in mind:
     * - You shouldn't be able to interact with things you can't see
     * - Points are expected to be in the coordinate system of the
     *   Component (see notes in the header file)
     */

//    LOG_TODO << "TODO CS349: Implement Component::HandleMouseEvent (remove when implemented)";
// TODO CS349
      for (vector<Component*>::iterator iter=this->children.begin(); iter != this->children.end(); iter++) {
          Component* c = (*iter);
          if (c->HandleMouseEvent(e)) {
              return true;
          }
      }
    return false;
  }