vsg  1.1.0
VulkanSceneGraph library
WindowEvent.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2018 Robert Osfield
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 </editor-fold> */
14 
15 #include <vsg/app/Window.h>
16 #include <vsg/core/observer_ptr.h>
17 #include <vsg/ui/UIEvent.h>
18 
19 namespace vsg
20 {
21 
23  class VSG_DECLSPEC WindowEvent : public Inherit<UIEvent, WindowEvent>
24  {
25  public:
26  WindowEvent() {}
27 
28  WindowEvent(Window* in_window, time_point in_time) :
29  Inherit(in_time),
30  window(in_window) {}
31 
32  observer_ptr<Window> window;
33 
34  void read(Input& input) override;
35  void write(Output& output) const override;
36  };
37  VSG_type_name(vsg::WindowEvent);
38 
40  class VSG_DECLSPEC ExposeWindowEvent : public Inherit<WindowEvent, ExposeWindowEvent>
41  {
42  public:
44 
45  ExposeWindowEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, uint32_t in_width, uint32_t in_height) :
46  Inherit(in_window, in_time),
47  x(in_x),
48  y(in_y),
49  width(in_width),
50  height(in_height) {}
51 
52  int32_t x = 0;
53  int32_t y = 0;
54  uint32_t width = 0;
55  uint32_t height = 0;
56 
57  void read(Input& input) override;
58  void write(Output& output) const override;
59  };
60  VSG_type_name(vsg::ExposeWindowEvent);
61 
63  class VSG_DECLSPEC ConfigureWindowEvent : public Inherit<WindowEvent, ConfigureWindowEvent>
64  {
65  public:
67 
68  ConfigureWindowEvent(Window* in_window, time_point in_time, int32_t in_x, int32_t in_y, uint32_t in_width, uint32_t in_height) :
69  Inherit(in_window, in_time),
70  x(in_x),
71  y(in_y),
72  width(in_width),
73  height(in_height) {}
74 
75  int32_t x = 0;
76  int32_t y = 0;
77  uint32_t width = 0;
78  uint32_t height = 0;
79 
80  void read(Input& input) override;
81  void write(Output& output) const override;
82  };
83  VSG_type_name(vsg::ConfigureWindowEvent);
84 
86  class CloseWindowEvent : public Inherit<WindowEvent, CloseWindowEvent>
87  {
88  public:
89  CloseWindowEvent() {}
90 
91  CloseWindowEvent(Window* in_window, time_point in_time) :
92  Inherit(in_window, in_time) {}
93  };
94  VSG_type_name(vsg::CloseWindowEvent);
95 
97  class FocusInEvent : public Inherit<WindowEvent, FocusInEvent>
98  {
99  public:
100  FocusInEvent() {}
101 
102  FocusInEvent(Window* in_window, time_point in_time) :
103  Inherit(in_window, in_time) {}
104  };
105  VSG_type_name(vsg::FocusInEvent);
106 
108  class FocusOutEvent : public Inherit<WindowEvent, FocusOutEvent>
109  {
110  public:
111  FocusOutEvent() {}
112 
113  FocusOutEvent(Window* in_window, time_point in_time) :
114  Inherit(in_window, in_time) {}
115  };
116  VSG_type_name(vsg::FocusOutEvent);
117 
118 } // namespace vsg
CloseWindowEvent represents a window close event.
Definition: WindowEvent.h:87
ConfigureWindowEvent represents a window configure event - such as changes to the size of the window.
Definition: WindowEvent.h:64
ExposeWindowEvent represents a window expose event.
Definition: WindowEvent.h:41
FocusInEvent represents a window acquiring focus event.
Definition: WindowEvent.h:98
FocusOutEvent represents a window losing focus event.
Definition: WindowEvent.h:109
Definition: Inherit.h:28
Definition: Input.h:44
Definition: Output.h:41
WindowEvent is the base class for events related to a window.
Definition: WindowEvent.h:24
Definition: Window.h:31
Definition: observer_ptr.h:24