コード例 #1
0
// Computes the Rect where the menu bar is drawn in window coordinates
void cef_dark_aero_window::ComputeMenuBarRect(RECT& rect) const
{
    if (CanUseAeroGlass()) {
        RECT rectClient;
        RECT rectCaption;

        GetRealClientRect(&rectClient);

        if (IsZoomed()) {
            ComputeWindowCaptionRect(rectCaption);
            rect.top = rectCaption.bottom;
        } else {
            rect.top = ::GetSystemMetrics(SM_CYFRAME) + mNcMetrics.iCaptionHeight + 1;
        }
        rect.bottom = rectClient.top - 1;

        rect.left = rectClient.left;
        rect.right = rectClient.right;
    } else {
        cef_dark_window::ComputeMenuBarRect(rect);
    }
}
コード例 #2
0
// Computes the Rect where the System Icon is drawn in window coordinates
void cef_dark_aero_window::ComputeWindowIconRect(RECT& rect) const
{
	if (CanUseAeroGlass()) {
		int top = ::kWindowFrameSize;
		int left = ::kWindowFrameSize;

		if (IsZoomed()) {
			top = ::kSystemIconZoomFactorCY;
			left = ::kSystemIconZoomFactorCX;
		}

		::SetRectEmpty(&rect);
		rect.top =  top;
		rect.left = left;
		rect.bottom = rect.top + ::GetSystemMetrics(SM_CYSMICON);
		rect.right = rect.left + ::GetSystemMetrics(SM_CXSMICON);
		
		AdjustRectForAutoHideBars(&rect);
	} else {
		cef_dark_window::ComputeWindowIconRect(rect);
	}
}
コード例 #3
0
// Computes the Rect where the window caption is drawn in window coordinates
void cef_dark_aero_window::ComputeWindowCaptionRect(RECT& rect) const
{
	if (CanUseAeroGlass()) {
		RECT wr;
		GetWindowRect(&wr);

		rect.top = ::kWindowFrameSize;
		rect.bottom = rect.top + mNcMetrics.iCaptionHeight;

		RECT ir;
		ComputeWindowIconRect(ir);

		RECT mr;
		ComputeMinimizeButtonRect(mr);

		rect.left = ir.right + ::kWindowFrameSize;
		rect.right = mr.left - ::kWindowFrameSize;

		AdjustRectForAutoHideBars(&rect);
	} else {
		cef_dark_window::ComputeWindowCaptionRect(rect);
	}
}
コード例 #4
0
// WM_NCCALCSIZE handler.  
//  Basically tells the system that there is no non-client area
BOOL cef_dark_aero_window::HandleNcCalcSize(BOOL calcValidRects, NCCALCSIZE_PARAMS* pncsp, LRESULT* lr)
{
    *lr = 0;

    if (CanUseAeroGlass() && IsZoomed()) 
    {
        WORD edges = WindowsTaskBar::GetAutoHideEdges(mWnd);
        // adjust for auto-hide task bar
        if (edges & WindowsTaskBar::BOTTOM_EDGE) {
            pncsp->rgrc[0].bottom -= kAutoHideTaskBarSize;
            if (calcValidRects) {
                pncsp->rgrc[1].bottom -= kAutoHideTaskBarSize;
            }
        }
        if (edges & WindowsTaskBar::TOP_EDGE) {
            pncsp->rgrc[0].top += kAutoHideTaskBarSize;
            if (calcValidRects) {
                pncsp->rgrc[1].top += kAutoHideTaskBarSize;
            }
        }
        if (edges & WindowsTaskBar::RIGHT_EDGE) {
            pncsp->rgrc[0].right -= kAutoHideTaskBarSize;
            if (calcValidRects) {
                pncsp->rgrc[1].right -= kAutoHideTaskBarSize;
            }
        }
        if (edges & WindowsTaskBar::LEFT_EDGE) {
            pncsp->rgrc[0].left += kAutoHideTaskBarSize;
            if (calcValidRects) {
                pncsp->rgrc[1].left += kAutoHideTaskBarSize;
            }
        }
    }

    *lr |= IsZoomed() ? WVR_REDRAW : 0;
    return TRUE;
}
コード例 #5
0
// Redraws the non-client area
void cef_dark_aero_window::DoPaintNonClientArea(HDC hdc)
{
    if (CanUseAeroGlass()) {
        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);
    } else {
        cef_dark_window::DoPaintNonClientArea(hdc);
    }
}