Control* Window::_GetControl(IE::point point) { std::vector<Control*>::const_iterator i; for (i = fControls.begin(); i != fControls.end(); i++) { Control* control = (*i); const IE::point pt = control->Position(); if (point.x >= pt.x && point.x <= pt.x + control->Width() && point.y >= pt.y && point.y <= pt.y + control->Height()) { return (*i); } } return NULL; }
void Window::SetFrame(uint16 x, uint16 y, uint16 width, uint16 height) { fWidth = width; fHeight = height; fPosition.x = x; fPosition.y = y; //TODO: Don't hardcode here. Move to BackWindow ? std::vector<Control*>::const_iterator i; for (i = fControls.begin(); i != fControls.end(); i++) { Control* control = (*i); std::cout << "width: " << control->Width() << std::endl; if (control->Width() == 640 && control->Position().x == 0) { control->SetFrame(0, 0, width, height); } } /*Control* control = GetControlByID(uint32(-1)); if (control != NULL) control->SetFrame(0, 0, width, height);*/ }