Ejemplo n.º 1
0
void QVUMeter::paintEvent(QPaintEvent *)
{
    paintBorder();
    paintBar();
    paintValue();

}
Ejemplo n.º 2
0
void Colorsel::paintEvent(QPaintEvent *)
{
    paintBorder();
    paintBar();
    paintValue();
    paintText();
}
Ejemplo n.º 3
0
void QProg::paintEvent(QPaintEvent *)
{
    paintBorder();
    paintBar();
    paintLine();
    paintValue();
}
Ejemplo n.º 4
0
void BelowsEnh::paintEvent(QPaintEvent *)
{
    paintBorder();
    paintBar();
    paintValue();

}
Ejemplo n.º 5
0
void QPower::paintEvent(QPaintEvent *)
{
    paintBorder();

    if (pow_state)
        paintPowerOn();

    else
        paintPowerOff();
}
Ejemplo n.º 6
0
void controlUC::paint(HDC hDC, const RECT& rcPaint)
{
	if( !::IntersectRect(&m_rcPaint, &rcPaint, &m_rcItem) ) return;

	// »æÖÆÑ­Ðò£º±³¾°ÑÕÉ«->±³¾°Í¼->״̬ͼ->Îı¾->±ß¿ò
	if( m_cxyBorderRound.cx > 0 || m_cxyBorderRound.cy > 0 ) {
		//renderClip roundClip;
		//renderClip::generateRoundClip(hDC, m_rcPaint,  m_rcItem, m_cxyBorderRound.cx, m_cxyBorderRound.cy, roundClip);
		paintBkColor(hDC);
		paintBkImage(hDC);
		paintStatusImage(hDC);
		paintText(hDC);
		paintBorder(hDC);
	}
	else {
		paintBkColor(hDC);
		paintBkImage(hDC);
		paintStatusImage(hDC);
		paintText(hDC);
		paintBorder(hDC);
	}
}
Ejemplo n.º 7
0
void KWCanvasBase::paint(QPainter &painter, const QRectF &paintRect)
{
    painter.translate(-m_documentOffset);

    static int iteration = 0;
    iteration++;

    if (m_viewMode->hasPages()) {

        int pageContentArea = 0;
        if (!m_cacheEnabled || !m_pageCacheManager) { // no caching, simple case

            QList<KWViewMode::ViewMap> map =
                    m_viewMode->mapExposedRects(paintRect.translated(m_documentOffset),
                                                viewConverter());
            foreach (KWViewMode::ViewMap vm, map) {
                painter.save();

                // Set up the painter to clip the part of the canvas that contains the rect.
                painter.translate(vm.distance.x(), vm.distance.y());
                vm.clipRect = vm.clipRect.adjusted(-1, -1, 1, 1);
                painter.setClipRect(vm.clipRect);

                // Paint the background of the page.
                QColor color = Qt::white;
#ifdef DEBUG_REPAINT
                color = QColor(random() % 255, random() % 255, random() % 255);
#endif
                painter.fillRect(vm.clipRect, QBrush(color));

                // Paint the contents of the page.
                painter.setRenderHint(QPainter::Antialiasing);
                m_shapeManager->paint(painter, *(viewConverter()), false); // Paint all shapes
                paintBorder(painter, vm);

                // Paint the page decorations: shadow, etc.
                paintPageDecorations(painter, vm);

                // Paint the grid
                paintGrid(painter, vm);

                // paint whatever the tool wants to paint
                m_toolProxy->paint(painter, *(viewConverter()));
                painter.restore();

                int contentArea = vm.clipRect.width() * vm.clipRect.height();
                if (contentArea > pageContentArea) {
                    pageContentArea = contentArea;
                }
            }
Ejemplo n.º 8
0
void PopupContainer::paint(GraphicsContext* gc, const IntRect& rect)
{
    // adjust coords for scrolled frame
    IntRect r = intersection(rect, frameRect());
    int tx = x();
    int ty = y();

    r.move(-tx, -ty);

    gc->translate(static_cast<float>(tx), static_cast<float>(ty));
    m_listBox->paint(gc, r);
    gc->translate(-static_cast<float>(tx), -static_cast<float>(ty));

    paintBorder(gc, rect);
}
Ejemplo n.º 9
0
int CScreenSetup::exec(CMenuTarget* parent, const std::string &)
{
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	int res = menu_return::RETURN_REPAINT;

	if (parent)
	{
		parent->hide();
	}

	x_coord[0] = g_settings.screen_StartX;
	x_coord[1] = g_settings.screen_EndX;
	y_coord[0] = g_settings.screen_StartY;
	y_coord[1] = g_settings.screen_EndY;

	paint();
	
#ifdef FB_BLIT
	frameBuffer->blit();
#endif	

	selected = 0;

	unsigned long long timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);

	bool loop=true;
	while (loop)
	{
		g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true );

		if ( msg <= CRCInput::RC_MaxRC )
			timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);

		switch ( msg )
		{
			case CRCInput::RC_ok:
				// abspeichern
				g_settings.screen_StartX = x_coord[0];
				g_settings.screen_EndX = x_coord[1];
				g_settings.screen_StartY = y_coord[0];
				g_settings.screen_EndY = y_coord[1];
				loop = false;
				break;

			case CRCInput::RC_home:
				if ( ( ( g_settings.screen_StartX != x_coord[0] ) || ( g_settings.screen_EndX != x_coord[1] ) || ( g_settings.screen_StartY != y_coord[0] ) || ( g_settings.screen_EndY != y_coord[1] ) ) &&
						(ShowLocalizedMessage(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel))
					break;

			case CRCInput::RC_timeout:
				loop = false;
				break;

			case CRCInput::RC_red:
			case CRCInput::RC_green:
				{
					selected = ( msg == CRCInput::RC_green ) ? 1 : 0 ;

					frameBuffer->paintBoxRel(x,y, BoxWidth,BoxHeight/2, (selected==0)? COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);
					frameBuffer->paintBoxRel(x,y+BoxHeight/2, BoxWidth,BoxHeight/2, (selected==1)? COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);

					g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+30,y+BoxHeight/2, BoxWidth, g_Locale->getText(LOCALE_SCREENSETUP_UPPERLEFT ), (selected == 0)?COL_MENUCONTENTSELECTED:COL_MENUCONTENT, 0, true); // UTF-8

					g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+30,y+BoxHeight, BoxWidth, g_Locale->getText(LOCALE_SCREENSETUP_LOWERRIGHT), (selected == 1)?COL_MENUCONTENTSELECTED:COL_MENUCONTENT, 0, true); // UTF-8

					paintIcons();
					break;
				}
				
			case CRCInput::RC_up:
				{
					y_coord[selected]--;

					int min = ( selected == 0 ) ? 0 : 400;
					if ( y_coord[selected] < min )
						y_coord[selected] = min ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_down:
				{
					y_coord[selected]++;

					//int max = ( selected == 0 ) ? 200 : 575;
					int max = ( selected == 0 ) ? 200 : frameBuffer->getScreenHeight(true)-1;
					//printf("selected %d y %d max %d\n", selected, y_coord[selected], max);
					if ( y_coord[selected] > max )
						y_coord[selected] = max ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_left:
				{
					x_coord[selected]--;

					int min = ( selected == 0 ) ? 0 : 400;
					if ( x_coord[selected] < min )
						x_coord[selected] = min ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_right:
				{
					x_coord[selected]++;

					//int max = ( selected == 0 ) ? 200 : 719;
					int max = ( selected == 0 ) ? 200 : frameBuffer->getScreenWidth(true)-1;
					//printf("selected %d y %d max %d\n", selected, x_coord[selected], max);
					if ( x_coord[selected] > max )
						x_coord[selected] = max ;
					else
						paintBorder( selected );
					break;
				}
				
			case CRCInput::RC_favorites:
			case CRCInput::RC_sat:
				break;

			default:
				if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
				{
					loop = false;
					res = menu_return::RETURN_EXIT_ALL;
				}
		}
#ifdef FB_BLIT
		frameBuffer->blit();
#endif		
	}

	hide();
	return res;
}
int CScreenSetup::exec(CMenuTarget* parent, const std::string &)
{
	neutrino_msg_t      msg;
	neutrino_msg_data_t data;

	int res = menu_return::RETURN_REPAINT;

	if (parent)
	{
		parent->hide();
	}

	x_box = 15*5;
	y_box = frameBuffer->getScreenHeight(true) / 2;

        int icol_w, icol_h;
        frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);

	BoxHeight = std::max(icol_h+4, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
	BoxWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCREENSETUP_UPPERLEFT));

	int tmp = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(g_Locale->getText(LOCALE_SCREENSETUP_LOWERRIGHT));
	if (tmp > BoxWidth)
		BoxWidth = tmp;

	BoxWidth += 10 + icol_w;

	x_coord[0] = g_settings.screen_StartX;
	x_coord[1] = g_settings.screen_EndX;
	y_coord[0] = g_settings.screen_StartY;
	y_coord[1] = g_settings.screen_EndY;

	paint();

	selected = 0;

	uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);

	bool loop=true;
	while (loop)
	{
		g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd, true );

		if ( msg <= CRCInput::RC_MaxRC )
			timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings
