Open holyodin776 opened 2 years ago
In which situation would you like to access the ImwContainer ?
Actually I am not interested in ImwContainer at all, what I want to know is which ImwPlatformWindow contain a certain ImwWindow. I made this suggestion because there is way to access ImwPlatformWindow from ImwContainer (via 'GetPlatformWindowParent'). I also tried to modifiy the code to support the idea, but unfortunately introduces some bugs. So, for now I think directlly access ImwPlatformWindow from ImwWindow would be a better way.
Why I care about the ImwPlatformWindow in ImwWindow? simpply put , the key and mouse states, which are bound to ImwPlatformWindow, not a specific ImwWindow. However in my framework, users can not see ImwPlatformWindow, they can only access a class called "Cavnas" which is derrived from ImwWindow. If one should for instance, figured out if the ctrl key is pressed, he can only access through the Cavnas's interface, in which, the key state can only be fetched from the ImwPlatformWindow that contain the canvas.
During ImwWindow::OnGui you can call ImwWindowManager::GetInstance()->GetCurrentPlatformWindow()
to retrieve the current ImwPlatformWindow.
Or you can call ImwWindowManager::GetInstance()->GetWindowParent(pWindow)
which return an ImwPlatformWindow too.
Can that be enough ?
I think so, and I managed to store the ImwPlatformWindow pointer inside ImwWindow as well. It works, and so far so good:)
By store a ImwContainer pointer inside ImwWindow, it is handy to know which ImwContainer contains the window, and through this pointer one can further fetch the PlatformWindow in which some PlatformWindow--specific states can be known.(for example, key and mouse state).