How to apply a transformation?

I am implementing a custom view and I would like to have a “rotation” attribute that would rotate the drawing.

So I would like to implement something like this:

void MyCustomView::Draw(CDrawContext *ctx)
{
 if(fRotation != 0) {
   // save state
   // apply rotation
 }

 ctx->draw...
 ctx->draw...
 ctx->draw...
 ...
 
 if(fRotation != 0) {
   // restore saved state
 }
}

If I call ctx->getCurrentTransform() it returns a const object so I cannot modify it. There is no setCurrentTransform method. And the pushTransform method is protected.

How do I implement such a thing?

Thanks
Yan

Hi,
read through the CParamDisplay::drawPlatformText() implementation. There the text is being drawn rotated. This should give you enough pointers how to do it.

Cheers,
Arne