ShishGL  1.0
A simple modular cross-platform graphics library
Behavior.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_BEHAVIOR_HPP
3 #define SHISHGL_BEHAVIOR_HPP
4 /*============================================================================*/
5 #include "PlatformListener.hpp"
6 /*============================================================================*/
7 namespace Sh {
8 
9  class Behavior : public PlatformListener {
10  public:
11 
12  explicit Behavior(class UIWindow* target)
13  : target_window(target)
14  { }
15 
16  template <typename SomeWindow>
17  [[nodiscard]] SomeWindow* target() const {
18  return dynamic_cast<SomeWindow*>(target_window);
19  }
20 
21  virtual void onTargetUpdate() {}
22 
23  private:
24 
25  class UIWindow* target_window;
26  };
27 
28 }
29 /*============================================================================*/
30 #endif //SHISHGL_BEHAVIOR_HPP
31 /*============================================================================*/
Sh::PlatformListener
Definition: PlatformListener.hpp:9
Sh::Behavior::target
SomeWindow * target() const
Definition: Behavior.hpp:17
Sh::UIWindow
Definition: UIWindow.hpp:16
PlatformListener.hpp
Sh
Definition: CoreApplication.hpp:10
Sh::Behavior
Definition: Behavior.hpp:9
Sh::Behavior::Behavior
Behavior(class UIWindow *target)
Definition: Behavior.hpp:12
Sh::Behavior::onTargetUpdate
virtual void onTargetUpdate()
Definition: Behavior.hpp:21