MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UpdateFocus

Method UpdateFocus

ogsr_engine/xrGame/ui/UIWindow.cpp:191–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189bool CUIWindow::CapturesFocusToo() { return GetMouseCapturer() ? GetMouseCapturer()->CapturesFocusToo() : true; }
190
191void CUIWindow::UpdateFocus(bool focus_lost)
192{
193 bool cursor_on_window;
194 if (focus_lost)
195 {
196 cursor_on_window = false;
197 }
198 else
199 {
200 Fvector2 temp = GetUICursor()->GetCursorPosition();
201 Frect r;
202 GetAbsoluteRect(r);
203 cursor_on_window = !!r.in(temp);
204 if (!cursor_on_window && (!GetMouseCapturer() || !GetMouseCapturer()->CapturesFocusToo()))
205 focus_lost = true;
206 }
207
208 if (cursor_on_window && g_show_wnd_rect)
209 {
210 Frect r;
211 GetAbsoluteRect(r);
212 add_rect_to_draw(r, m_windowName);
213 }
214
215 // RECEIVE and LOST focus
216 m_bCursorOverWindowChanged = (m_bCursorOverWindow != cursor_on_window);
217 if (GetMouseCapturer() && GetMouseCapturer()->CapturesFocusToo())
218 GetMouseCapturer()->UpdateFocus(focus_lost);
219 else
220 {
221 for (auto it = m_ChildWndList.begin(); m_ChildWndList.end() != it; ++it)
222 if ((*it)->IsShown())
223 (*it)->UpdateFocus(focus_lost);
224 }
225}
226
227void CUIWindow::CommitFocus(bool focus_lost)
228{

Callers 3

StartMenuMethod · 0.80
StopMenuMethod · 0.80
OnFrameMethod · 0.80

Calls 8

GetUICursorFunction · 0.85
add_rect_to_drawFunction · 0.85
GetCursorPositionMethod · 0.80
inMethod · 0.80
IsShownMethod · 0.80
CapturesFocusTooMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected