'This' is not static; it's different per instance (it *is* the instance). The 'invisible' pass only happens when a method calls into another method of its own class. C++ does that too.
Okay, about passing your 'this' to a class. First, i don't understand your requirement. Cegui will only trigger events for Windows, but you want to use it for your own custom classes too? Or classes which have a 1:1 relationship with a Cegui Window?
Anyhow, here is some input which might help:
What you can do is define your own eventArgs class, which is based on CEGUI::EventArgs. Then you can add new variables to that one. For example:
Code: Select all
class MyEventArgs: public CEGUI::EventArgs {
public:
int* m_this;
}
(for exact syntax and requirements, look at CEGUI::MouseEventArgs for example).
Of course, this only works when you are firing the event yourself, otherwise Cegui will decide for its own eventArgs versions.
If this is too much hassle, or if Cegui is firing your events, you always get the Window (args->m_window). If you have a 1:1 relation with your own object, you can set its userid or data:
And then in your eventhandler:
Code: Select all
int* relatedInstance = args->m_window->getUserID();
HTH.