Beispiel #1
0
static VOID
MonSelRepaintMonitor(IN PMONITORSELWND infoPtr,
                     IN DWORD Index)
{
    RECT rc;
    BOOL NoRepaint = FALSE;

    if (Index < infoPtr->MonitorsCount)
    {
        if (Index == (DWORD)infoPtr->DraggingMonitor)
        {
            if (infoPtr->IsDraggingMonitor)
            {
                MonSelRectToScreen(infoPtr,
                                   &infoPtr->rcDragging,
                                   &rc);
            }
            else
                NoRepaint = TRUE;
        }
        else
        {
            MonSelRectToScreen(infoPtr,
                               &infoPtr->Monitors[Index].rc,
                               &rc);
        }

        if (!NoRepaint)
        {
            InvalidateRect(infoPtr->hSelf,
                           &rc,
                           TRUE);
        }
    }
}
Beispiel #2
0
static INT
MonSelGetMonitorRect(IN OUT PMONITORSELWND infoPtr,
                     IN INT Index,
                     OUT PRECT prc)
{
    RECT rc, rcClient;

    if (Index < 0 || (UINT)Index >= infoPtr->MonitorsCount)
        return -1;

    if (!infoPtr->CanDisplay)
        return 0;

    MonSelRectToScreen(infoPtr,
                       &infoPtr->Monitors[Index].rc,
                       prc);

    rcClient.left = rcClient.top = 0;
    rcClient.right = infoPtr->ClientSize.cx;
    rcClient.bottom = infoPtr->ClientSize.cy;

    return IntersectRect(&rc,
                         &rcClient,
                         prc) != FALSE;
}
Beispiel #3
0
static VOID
MonSelRepaint(IN PMONITORSELWND infoPtr)
{
    RECT rc;

    MonSelRectToScreen(infoPtr,
                       &infoPtr->rcMonitors,
                       &rc);
    InvalidateRect(infoPtr->hSelf,
                   &rc,
                   TRUE);

    if (!EqualRect(&infoPtr->rcMonitors, &infoPtr->rcOldMonitors) &&
        infoPtr->rcOldMonitors.right != infoPtr->rcOldMonitors.left)
    {
        MonSelRectToScreen(infoPtr, &infoPtr->rcOldMonitors, &rc);
        InvalidateRect(infoPtr->hSelf, &rc, TRUE);
        infoPtr->rcOldMonitors = infoPtr->rcMonitors;
    }
}
Beispiel #4
0
static VOID
MonSelRepaint(IN PMONITORSELWND infoPtr)
{
    RECT rc;

    MonSelRectToScreen(infoPtr,
                       &infoPtr->rcMonitors,
                       &rc);
    InvalidateRect(infoPtr->hSelf,
                   &rc,
                   TRUE);
}
Beispiel #5
0
static VOID
MonSelPaint(IN OUT PMONITORSELWND infoPtr,
            IN HDC hDC,
            IN const RECT *prcUpdate)
{
    COLORREF crPrevText;
    HBRUSH hbBk, hbOldBk;
    HPEN hpFg, hpOldFg;
    DWORD Index;
    RECT rc, rctmp;
    INT iPrevBkMode;
    BOOL bHideNumber;

    bHideNumber = (infoPtr->ControlExStyle & MSLM_EX_HIDENUMBERS) ||
                  ((infoPtr->MonitorsCount == 1) && (infoPtr->ControlExStyle & MSLM_EX_HIDENUMBERONSINGLE));

    hbBk = GetSysColorBrush(COLOR_BACKGROUND);
    hpFg = CreatePen(PS_SOLID,
                     0,
                     GetSysColor(COLOR_HIGHLIGHTTEXT));

    hbOldBk = SelectObject(hDC,
                           hbBk);
    hpOldFg = SelectObject(hDC,
                           hpFg);
    iPrevBkMode = SetBkMode(hDC,
                            TRANSPARENT);
    crPrevText = SetTextColor(hDC,
                              GetSysColor(COLOR_HIGHLIGHTTEXT));

    for (Index = 0; Index < infoPtr->MonitorsCount; Index++)
    {
        if (infoPtr->IsDraggingMonitor &&
                (DWORD)infoPtr->DraggingMonitor == Index)
        {
            continue;
        }

        MonSelRectToScreen(infoPtr,
                           &infoPtr->Monitors[Index].rc,
                           &rc);

        if (IntersectRect(&rctmp,
                          &rc,
                          prcUpdate))
        {
            MonSelPaintMonitor(infoPtr,
                               hDC,
                               Index,
                               &rc,
                               crPrevText,
                               bHideNumber);
        }
    }

    /* Paint the dragging monitor last */
    if (infoPtr->IsDraggingMonitor &&
            infoPtr->DraggingMonitor >= 0)
    {
        MonSelRectToScreen(infoPtr,
                           &infoPtr->rcDragging,
                           &rc);

        if (IntersectRect(&rctmp,
                          &rc,
                          prcUpdate))
        {
            MonSelPaintMonitor(infoPtr,
                               hDC,
                               (DWORD)infoPtr->DraggingMonitor,
                               &rc,
                               crPrevText,
                               bHideNumber);
        }
    }

    SetTextColor(hDC,
                 crPrevText);
    SetBkMode(hDC,
              iPrevBkMode);
    SelectObject(hDC,
                 hpOldFg);
    SelectObject(hDC,
                 hbOldBk);

    DeleteObject(hpFg);
}