ASPiK SDK
windowlistener.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #pragma once
6 
7 #include "../iwindowlistener.h"
8 
9 //------------------------------------------------------------------------
10 namespace VSTGUI {
11 namespace Standalone {
12 
13 //------------------------------------------------------------------------
19 {
20 public:
21  void onSizeChanged (const IWindow& window, const CPoint& newSize) override {}
22  void onPositionChanged (const IWindow& window, const CPoint& newPosition) override {}
23  void onShow (const IWindow& window) override {}
24  void onHide (const IWindow& window) override {}
25  void onClosed (const IWindow& window) override {}
26  void onActivated (const IWindow& window) override {}
27  void onDeactivated (const IWindow& window) override {}
28 };
29 
30 //------------------------------------------------------------------------
36 {
37 public:
38  using Func = std::function<void (const IWindow&)>;
39 
41 
42  template <typename Func>
43  WindowClosedListener (Func func) : func (std::forward<Func> (func))
44  {
45  }
46 
47  void onClosed (const IWindow& window) override
48  {
49  if (func)
50  {
51  func (window);
52  Func e {};
53  func.swap (e);
54  func = nullptr;
55  }
56  }
57 
58  Func func;
59 };
60 
61 //------------------------------------------------------------------------
62 } // Standalone
63 } // VSTGUI
void onActivated(const IWindow &window) override
Definition: windowlistener.h:26
void onSizeChanged(const IWindow &window, const CPoint &newSize) override
Definition: windowlistener.h:21
void onHide(const IWindow &window) override
Definition: windowlistener.h:24
void onClosed(const IWindow &window) override
Definition: windowlistener.h:47
void onClosed(const IWindow &window) override
Definition: windowlistener.h:25
Definition: customcontrols.cpp:8
Definition: iwindow.h:142
Definition: windowlistener.h:35
void onShow(const IWindow &window) override
Definition: windowlistener.h:23
void onDeactivated(const IWindow &window) override
Definition: windowlistener.h:27
Definition: windowlistener.h:18
Definition: iwindowlistener.h:20
Point structure.
Definition: cpoint.h:17
void onPositionChanged(const IWindow &window, const CPoint &newPosition) override
Definition: windowlistener.h:22