virtual void draw(QPainter &painter, bool enabled) { int w = this->width(); QPen pen; QBrush brush; if(enabled) { if ( w < 0 ) { pen = m_reversePen; brush = m_reverseBrush; } else { pen = m_pen; brush = m_brush; } } else { pen = QPen(Qt::lightGray); brush = QBrush(Qt::lightGray); } painter.setPen(pen); painter.setBrush(brush); painter.setRenderHint(QPainter::Antialiasing); painter.drawRect(m_left, 0, w, drawingArea().height()-1); }
virtual void draw(QPainter &painter, bool /*enabled*/) { int height = drawingArea().height()-1; int top = height * m_verticalPadding; int handleHeight = height - 2*top; painter.setRenderHint(QPainter::Antialiasing); painter.setPen(m_pen); painter.setBrush(m_brush); painter.drawRect(m_pos - halfWidth(), top, m_width, handleHeight); }
void EflViewportHandler::display(const IntRect& rect, const IntPoint& viewPosition) { WebCore::TransformationMatrix matrix; matrix.setMatrix(m_scaleFactor, 0, 0, m_scaleFactor, -m_visibleContentRect.x() + viewPosition.x(), -m_visibleContentRect.y() + viewPosition.y()); LayerTreeRenderer* renderer = drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer(); renderer->setActive(true); renderer->syncRemoteContent(); IntRect clipRect(rect); clipRect.move(viewPosition.x(), viewPosition.y()); renderer->paintToCurrentGLContext(matrix, 1, clipRect); }
virtual bool pick(const QPoint &point) const { bool picked = false; int height = drawingArea().height()-1; int top = height * m_verticalPadding; int handleHeight = height - 2*top; if ( abs(point.x() - m_pos) <= (halfWidth() + m_tolerance) && (top+handleHeight) >= point.y() && point.y() >= top ) { picked = true; } return picked; }
void EflViewportHandler::setVisibleContentsRect(const IntPoint& newScrollPosition, float newScale, const FloatPoint& trajectory) { m_scaleFactor = newScale; m_visibleContentRect = IntRect(newScrollPosition, m_viewportSize); // Move visibleContentRect inside contentsRect when visibleContentRect goes outside contentsRect. IntSize contentsSize = m_contentsSize; contentsSize.scale(m_scaleFactor); if (m_visibleContentRect.x() > contentsSize.width() - m_visibleContentRect.width()) m_visibleContentRect.setX(contentsSize.width() - m_visibleContentRect.width()); if (m_visibleContentRect.x() < 0) m_visibleContentRect.setX(0); if (m_visibleContentRect.y() > contentsSize.height() - m_visibleContentRect.height()) m_visibleContentRect.setY(contentsSize.height() - m_visibleContentRect.height()); if (m_visibleContentRect.y() < 0) m_visibleContentRect.setY(0); FloatRect mapRectToWebContent = m_visibleContentRect; mapRectToWebContent.scale(1 / m_scaleFactor); drawingArea()->setVisibleContentsRect(enclosingIntRect(mapRectToWebContent), m_scaleFactor, trajectory); }
void TFuncSpecView::Paint(TDC& dc, bool erase, TRect& rect) { TSwitchMinApp* theApp = TYPESAFE_DOWNCAST(GetApplication(), TSwitchMinApp); if (theApp) { // Only paint if we're printing and we have something to paint, otherwise do nothing. // if (theApp->Printing && theApp->Printer && !rect.IsEmpty()) { // Use pageSize to get the size of the window to render into. For a Window it's the client area, // for a printer it's the printer DC dimensions and for print preview it's the layout window. // TSize pageSize(rect.right - rect.left, rect.bottom - rect.top); TPrintDialog::TData& printerData = theApp->Printer->GetSetup(); // Get area we can draw in TRect drawingArea(swdoc->PaintHeader(dc, rect, "", 0, 0, false), rect.BottomRight()); TEXTMETRIC tm; dc.SelectObject(TFont("Arial", -12)); if (!dc.GetTextMetrics(tm)) { dc.SelectObject(TFont("Arial", -12)); dc.GetTextMetrics(tm); } int fHeight=tm.tmHeight+tm.tmExternalLeading; unsigned long inputs=swdoc->GetSystem()->GetInputs(); XPosVector xpos; uint divider; char* data; Print_CreateWidths(xpos, divider, dc); if (xpos.back().x < rect.Size().cx) { // put space in structure to stretch across page uint spacing=(rect.Size().cx - xpos.back().x)/(xpos.size()+1); uint space_inc=spacing; for(XPosVector::size_type i=0; i<xpos.size(); i++) { if (i==inputs) { // after inputs section, increase divider divider += space_inc; space_inc += spacing; } xpos[i].x += space_inc; space_inc += spacing; } } data=new char[xpos.size()]; unsigned long PagesDown=1+pow(2,inputs)/( (drawingArea.Size().cy/fHeight) - 2); // 2 lines for header and horz divider unsigned long PagesAcross=1+xpos.back().x/drawingArea.Size().cx; unsigned long Pages=1+PagesDown*PagesAcross; // Compute the number of pages to print. // printerData.MinPage = 1; printerData.MaxPage = Pages; int fromPage = printerData.FromPage == -1 ? 1 : printerData.FromPage; int toPage = printerData.ToPage == -1 ? 1 : printerData.ToPage; int currentPage = fromPage; TPoint p; dc.SelectObject(TPen(TColor::Black)); while (currentPage <= toPage) { swdoc->PaintHeader(dc, rect, "Specification", currentPage, Pages, true); if (currentPage==1) Print_Summary(dc, drawingArea); else { // Calculate origin of line by page number // x int col=((currentPage-2) ) % PagesAcross; p.x=drawingArea.left - col * drawingArea.Size().cx; // y int row=floor((currentPage-2)/PagesAcross); p.y=drawingArea.top/* - row * drawingArea.Size().cy*/; // Calculate starting and ending input states CELL_TYPE state, stateEnd; state=(row*(drawingArea.Size().cy-fHeight))/fHeight; stateEnd=state+(drawingArea.Size().cy-fHeight)/fHeight; if (stateEnd >= (pow(2,inputs)-1) ) stateEnd=pow(2,inputs)-1; // // Draw header and lines // Vertical if ( ((p.x+divider) > drawingArea.left) && ((p.x+divider)<drawingArea.right) ) { dc.MoveTo(p.x+divider, p.y); dc.LineTo(p.x+divider, p.y+((stateEnd-state)+3)*fHeight); } // Labels for(XPosVector::size_type i=0; i<xpos.size(); i++) dc.TextOut(TPoint(xpos[i].x, p.y), xpos[i].s.c_str()); p.y += fHeight; // Horizontal dc.MoveTo(drawingArea.left, p.y + fHeight/2); dc.LineTo(p.x+xpos.back().x, p.y + fHeight/2); p.y += fHeight; // // Draw each line while(state <= stateEnd) { Print_GenerateLine(data, state); Print_Line(dc, p, xpos, data); p.y += fHeight; state++; } } currentPage++; } delete[] data; } else { // INSERT>> Normal painting code goes here. wTabs->InvalidateRect(rect, erase); } } }
void PageViewportControllerClientEfl::didChangeContentsSize(const WebCore::IntSize& contentsSize) { drawingArea()->coordinatedLayerTreeHostProxy()->setContentsSize(contentsSize); m_view->update(); }
void PageViewportControllerClientEfl::setRendererActive(bool active) { drawingArea()->coordinatedLayerTreeHostProxy()->coordinatedGraphicsScene()->setActive(active); }
void PageViewportControllerClientEfl::setRendererActive(bool active) { drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(active); }
void EflViewportHandler::setRendererActive(bool active) { drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(active); }
void EflViewportHandler::didChangeContentsSize(const WebCore::IntSize& size) { m_contentsSize = size; setVisibleContentsRect(m_visibleContentRect.location(), m_scaleFactor, FloatPoint()); drawingArea()->layerTreeCoordinatorProxy()->setContentsSize(WebCore::FloatSize(size.width(), size.height())); }
int xPosMax() { return drawingArea().width() - halfWidth() - 1; }