static void MB93493_UpdateRects (_THIS, int numrects, GAL_Rect *rects) { int i; RECT bound; pthread_mutex_lock (&this->hidden->lock); bound = this->hidden->update; for (i = 0; i < numrects; i++) { RECT rc; SetRect (&rc, rects[i].x, rects[i].y, rects[i].x + rects[i].w, rects[i].y + rects[i].h); if (IsRectEmpty (&bound)) bound = rc; else GetBoundRect (&bound, &bound, &rc); } if (!IsRectEmpty (&bound)) { if (IntersectRect (&bound, &bound, &g_rcScr)) { this->hidden->update = bound; this->hidden->dirty = TRUE; } } pthread_mutex_unlock (&this->hidden->lock); }
void cgFlyObject::Render() { #ifdef _DEBUG cgRect box; GetBoundRect(box); if (GetCamp() == cgFlyObjectCamp_Self) { cgRender::Get()->FillRect(box, 0xff00ff00); }else { cgRender::Get()->FillRect(box, 0xffffffff); } #endif }
static void QVFB_UpdateRects (_THIS, int numrects, GAL_Rect *rects) { int i; RECT bound = this->hidden->hdr->update; if (bound.right == -1) bound.right = 0; if (bound.bottom == -1) bound.bottom = 0; for (i = 0; i < numrects; i++) { RECT rc; SetRect (&rc, rects[i].x, rects[i].y, rects[i].x + rects[i].w, rects[i].y + rects[i].h); GetBoundRect (&bound, &bound, &rc); } this->hidden->hdr->update = bound; this->hidden->hdr->dirty = TRUE; }
BOOL CRectView::IntersectsWithRect(const Rect& rectangle) { return GetBoundRect().IntersectsWith(rectangle); }
BOOL CRectView::IsHighlighted(const Point& pointer) { return GetBoundRect().Contains(pointer); }
void CXTPMarkupVisual::Render(CXTPMarkupDrawingContext* drawingContext) { CRect rcClipBox = drawingContext->GetClipBox(); rcClipBox.OffsetRect(-m_ptVisualOffset); RECT rcIntersect; if (!::IntersectRect(&rcIntersect, GetBoundRect(), &rcClipBox)) { RenderClipped(drawingContext); return; } CRect rcLayoutClip(0, 0, 0, 0); BOOL bClipLayout = FALSE; if (GetLayoutClip(rcLayoutClip)) { if (rcLayoutClip.IsRectEmpty()) { RenderClipped(drawingContext); return; } rcClipBox.IntersectRect(rcClipBox, rcLayoutClip); if (!::IntersectRect(&rcIntersect, GetBoundRect(), &rcClipBox)) { RenderClipped(drawingContext); return; } bClipLayout = TRUE; } drawingContext->OffsetViewport(m_ptVisualOffset); HRGN hrgnClip = 0; if (bClipLayout) { hrgnClip = drawingContext->SaveClipRegion(); drawingContext->IntersectClipRect(rcLayoutClip); } OnRender(drawingContext); int nVisualCount = GetVisualChildrenCount(); for (int i = 0; i < nVisualCount; i++) { GetVisualChild(i)->Render(drawingContext); } if (IsKeyboardFocused()) { OnRenderFocusVisual(drawingContext); } if (hrgnClip != NULL) { drawingContext->RestoreClipRegion(hrgnClip); } drawingContext->OffsetViewport(-m_ptVisualOffset); }
int DrawTextEx (HDC hdc, const char* pText, int nCount, RECT* pRect, int indent, UINT nFormat) { PDC pdc; int n, nLines = 0, width = 0; BOOL bOutput = TRUE; int x, y; RECT rcDraw, rcOutput; int nTabWidth, tabs; SIZE size; int line_height; pdc = dc_HDC2PDC(hdc); if (nCount == -1) nCount = strlen (pText); line_height = pdc->pLogFont->size + pdc->alExtra + pdc->blExtra; if (nFormat & DT_TABSTOP) nTabWidth = HIWORD (nFormat) * (*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width) (pdc->pLogFont, pdc->pLogFont->sbc_devfont); else nTabWidth = pdc->tabstop * (*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width) (pdc->pLogFont, pdc->pLogFont->sbc_devfont); // Transfer logical to device to screen here. rcDraw = *pRect; coor_LP2SP(pdc, &rcDraw.left, &rcDraw.top); coor_LP2SP(pdc, &rcDraw.right, &rcDraw.bottom); NormalizeRect (&rcDraw); if (dc_IsGeneralHDC(hdc)) { pthread_mutex_lock (&pdc->pGCRInfo->lock); if (!dc_GenerateECRgn (pdc, FALSE)) bOutput = FALSE; } pthread_mutex_lock (&__mg_gdilock); // set graphics context. GAL_SetGC (pdc->gc); // Draw text here. if (nFormat & DT_CALCRECT) bOutput = FALSE; y = rcDraw.top; if (nFormat & DT_SINGLELINE) { if (nFormat & DT_BOTTOM) y = rcDraw.bottom - pdc->pLogFont->size; else if (nFormat & DT_VCENTER) y = rcDraw.top + ((RECTH (rcDraw) - pdc->pLogFont->size) >> 1); } while (nCount != 0) { int nOutput; int maxwidth; if (nLines == 0) { maxwidth = rcDraw.right - rcDraw.left - indent; if (maxwidth <= 0) { // new line y += pdc->pLogFont->size; nLines ++; continue; } } else maxwidth = rcDraw.right - rcDraw.left; gdi_start_new_line (pdc->pLogFont); tabs = txtGetOneLine (pdc, pText, nCount, nTabWidth, maxwidth, nFormat, &n); gdi_get_TextOut_extent (pdc, pdc->pLogFont, pText, n, &size); width = size.cx + tabs * nTabWidth; n += tabs; if ( (pText[n-1] == '\n' || pText[n-1] == '\r') && !(nFormat & DT_SINGLELINE) ) { int tmpx = 0, tmpy = 0; nOutput = n - 1; width -= gdi_width_one_char (pdc->pLogFont, pdc->pLogFont->sbc_devfont, pText + n - 1, 1, &tmpx, &tmpy); } else nOutput = n; if (nFormat & DT_RIGHT) x = rcDraw.right - width; else if (nFormat & DT_CENTER) x = rcDraw.left + ((RECTW (rcDraw) - width) >> 1); else x = rcDraw.left; x += (nLines ? 0 : indent); rcOutput.left = x; rcOutput.top = y; rcOutput.right = rcOutput.left + width; rcOutput.bottom = rcOutput.top + line_height; NormalizeRect(&rcOutput); if (nFormat & DT_CALCRECT) { if (nLines == 0) *pRect = rcOutput; else GetBoundRect (pRect, pRect, &rcOutput); } // draw one line if (bOutput && width > 0) { if (!dc_IsMemHDC(hdc)) ShowCursorForGDI(FALSE, &rcOutput); if (nFormat & DT_NOCLIP) txtDrawOneLine (pdc, pText, nOutput, x, y, &rcOutput, nFormat, nTabWidth); else { RECT rcClip; IntersectRect (&rcClip, &rcOutput, &rcDraw); txtDrawOneLine (pdc, pText, nOutput, x, y, &rcClip, nFormat, nTabWidth); } if (!dc_IsMemHDC(hdc)) ShowCursorForGDI (TRUE, &rcOutput); } pText += n; // new line y += line_height; nLines ++; // left characters nCount = nCount - n; }
static void this_mouse_handler(void* context, int message, WPARAM wParam, LPARAM lParam) { int x, y; int i = 0; DSPITEM* item; static int old_x = 0, old_y = 0; x = LOSWORD (lParam); y = HISWORD (lParam); switch(message) { case MSG_DT_LBUTTONDOWN: { item = icon_info.app_items; for(i = 0; i < icon_info.nr_apps; i++, item++) { if (PtInRect(&item->hot_spot_rc, x, y)) { icon_info.focus = i; old_x = x; old_y = y; SendMessage(HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)&item->hot_spot_rc); break; } } break; } case MSG_DT_LBUTTONUP: { icon_info.focus = 0xFFFF; SendMessage(HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0); break; } case MSG_DT_LBUTTONDBLCLK: { char buff [PATH_MAX + NAME_MAX + 1]; item = icon_info.app_items; for(i = 0; i < icon_info.nr_apps; i++, item++) { if (PtInRect(&item->hot_spot_rc, x, y)) { if(item->cdpath) { chdir(item->path); } strcpy (buff, item->path); strcat (buff, item->name); exec_app_name(buff, item->name, "-layer"); break; } } break; } case MSG_DT_MOUSEMOVE: { RECT rc; if (icon_info.focus == 0xFFFF) break; item = icon_info.app_items; for(i = 0; i < icon_info.nr_apps; i++, item++) { if (i == icon_info.focus ) { GetBoundRect(&rc, &item->text_rc, &item->hot_spot_rc); item->hot_spot_rc.left += x - old_x; item->hot_spot_rc.right += x - old_x; item->hot_spot_rc.top += y - old_y; item->hot_spot_rc.bottom += y - old_y; item->text_rc.left += x - old_x; item->text_rc.right += x - old_x; item->text_rc.top += y - old_y; item->text_rc.bottom += y - old_y; old_x = x; old_y = y; GetBoundRect(&rc, &rc, &item->hot_spot_rc); GetBoundRect(&rc, &rc, &item->text_rc); SendMessage(HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)&rc); } } break; } case MSG_DT_RBUTTONUP: { BOOL flag = FALSE; item = icon_info.app_items; for(i = 0; i < icon_info.nr_apps; i++, item++) { if (PtInRect(&item->hot_spot_rc, x, y)) { icon_info.focus = i; SendMessage(HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)&item->hot_spot_rc); TrackPopupMenu (((Context *)context)->icon_menu, TPM_DEFAULT, x, y, HWND_DESKTOP); flag = TRUE; break; } } if(!flag) TrackPopupMenu (((Context *)context)->hmenu, TPM_DEFAULT, x, y, HWND_DESKTOP); break; } } }