void ParticleSkinnedModel::draw()
{
	const std::vector<Body::sPart>& partData = m_body->getParts();

	for(size_t i=0; i<partData.size(); ++i)
		drawPart(i);
}
void LightCycle::drawInnerCircles() {
	float * myColor = makeColor(31 / 255.0f, 1, 233 / 255.0f);
	vector <Component> list;
	list.push_back(getComponent("LeftInnerCircle"));
	list.push_back(getComponent("RightInnerCircle"));
	drawPart(list, myColor, false);

}
void LightCycle::drawBottomDetails() {
	glLineWidth(5.0);
	float * myColor = makeColor(31 / 255.0f, 1, 233 / 255.0f);
	vector <Component> list;
	list.push_back(getComponent("bottomLeft"));
	list.push_back(getComponent("bottomMiddle"));
	list.push_back(getComponent("bottomRight"));
	drawPart(list, myColor, false);
	glLineWidth(1.0);
}
QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
                                SkinElementFlags flags)
{
    const QS60StyleEnums::SkinParts center =        m_frameElementsData[frame].center;
    const QS60StyleEnums::SkinParts topLeft =       QS60StyleEnums::SkinParts(center - 8);
    const QS60StyleEnums::SkinParts topRight =      QS60StyleEnums::SkinParts(center - 7);
    const QS60StyleEnums::SkinParts bottomLeft =    QS60StyleEnums::SkinParts(center - 6);
    const QS60StyleEnums::SkinParts bottomRight =   QS60StyleEnums::SkinParts(center - 5);
    const QS60StyleEnums::SkinParts top =           QS60StyleEnums::SkinParts(center - 4);
    const QS60StyleEnums::SkinParts bottom =        QS60StyleEnums::SkinParts(center - 3);
    const QS60StyleEnums::SkinParts left =          QS60StyleEnums::SkinParts(center - 2);
    const QS60StyleEnums::SkinParts right =         QS60StyleEnums::SkinParts(center - 1);

    // The size of topLeft defines all other sizes
    const QSize cornerSize(partSize(topLeft));
    // if frame is so small that corners would cover it completely, draw only center piece
    const bool drawOnlyCenter =
        2 * cornerSize.width() + 1 >= size.width() || 2 * cornerSize.height() + 1 >= size.height();

    const int cornerWidth = cornerSize.width();
    const int cornerHeight = cornerSize.height();
    const int rectWidth = size.width();
    const int rectHeight = size.height();
    const QRect rect(QPoint(), size);

    const QRect topLeftRect = QRect(rect.topLeft(), cornerSize);
    const QRect topRect = rect.adjusted(cornerWidth, 0, -cornerWidth, -(rectHeight - cornerHeight));
    const QRect topRightRect = topLeftRect.translated(rectWidth - cornerWidth, 0);
    const QRect rightRect = rect.adjusted(rectWidth - cornerWidth, cornerHeight, 0, -cornerHeight);
    const QRect bottomRightRect = topRightRect.translated(0, rectHeight - cornerHeight);
    const QRect bottomRect = topRect.translated(0, rectHeight - cornerHeight);
    const QRect bottomLeftRect = topLeftRect.translated(0, rectHeight - cornerHeight);
    const QRect leftRect = rightRect.translated(cornerWidth - rectWidth, 0);
    const QRect centerRect = drawOnlyCenter ? rect : rect.adjusted(cornerWidth, cornerWidth, -cornerWidth, -cornerWidth);

    QPixmap result(size);
    result.fill(Qt::transparent);
    QPainter painter(&result);

#if 0
    painter.save();
    painter.setOpacity(.3);
    painter.fillRect(topLeftRect, Qt::red);
    painter.fillRect(topRect, Qt::green);
    painter.fillRect(topRightRect, Qt::blue);
    painter.fillRect(rightRect, Qt::green);
    painter.fillRect(bottomRightRect, Qt::red);
    painter.fillRect(bottomRect, Qt::blue);
    painter.fillRect(bottomLeftRect, Qt::green);
    painter.fillRect(leftRect, Qt::blue);
    painter.fillRect(centerRect, Qt::red);
    painter.restore();
#else
    drawPart(topLeft, &painter, topLeftRect, flags);
    drawPart(top, &painter, topRect, flags);
    drawPart(topRight, &painter, topRightRect, flags);
    drawPart(right, &painter, rightRect, flags);
    drawPart(bottomRight, &painter, bottomRightRect, flags);
    drawPart(bottom, &painter, bottomRect, flags);
    drawPart(bottomLeft, &painter, bottomLeftRect, flags);
    drawPart(left, &painter, leftRect, flags);
    drawPart(center, &painter, centerRect, flags);
#endif

    return result;
}
Beispiel #5
0
void MVScrollBar::handleEvent(MVEvent& event,phaseType phase)
/****************************************************************************
*
* Function:		MVScrollBar::handleEvent
* Parameters:	event	- Event to handle
*				phase	- Current phase for the event (pre,focus,post)
*
* Description:	Event handling routine for scroll bars.
*
****************************************************************************/
{
	MVView::handleEvent(event,phase);

	flags |= sbInteracting;

	if (event.what == evMouseDown) {
		// Let the owning view know that the scroll bar has been clicked,
		// so that any associated lists etc can select themselves and
		// prepare for scroll bar changed events.
		MV_message(owner,evBroadcast,cmScrollBarClicked,this);
		MVEvent e;
		getEvent(e,evRepaint);				// Force repaint
		dc.setClipRect(bounds);

		ibool   down;
		int part = getPartHit(event.where);
		if (part == -1)
			goto QuickExit;

        if ((part == (int)sbLeftArrow && value == minVal) ||
            (part == (int)sbRightArrow && value == maxVal) ||
            (minVal == maxVal)) {
			MV_beep();
			goto QuickExit;
            }

		drawPart(part,down = true);
		while (event.what != evMouseUp) {
			switch (event.what) {
				case evMouseDown:
				case evMouseAuto:
					if (part == getPartHit(event.where))
						changeValue(part);
					break;
				case evMouseMove:
					if (part != (int)sbThumb) {
						if (down != (part == getPartHit(event.where)))
							drawPart(part,down = !down);
						}
					else changeValue(event.where);
					break;
				}
			if (part != (int)sbThumb && (value == minVal || value == maxVal))
				break;
			getEvent(event);
			}
		if (down)
			drawPart(part,false);

		// Redraw the arrows if they have changed state during the
		// interaction, and we were adjusting the paging state.
		if (part == (int)sbPageLeft || part == (int)sbPageRight || part == (int)sbThumb) {
			if (value == minVal)
				drawLeftArrow(false);
			else if (value == maxVal)
				drawRightArrow(false);
			}

QuickExit:
		clearEvent(event);
		}

	flags &= ~sbInteracting;
}
void LightCycle::drawEngineBlock() {
	float * myColor = makeColor(0.08, 0.08, 0.08);
	vector <Component> list;
	list.push_back(getComponent("EngineBlock"));
	drawPart(list, myColor, false);
}
void LightCycle::drawBottomBar() {
	float * myColor = makeColor(0.1, 0.1, 0.1);
	vector <Component> list;	
	list.push_back(getComponent("bottomBar"));
	drawPart(list, myColor, false);
}