| 163 | // --------------------------------------------------------------------------- |
| 164 | |
| 165 | void CGrWnd::DrawCaption(BOOL active) { |
| 166 | CDC *dc; |
| 167 | DWORD dwstyle; |
| 168 | RECT winrect, caprect; |
| 169 | int c_left = 0, c_top = 0; // caption bar's coordinates in window |
| 170 | |
| 171 | // get needed info |
| 172 | GetWindowRect(&winrect); |
| 173 | dwstyle = GetStyle(); |
| 174 | if ((dwstyle & WS_CAPTION) != WS_CAPTION) |
| 175 | return; |
| 176 | dc = GetWindowDC(); |
| 177 | |
| 178 | // calculate c_left, c_top |
| 179 | if (dwstyle & WS_THICKFRAME) { |
| 180 | c_left += GetSystemMetrics(SM_CXSIZEFRAME); |
| 181 | c_top += GetSystemMetrics(SM_CYSIZEFRAME); |
| 182 | } |
| 183 | if (dwstyle & WS_SYSMENU) { |
| 184 | c_left += GetSystemMetrics(SM_CXSIZE); |
| 185 | } |
| 186 | caprect.left = c_left; |
| 187 | caprect.top = c_top; |
| 188 | |
| 189 | // calucation c_right, c_bottom. |
| 190 | caprect.right = winrect.right - winrect.left - (2 * c_left); |
| 191 | if (dwstyle & WS_THICKFRAME) { |
| 192 | caprect.right -= GetSystemMetrics(SM_CXSIZEFRAME); |
| 193 | } |
| 194 | caprect.bottom = GetSystemMetrics(SM_CYSIZE); |
| 195 | |
| 196 | if (active) { |
| 197 | dc->SetBkColor(GetSysColor(COLOR_ACTIVECAPTION)); |
| 198 | dc->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT)); |
| 199 | } else { |
| 200 | dc->SetBkColor(GetSysColor(COLOR_INACTIVECAPTION)); |
| 201 | dc->SetTextColor(GetSysColor(COLOR_INACTIVECAPTIONTEXT)); |
| 202 | } |
| 203 | |
| 204 | dc->DrawText(m_Name, -1, &caprect, DT_LEFT); |
| 205 | |
| 206 | ReleaseDC(dc); |
| 207 | } |
| 208 | |
| 209 | BOOL CGrWnd::OnNcActivate(BOOL bActive) { |
| 210 | CWnd::OnNcActivate(bActive); |
nothing calls this directly
no test coverage detected