::TIMING_MENU]);

		switch ( msg )
		{
			case CRCInput::RC_ok:
				// abspeichern
				g_settings.screen_StartX = x_coord[0];
				g_settings.screen_EndX = x_coord[1];
				g_settings.screen_StartY = y_coord[0];
				g_settings.screen_EndY = y_coord[1];
				if(g_settings.screen_preset) {
					g_settings.screen_StartX_lcd = g_settings.screen_StartX;
					g_settings.screen_StartY_lcd = g_settings.screen_StartY;
					g_settings.screen_EndX_lcd = g_settings.screen_EndX;
					g_settings.screen_EndY_lcd = g_settings.screen_EndY;
				} else {
					g_settings.screen_StartX_crt = g_settings.screen_StartX;
					g_settings.screen_StartY_crt = g_settings.screen_StartY;
					g_settings.screen_EndX_crt = g_settings.screen_EndX;
					g_settings.screen_EndY_crt = g_settings.screen_EndY;
				}
				if (g_InfoViewer) /* recalc infobar position */
					g_InfoViewer->start();
				loop = false;
				break;

			case CRCInput::RC_home:
				if ( ( ( g_settings.screen_StartX != x_coord[0] ) ||
							( g_settings.screen_EndX != x_coord[1] ) ||
							( g_settings.screen_StartY != y_coord[0] ) ||
							( g_settings.screen_EndY != y_coord[1] ) ) &&
						(ShowMsg(LOCALE_VIDEOMENU_SCREENSETUP, LOCALE_MESSAGEBOX_DISCARD, CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel))
					break;

			case CRCInput::RC_timeout:
				loop = false;
				break;

			case CRCInput::RC_red:
			case CRCInput::RC_green:
				{
					selected = ( msg == CRCInput::RC_green ) ? 1 : 0 ;

					frameBuffer->paintBoxRel(x_box, y_box, BoxWidth, BoxHeight,
						(selected == 0)?COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);
					frameBuffer->paintBoxRel(x_box, y_box + BoxHeight, BoxWidth, BoxHeight,
						(selected ==1 )?COL_MENUCONTENTSELECTED_PLUS_0:COL_MENUCONTENT_PLUS_0);

					paintIcons(selected);
					break;
				}
			case CRCInput::RC_up:
			{

				int min = (selected == 0) ? 0 : 400;
				if (y_coord[selected] <= min)
					y_coord[selected] = min;
				else
				{
					unpaintBorder(selected);
					y_coord[selected]--;
					paintBorder(selected);
				}
				break;
			}
			case CRCInput::RC_down:
			{
				int max = (selected == 0 )? 200 : frameBuffer->getScreenHeight(true) - 1;
				if (y_coord[selected] >= max)
					y_coord[selected] = max;
				else
				{
					unpaintBorder(selected);
					y_coord[selected]++;
					paintBorder(selected);
				}
				break;
			}
			case CRCInput::RC_left:
			{
				int min = (selected == 0) ? 0 : 400;
				if (x_coord[selected] <= min)
					x_coord[selected] = min;
				else
				{
					unpaintBorder(selected);
					x_coord[selected]--;
					paintBorder( selected );
				}
				break;
			}
			case CRCInput::RC_right:
			{
				int max = (selected == 0) ? 200 : frameBuffer->getScreenWidth(true) - 1;
				if (x_coord[selected] >= max)
					x_coord[selected] = max;
				else
				{
					unpaintBorder(selected);
					x_coord[selected]++;
					paintBorder( selected );
				}
				break;
			}
			case CRCInput::RC_favorites:
			case CRCInput::RC_sat:
				break;

			default:
				if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
				{
					loop = false;
					res = menu_return::RETURN_EXIT_ALL;
				}
		}

	}

	hide();
	return res;
}
Ejemplo n.º 11
0
void QSlide::paintEvent(QPaintEvent *)
{
    paintBorder();
    paintText();
    paintGrid();
}
Ejemplo n.º 12
0
	void Component::paint(Graphics& g) const
	{
		g.pushMatrix();

		g.translate(getBounds().x,getBounds().y);

		if(rotation != 0.0f)
		{
			int x = getBounds().width /2;
			int y = getBounds().height/2;
		
			g.translate(x,y);
			g.rotate(rotation);
			g.translate(-x,-y);
		}

		// we only paint if its state is visible.
		if(isVisible() && rec.width > 0 && rec.height > 0)
		{
			bool storeDepth = false;

			if(isContainer())
			{
				// we need to store the current depth value,
				// so that it affects all children of this Component.
				storeDepth = g.pushDepth(depth);
			}

			// if this Component is currently not valid, validate it.
			if(!isValid())
			{
				validate();
			}

			if(SelectionManager::getInstance().getRenderMode() == SelectionManager::NORMAL)
			{
				// we're in the normal render mode, so check for transparency,
				// and paint everything
				bool storeTransparency = false;

				storeTransparency = g.pushTransparency(transparency);

				//displayList = g.
				//if(!isDisplayListCompiled)
				//{
				//	util::DisplayList compile(displayList);

					// first paint the background
					paintComponent(g);

					// then any custom painting,
					// which can be done by overloading
					// paintComponent.

					// then paint the borders
					paintBorder(g);

				//	isDisplayListCompiled = true;
				//}
				//else
				//{
				//	util::DisplayList::call(displayList);
				//}

				// then paint the children
				paintChildren(g);

				if(storeTransparency)
				{
					// restore transparency
					g.popTransparency();
				}
			}
			else
			{
				// this is the Picking render mode, we only do special painting
				// here, which helps to speed up this step.

				if(hasMouseListener())
				{
					paintSelectionComponent(g);
				}
				paintChildren(g);
			}

			if(isContainer())
			{
				if(storeDepth)
				{
					// restore depth values
					g.popDepth(depth);
				}
			}
		}
		g.popMatrix();
		//g.translate(-getBounds().x,-getBounds().y);
	}
