Generic event handling between for example MVC Model and Controller based on a shared EventVar variable.
More...
|
| void | Notify () override |
| | Notify all listeners, no data supplied.
|
| |
| void | Notify (void *data) |
| | Notify all listeners about variable change with ClientData.
|
| |
| void | Notify (const std::string &s) |
| | Notify all listeners about variable change with a string.
|
| |
| void | Notify (int n, const std::string &s) |
| | Notify all listeners about variable change with a string and an int.
|
| |
| void | Notify (int n, void *p) |
| | Notify all listeners about variable change with an int and ClientData.
|
| |
| void | Notify (const std::shared_ptr< void > &p, const std::string &s, int n=0) |
| | Notify all listeners about variable change with shared_ptr, a string and an optional number.
|
| |
| void | Notify (const std::shared_ptr< const void > &p) override |
| | Notify all listeners about variable change with const* shared_ptr,.
|
| |
| | Observable (const std::string &_key) |
| | Initiate an object which can apply Notify() and Listen() to given key.
|
| |
| | Observable (const KeyProvider &kp) |
| | Initiate an object which can apply Notify() and Listen() to given key.
|
| |
| bool | Unlisten (wxEvtHandler *listener, wxEventType ev) |
| | Remove window listening to ev from list of listeners.
|
| |
| std::string | GetKey () const override |
| | Return the key given to the constructor.
|
| |
|
| const std::string | key |
| | The key used to create and clone.
|
| |
| void | Notify (const std::shared_ptr< const void > &ptr, const std::string &s, int num, void *client_data) |
| | Notify all listeners: send them a 'type' ObservedEvt message as defined by Listen() with optional data available using GetString(), GetClientData(), GetInt() and/or GetSharedPtr()
|
| |
| void | Notify (const std::string &s, void *client_data) |
| | Notify all listeners: send them a 'type' ObservedEvt message as defined by Listen() with optional data available using GetString(), and/or GetClientData().
|
| |
Generic event handling between for example MVC Model and Controller based on a shared EventVar variable.
Model usage:
class Model: ...
public:
void SomeMethod() {
...
change.Notify("new value");
wxYield();
}
Generic event handling between for example MVC Model and Controller based on a shared EventVar variab...
Controller/GUI usage:
class Gui: public wxEvtHandler {
public:
Gui:Gui(Model& model) {
auto action = [&](wxCommandEvent ev) {
auto s = ev.GetString();
... do something;
});
change_listener.Init(model.change, action);
}
private:
ObsListener change_listener;
}
- Note
- : The Notify() method actually generates an event which is added to the global event queue. If listeners should process the event immediately, a wxYield() directly after the Notify() keeps the listener delay at a minimum.
Definition at line 78 of file evtvar.h.