FloatCoord Gui::convertIntToRelative(const IntCoord& _coord, WidgetPtr _parent) { const FloatSize& size = getViewSize(); if (null == _parent) { return FloatCoord(_coord.left / size.width, _coord.top / size.height, _coord.width / size.width, _coord.height / size.height); } const IntCoord& coord = _parent->getClientCoord(); return FloatCoord(1.*_coord.left / coord.width, 1.*_coord.top / coord.height, 1.*_coord.width / coord.width, 1.*_coord.height / coord.height); }
IntCoord Gui::convertRelativeToInt(const FloatCoord& _coord, WidgetPtr _parent) { const FloatSize& size = getViewSize(); if (null == _parent) { return IntCoord(_coord.left * size.width, _coord.top * size.height, _coord.width * size.width, _coord.height * size.height); } const IntCoord& coord = _parent->getClientCoord(); return IntCoord(_coord.left * coord.width, _coord.top * coord.height, _coord.width * coord.width, _coord.height * coord.height); }