| 189 | bool CUIWindow::CapturesFocusToo() { return GetMouseCapturer() ? GetMouseCapturer()->CapturesFocusToo() : true; } |
| 190 | |
| 191 | void 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 | |
| 227 | void CUIWindow::CommitFocus(bool focus_lost) |
| 228 | { |
no test coverage detected