Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: May ImwContainer be pointed by ImwWindow #41

Open
holyodin776 opened this issue Nov 25, 2021 · 5 comments
Open

Suggestion: May ImwContainer be pointed by ImwWindow #41

holyodin776 opened this issue Nov 25, 2021 · 5 comments

Comments

@holyodin776
Copy link

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).

@thennequin
Copy link
Owner

In which situation would you like to access the ImwContainer ?

@holyodin776
Copy link
Author

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.

@holyodin776
Copy link
Author

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.

@thennequin
Copy link
Owner

thennequin commented Dec 1, 2021

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 ?

@holyodin776
Copy link
Author

I think so, and I managed to store the ImwPlatformWindow pointer inside ImwWindow as well. It works, and so far so good:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants