Is it possible to reparent a Component? Or even better to generate a component on a specified HWND on Windows or a cocoaRef on Mac?
Of course, any component can be moved between parents. Happens all the time!
Ok, sounds great and how can I do that?
To make clear what I actually want to do. Assuming I have created a HWND (only windows for the moment) with
hwnd = CreateWindowEx (exstyle, L"somename", L"", type, 0, 0, 0, 0, NULL, 0, (HINSTANCE) Process::getCurrentModuleInstanceHandle(), 0);
So now I have the HWND which is essentially a void pointer. I want to wrap this window up with a Component, so I can use JUCE to fill the content.
I know I could retrieve the HWND from the Peer with getNativeHandle() and I could call SetParent. Well, this would probably work on Windows but on MacOSX there is no such thing like reparenting. That’s why I really want to encapsulate the native Peers at the very beginning.
Oh, I thought you meant just adding a component to another one.
The addToDesktop method will add it to a HWND using a child window, but beyond that, you’re on your own with native window hackery, I’m afraid!