MCPcopy Create free account
hub / github.com/DISTRHO/DPF / giveMotionEventForSubWidgets

Method giveMotionEventForSubWidgets

dgl/src/WidgetPrivateData.cpp:147–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147bool Widget::PrivateData::giveMotionEventForSubWidgets(MotionEvent& ev)
148{
149 if (! visible)
150 return false;
151 if (subWidgets.size() == 0)
152 return false;
153
154 const double x = ev.absolutePos.getX();
155 const double y = ev.absolutePos.getY();
156
157 if (SubWidget* const selfw = dynamic_cast<SubWidget*>(self))
158 {
159 if (selfw->pData->needsViewportScaling)
160 {
161 ev.absolutePos.setX(x - selfw->getAbsoluteX() + selfw->getMargin().getX());
162 ev.absolutePos.setY(y - selfw->getAbsoluteY() + selfw->getMargin().getY());
163 }
164 }
165
166 FOR_EACH_SUBWIDGET_INV(rit)
167 {
168 SubWidget* const widget(*rit);
169
170 if (! widget->isVisible())
171 continue;
172
173 ev.pos = Point<double>(x - widget->getAbsoluteX() + widget->getMargin().getX(),
174 y - widget->getAbsoluteY() + widget->getMargin().getY());
175
176 if (widget->onMotion(ev))
177 return true;
178 }
179
180 return false;
181}
182
183bool Widget::PrivateData::giveScrollEventForSubWidgets(ScrollEvent& ev)
184{

Callers 2

motionEventMethod · 0.80
onMotionMethod · 0.80

Calls 6

sizeMethod · 0.80
setXMethod · 0.80
getAbsoluteXMethod · 0.80
getMarginMethod · 0.80
setYMethod · 0.80
getAbsoluteYMethod · 0.80

Tested by

no test coverage detected