Ejemplo n.º 13
0
void PictureShape::paint(QPainter &painter, const KoViewConverter &converter,
                         KoShapePaintingContext &paintContext)
{
    Q_UNUSED(paintContext);

    QRectF viewRect = converter.documentToView(QRectF(QPointF(0,0), size()));
    if (imageData() == 0) {
        painter.fillRect(viewRect, QColor(Qt::gray));
        return;
    }

    painter.save();
    applyConversion(painter, converter);
    paintBorder(painter, converter);
    painter.restore();

    QSize pixmapSize = calcOptimalPixmapSize(viewRect.size(), imageData()->image().size());

    // Normalize the clipping rect if it isn't already done.
    m_clippingRect.normalize(imageData()->imageSize());

    // Handle style:mirror, i.e. mirroring horizontally and/or vertically.
    // 
    // NOTE: At this time we don't handle HorizontalOnEven
    //       and HorizontalOnOdd, which have to know which
    //       page they are on.  In those cases we treat it as
    //       no horizontal mirroring at all.
    bool   doFlip = false;
    QSizeF shapeSize = size();
    QSizeF viewSize = converter.documentToView(shapeSize);
    qreal  midpointX = 0.0;
    qreal  midpointY = 0.0;
    qreal  scaleX = 1.0;
    qreal  scaleY = 1.0;
    if (m_mirrorMode & MirrorHorizontal) {
        midpointX = viewSize.width() / qreal(2.0);
        scaleX = -1.0;
        doFlip = true;
    }
    if (m_mirrorMode & MirrorVertical) {
        midpointY = viewSize.height() / qreal(2.0);
        scaleY = -1.0;
        doFlip = true;
    }
    if (doFlip) {
        QTransform outputTransform = painter.transform();
        QTransform worldTransform  = QTransform();

        //kDebug(31000) << "Flipping" << midpointX << midpointY << scaleX << scaleY;
        worldTransform.translate(midpointX, midpointY);
        worldTransform.scale(scaleX, scaleY);
        worldTransform.translate(-midpointX, -midpointY);
        //kDebug(31000) << "After flipping for window" << worldTransform;

        QTransform newTransform = worldTransform * outputTransform;
        painter.setWorldTransform(newTransform);
    }

    // Paint the image as prepared in waitUntilReady()
    if (!m_printQualityImage.isNull() && pixmapSize != m_printQualityRequestedSize) {
        QSizeF imageSize = m_printQualityImage.size();
        QRectF cropRect(
            imageSize.width()  * m_clippingRect.left,
            imageSize.height() * m_clippingRect.top,
            imageSize.width()  * m_clippingRect.width(),
            imageSize.height() * m_clippingRect.height()
        );

        painter.drawImage(viewRect, m_printQualityImage, cropRect);
        m_printQualityImage = QImage(); // free memory
    }
    else {
        QPixmap pixmap;
        QString key(generate_key(imageData()->key(), pixmapSize));

        // If the required pixmap is not in the cache
        // launch a task in a background thread that scales
        // the source image to the required size
        if (!QPixmapCache::find(key, &pixmap)) {
            QThreadPool::globalInstance()->start(new _Private::PixmapScaler(this, pixmapSize));
            painter.fillRect(viewRect, QColor(Qt::gray)); // just paint a gray rect as long as we don't have the required pixmap
        }
        else {
            QRectF cropRect(
                pixmapSize.width()  * m_clippingRect.left,
                pixmapSize.height() * m_clippingRect.top,
                pixmapSize.width()  * m_clippingRect.width(),
                pixmapSize.height() * m_clippingRect.height()
            );

            painter.drawPixmap(viewRect, pixmap, cropRect);
        }
    }
}