true iff we have enough of the top bar to be able to reposition the window.
| 83 | |
| 84 | // true iff we have enough of the top bar to be able to reposition the window. |
| 85 | bool IsWindowAccessible(wxRect *requestedRect) |
| 86 | { |
| 87 | wxDisplay display; |
| 88 | wxRect targetTitleRect(requestedRect->GetLeftTop(), requestedRect->GetBottomRight()); |
| 89 | // Hackery to approximate a window top bar size from a window size. |
| 90 | // and exclude the open/close and borders. |
| 91 | targetTitleRect.x += 15; |
| 92 | targetTitleRect.width -= 100; |
| 93 | if (targetTitleRect.width < 165) targetTitleRect.width = 165; |
| 94 | targetTitleRect.height = 15; |
| 95 | int targetBottom = targetTitleRect.GetBottom(); |
| 96 | int targetRight = targetTitleRect.GetRight(); |
| 97 | // This looks like overkill to check each and every pixel in the ranges. |
| 98 | // and decide that if any is visible on screen we are OK. |
| 99 | for (int i = targetTitleRect.GetLeft(); i < targetRight; i++) { |
| 100 | for (int j = targetTitleRect.GetTop(); j < targetBottom; j++) { |
| 101 | int monitor = display.GetFromPoint(wxPoint(i, j)); |
| 102 | if (monitor != wxNOT_FOUND) { |
| 103 | return TRUE; |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | return FALSE; |
| 108 | } |
| 109 | |
| 110 | // BG: The default size and position of the first window |
| 111 | void GetDefaultWindowRect(wxRect *defRect) |
no test coverage detected