| 213 | bool is_in2(const Frect& b1, const Frect& b2) { return (b1.x1 < b2.x1) && (b1.x2 > b2.x2) && (b1.y1 < b2.y1) && (b1.y2 > b2.y2); } |
| 214 | |
| 215 | void CUIButton::Update() |
| 216 | { |
| 217 | CUIStatic::Update(); |
| 218 | |
| 219 | if (CursorOverWindow() && m_hint_text.size() && !g_btnHint->Owner() && Device.dwTimeGlobal > m_dwFocusReceiveTime + 500) |
| 220 | { |
| 221 | g_btnHint->SetHintText(this, *m_hint_text); |
| 222 | |
| 223 | Fvector2 c_pos = GetUICursor()->GetCursorPosition(); |
| 224 | Frect vis_rect; |
| 225 | vis_rect.set(0, 0, UI_BASE_WIDTH, UI_BASE_HEIGHT); |
| 226 | |
| 227 | // select appropriate position |
| 228 | Frect r; |
| 229 | r.set(0.0f, 0.0f, g_btnHint->GetWidth(), g_btnHint->GetHeight()); |
| 230 | r.add(c_pos.x, c_pos.y); |
| 231 | |
| 232 | r.sub(0.0f, r.height()); |
| 233 | if (false == is_in2(vis_rect, r)) |
| 234 | r.sub(r.width(), 0.0f); |
| 235 | if (false == is_in2(vis_rect, r)) |
| 236 | r.add(0.0f, r.height()); |
| 237 | |
| 238 | if (false == is_in2(vis_rect, r)) |
| 239 | r.add(r.width(), 45.0f); |
| 240 | |
| 241 | g_btnHint->SetWndPos(r.lt); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | void CUIButton::OnFocusLost() |
| 246 | { |
nothing calls this directly
no test coverage detected