| 38 | } |
| 39 | |
| 40 | void Control::resolveLocation() |
| 41 | { |
| 42 | auto previousLocation = resolvedLocation; |
| 43 | auto parentControl = this->getParent(); |
| 44 | if (parentControl == nullptr) |
| 45 | { |
| 46 | resolvedLocation.x = Location.x; |
| 47 | resolvedLocation.y = Location.y; |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | if (Location.x > parentControl->Size.x || Location.y > parentControl->Size.y) |
| 52 | { |
| 53 | resolvedLocation.x = -99999; |
| 54 | resolvedLocation.y = -99999; |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | resolvedLocation.x = parentControl->resolvedLocation.x + Location.x; |
| 59 | resolvedLocation.y = parentControl->resolvedLocation.y + Location.y; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | for (auto ctrlidx = Controls.rbegin(); ctrlidx != Controls.rend(); ctrlidx++) |
| 64 | { |
| 65 | auto c = *ctrlidx; |
| 66 | c->resolveLocation(); |
| 67 | } |
| 68 | |
| 69 | if (previousLocation != resolvedLocation) |
| 70 | { |
| 71 | this->setDirty(); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | bool Control::isPointInsideControlBounds(int x, int y) const |
| 76 | { |