示例#1
0
void CommonTransitions::paintSlideAtPosition( shared_ptr<Graphics> g, int slideX, int slideY )
{
	shared_ptr<Component> source = getSource();

	// if this is the first form we can't do a slide transition since we have no source form
	if (source.get() == NULL) { 
		return;           
	}

	shared_ptr<Component> dest = getDestination();                
	int w = source->getWidth();
	int h = source->getHeight();

	if (slideType == SLIDE_HORIZONTAL) {
		h = 0;
	} else {
		w = 0;
	}

	if(forward) {
		w = -w;
		h = -h;
	} else {
		slideX = -slideX;
		slideY = -slideY;
	}
	g->setClip(source->getAbsoluteX()+source->getScrollX(), source->getAbsoluteY()+source->getScrollY(), source->getWidth(), source->getHeight());

	// dialog animation is slightly different... 
	shared_ptr<Dialog> dlg = dynamic_pointer_cast<Dialog>(source);
	if(dlg.get() != NULL) {
		g->BitBlt(buffer, 0, 0);
		paint(g, source, -slideX, -slideY);
		return;
	} 
	dlg = dynamic_pointer_cast<Dialog>(dest);
	if(dlg.get() != NULL) {
		g->BitBlt(buffer, 0, 0);
		paint(g, dest, -slideX - w, -slideY - h);
		return;
	} 

	//g.setClip(source.getAbsoluteX(), source.getAbsoluteY(), source.getWidth(), source.getHeight());

	//g.clipRect(dest.getAbsoluteX(), dest.getAbsoluteY(), source.getWidth(), source.getHeight());
	if(source->getParent().get() != NULL){
		source->paintBackgrounds(g);
		paint(g, source, slideX , slideY );
	}else{
		g->drawImage(buffer, slideX, slideY);        
	}
	paint(g, dest, slideX + w, slideY + h);

}