| 9825 | |
| 9826 | |
| 9827 | GuiControlType *GuiType::ControlOverrideBkColor(GuiControlType &aControl) |
| 9828 | // Caller has ensured that aControl.type is something for which the window's or tab control's background |
| 9829 | // should apply (e.g. Progress or Text). |
| 9830 | { |
| 9831 | GuiControlType *ptab_control; |
| 9832 | if (!mTabControlCount || !(ptab_control = FindTabControl(aControl.tab_control_index)) |
| 9833 | || ptab_control->background_color == CLR_INVALID) // Relies on short-circuit boolean order. |
| 9834 | return NULL; // Override not needed because control isn't on a tab, or it's tab has same color as window. |
| 9835 | if (GetParent(aControl.hwnd) != mHwnd) |
| 9836 | // Even if the control doesn't lie entirely within the tab control's display area, |
| 9837 | // it is only visible within that area due to the parent-child relationship. |
| 9838 | return ptab_control; |
| 9839 | // Does this control lie mostly inside the tab? Note that controls can belong to a tab page even though |
| 9840 | // they aren't physically located inside the page. |
| 9841 | RECT overlap_rect, tab_rect, control_rect; |
| 9842 | GetWindowRect(ptab_control->hwnd, &tab_rect); |
| 9843 | GetWindowRect(aControl.hwnd, &control_rect); |
| 9844 | IntersectRect(&overlap_rect, &tab_rect, &control_rect); |
| 9845 | // Returns true if more than 50% of control's area is inside the tab: |
| 9846 | return (overlap_rect.right - overlap_rect.left) * (overlap_rect.bottom - overlap_rect.top) |
| 9847 | > 0.5 * (control_rect.right - control_rect.left) * (control_rect.bottom - control_rect.top) |
| 9848 | ? ptab_control : NULL; |
| 9849 | } |
| 9850 | |
| 9851 | |
| 9852 |
nothing calls this directly
no outgoing calls
no test coverage detected