How do I replicate Unity's movement/rotation/scaling handles?

I am working on a level editor for my game. Level editor will be purely in-game tool so I can’t use any Unity Editor-specific classes in it.

How would I go about replicating Unity’s object selection and transform handles?

alt text

These are the very handles I’m talking about.

Same question with answer is here. Also you can look to example on wiki