void cef_dark_aero_window::DrawMenuBar(HDC hdc) { RECT rectWindow ; ComputeLogicalWindowRect (rectWindow) ; ::ExcludeClipRect (hdc, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom); RECT rectRequired; ComputeRequiredMenuRect(rectRequired); // No menu == nothing to draw if (::RectHeight(rectRequired) > 0) { RECT rectMenu; ComputeMenuBarRect(rectMenu); HRGN hrgnUpdate = ::CreateRectRgnIndirect(&rectMenu); if (::SelectClipRgn(hdc, hrgnUpdate) != NULLREGION) { DoDrawFrame(hdc); // Draw menu bar background DoDrawMenuBar(hdc); // DraW menu items } ::DeleteObject(hrgnUpdate); } }
// Paints the entire non-client area. // Creates an in-memory DC to draw on to reduce flicker void cef_dark_window::DoPaintNonClientArea(HDC hdc) { EnforceMenuBackground(); HDC hdcOrig = hdc; RECT rectWindow; GetWindowRect(&rectWindow); int Width = ::RectWidth(rectWindow); int Height = ::RectHeight(rectWindow); HDC dcMem = ::CreateCompatibleDC(hdc); HBITMAP bm = ::CreateCompatibleBitmap(hdc, Width, Height); HGDIOBJ bmOld = ::SelectObject(dcMem, bm); hdc = dcMem; InitDeviceContext(hdc); InitDeviceContext(hdcOrig); DoDrawFrame(hdc); DoDrawSystemMenuIcon(hdc); DoDrawTitlebarText(hdc); DoDrawSystemIcons(hdc); DoDrawMenuBar(hdc); ::BitBlt(hdcOrig, 0, 0, Width, Height, dcMem, 0, 0, SRCCOPY); ::SelectObject(dcMem, bmOld); ::DeleteObject(bm); ::DeleteDC(dcMem); }