Laurent Veilleux wrote:
>        
> 
>  >   if ( event.GetCommand()->GetCommandId() == &a2dCommand_SetFont::Id )
>  >     {
>  >          a2dDrawTextTool* textTool = wxDynamicCast( tool, 
> a2dDrawTextTool );
>  >           if ( textTool )
>  >                textTool->SetFont( a2dGetCmdh()->GetFont() );
>  >      }
> 
> What 's the difference with ?
> 
> a2dStToolContr* toolCtrl = (a2dStToolContr*) 
> canvasView->GetCanvasToolContr();
>         a2dBaseTool * tool = toolCtrl->GetFirstTool ();
> 
>         //check if it s a text tool
>         if(tool->IsKindOf(CLASSINFO(a2dDrawTextTool )))

I believe wxDynamicCast( tool, a2dDrawTextTool ) is better, closer to 
dynamic_cast<>

>         {
>             a2dDrawTextTool* textTool = (a2dDrawTextTool*) tool;

I was told to better not use hard casting, it is saver to use:

wxDynamicCast
wxStaticCast
wxNullStaticCast

>             
> textTool->SetFont(m_currentFontInfo.CreateFont(m_currentFontInfo.GetSize()));

m_currentFontInfo?? Is not a part of my code.

a2dGetCmdh()->GetFont() is a central place to store the global information 
about font and style.
But if you think you can do it a different manner, that is oke.

> It's more cleaner ?

??

Klaas





-- 
Unclassified

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wxart2d-users_dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to