MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / resolveLocation

Method resolveLocation

forms/control.cpp:40–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void 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
75bool Control::isPointInsideControlBounds(int x, int y) const
76{

Callers

nothing calls this directly

Calls 2

getParentMethod · 0.95
setDirtyMethod · 0.95

Tested by

no test coverage detected