Gorgon Game Engine
Window.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "Geometry/Point.h"
7 #include "ConsumableEvent.h"
8 #include "Geometry/Rectangle.h"
10 #include "WindowManager.h"
11 #include "Event.h"
12 #include "Layer.h"
13 #include "Input.h"
14 #include "Input/Keyboard.h"
15 #include "Graphics/Pointer.h"
16 
17 namespace Gorgon {
19  namespace internal {
20  struct windowdata;
21  }
23 
24  namespace Graphics {
25  class Layer;
26  }
27 
28 
31  class Window : public Layer {
33  friend struct internal::windowdata;
34  friend class Layer;
35  friend class windaccess;
36  public:
38  static const struct FullscreenTag {
39 
40  }Fullscreen;
41 
45  Window() { }
46 
53  Window(Geometry::Rectangle rect, const std::string &name, bool allowresize=false, bool visible=true) :
54  Window(WindowManager::Monitor::Primary(), rect, name, name, allowresize, visible) {}
55 
62  Window(Geometry::Rectangle rect, const char *name, bool allowresize=false, bool visible=true) :
63  Window(WindowManager::Monitor::Primary(), rect, name, name, allowresize, visible) {}
64 
71  Window(const Geometry::Size &size, const std::string &name, const std::string &title, bool allowresize=false, bool visible=true) :
72  Window(WindowManager::Monitor::Primary(), {automaticplacement, size}, name, title, allowresize, visible) { }
73 
80  Window(const Geometry::Size &size, const char *name, const char *title, bool allowresize=false, bool visible=true) :
81  Window(WindowManager::Monitor::Primary(), {automaticplacement, size}, name, title, allowresize, visible) { }
82 
88  Window(const Geometry::Size &size, const std::string &name, bool allowresize=false, bool visible=true) :
89  Window(WindowManager::Monitor::Primary(), {automaticplacement, size}, name, name, allowresize, visible) { }
90 
96  Window(const Geometry::Size &size, const char *name, bool allowresize=false, bool visible=true) :
97  Window(WindowManager::Monitor::Primary(), {automaticplacement, size}, name, name, allowresize, visible) { }
98 
105  Window(const WindowManager::Monitor &monitor, const Geometry::Size &size, const std::string &name, bool allowresize=false, bool visible=true) :
106  Window(monitor, {automaticplacement, size}, name, name, allowresize, visible) { }
107 
114  Window(const WindowManager::Monitor &monitor, const Geometry::Size &size, const char *name, bool allowresize=false, bool visible=true) :
115  Window(monitor, {automaticplacement, size}, name, name, allowresize, visible) { }
116 
119  Window(const FullscreenTag &, const WindowManager::Monitor &monitor, const std::string &name, const std::string &title="");
120 
123  Window(const FullscreenTag &tag, const std::string &name, const std::string &title="") :
124  Window(tag, WindowManager::Monitor::Primary(), name, title) { }
125 
127  Window(const Window &) = delete;
128 
130  Window(Window &&other) {
131  Swap(other);
132  }
133 
135  ~Window() { Destroy(); }
136 
138  void Destroy();
139 
142  Swap(other);
143 
144  other.Destroy();
145 
146  return *this;
147  }
148 
150  void Swap(Window &other);
151 
158  void processmessages();
159 
162  void activatecontext();
163 
165  virtual void Move(const Geometry::Point &position) override;
166 
168  virtual void Move(int x, int y) override {
169  Move({x, y});
170  }
171 
178  virtual void Resize(const Geometry::Size &size) override;
179 
186  virtual void Resize(int width, int height) override {
187  Resize({width, height});
188  }
189 
193 
197  return GetExteriorBounds().TopLeft();
198  }
199 
202  void Minimize();
203 
205  bool IsMinimized() const;
206 
209  void Maximize();
210 
212  bool IsMaximized() const;
213 
215  void Restore();
216 
220  const WindowManager::Monitor &GetMonitor() const;
221 
223  virtual void Show() override;
224 
226  virtual void Hide() override;
227 
229  virtual bool IsVisible() const override { return isvisible; }
230 
232  void Focus();
233 
235  bool IsFocused() const;
236 
238  void Close();
239 
241  void SetTitle(const std::string &title);
242 
244  std::string GetTitle() const;
245 
247  std::string GetName() const {
248  return name;
249  }
250 
252  bool IsClosed() const;
253 
256  void ShowPointer();
257 
262  void HidePointer();
263 
265  bool IsPointerVisible() const {
266  return showptr;
267  }
268 
273  void SwitchToLocalPointers();
274 
276  void SwitchToWMPointers();
277 
279  bool IsLocalPointer() const {
280  return !iswmpointer;
281  }
282 
284  void Center() {
286  }
287 
289  void Center(const WindowManager::Monitor &monitor) {
290  Move((monitor.GetUsable()-GetExteriorBounds().GetSize()).Center());
291  }
292 
294  void SetIcon(const WindowManager::Icon &icon);
295 
297  virtual void Render() override;
298 
303  return mouselocation;
304  }
305 
308  return pressed;
309  }
310 
312  bool IsLeftButtonPressed() const {
313  return pressed&&Input::Mouse::Button::Left;
314  }
315 
317  bool IsRightButtonPressed() const {
318  return pressed&&Input::Mouse::Button::Right;
319  }
320 
322  bool IsMiddleButtonPressed() const {
323  return pressed&&Input::Mouse::Button::Middle;
324  }
325 
327  bool IsX1ButtonPressed() const {
328  return pressed&&Input::Mouse::Button::X1;
329  }
330 
332  bool IsX2ButtonPressed() const {
333  return pressed&&Input::Mouse::Button::X2;
334  }
335 
337  void AllowResize();
338 
340  void PreventResize();
341 
344 
347 
350 
353 
356 
360 
366 
369 
372 
375 
378 
392  ConsumableEvent<Window, Input::Key, float> KeyEvent{*this};
393 
397  ConsumableEvent<Window, Input::Keyboard::Char> CharacterEvent{*this};
399 
402 
404  void mouse_down(Geometry::Point location, Input::Mouse::Button button);
405 
407  void mouse_up(Geometry::Point location, Input::Mouse::Button button);
408 
410  void mouse_event(Input::Mouse::EventType event, Geometry::Point location, Input::Mouse::Button button, float amount);
411 
413  void mouse_location();
414 
415  protected:
416  Window(const WindowManager::Monitor &monitor, Geometry::Rectangle rect, const std::string &name, const std::string &title, bool allowresize, bool visible);
417 
419  virtual void located(Layer *) override { Utils::ASSERT_FALSE("A window cannot be placed in another layer"); }
420 
421  virtual void added(Layer &layer) override;
422 
423 
424  void deleting(Layer *layer) { if(layer==down) down = MouseHandler{}; }
425 
426  private:
427  void createglcontext();
428 
429  void updatedataowner();
430 
431  std::string name;
432 
433  internal::windowdata *data = nullptr;
434 
435  static Containers::Collection<Window> windows;
436 
437  static const Geometry::Point automaticplacement;
438 
440 
441  MouseHandler down;
442  MouseHandler over;
443 
444  bool allowresize = false;
445 
446  bool cursorover = true;
447 
448 
449  Geometry::Point mousedownlocation = {-1, -1};
450  Geometry::Point mouselocation = {-1, -1};
451 
452  Graphics::Layer *pointerlayer = nullptr;
453  bool iswmpointer = true;
454  bool showptr = true;
455  bool switchbacktolocalptr = false;
456 
457  Geometry::Size glsize = {0, 0};
458  };
459 }
Gorgon::internal::windowdata::move
bool move
Definition: X11.h:38
Gorgon::Window::Swap
void Swap(Window &other)
Used for move semantics.
Definition: Window.cpp:17
Gorgon::Layer::Resize
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
Gorgon::Geometry::basic_Rectangle::TopLeft
basic_Point< T_ > TopLeft() const
Returns the top left coordinates of the rectangle.
Definition: Rectangle.h:198
Gorgon::Geometry::basic_Bounds
This class represents boundaries of 2D objects.
Definition: Bounds.h:27
Gorgon::Window::processmessages
void processmessages()
This method is automatically called by the system.Unless its necessary, do not use it.
Definition: Window.cpp:652
Gorgon::Input::Mouse::None
@ None
Definition: Mouse.h:32
Gorgon::WindowManager::XA_WM_NAME
Atom XA_WM_NAME
Definition: X11.h:85
Gorgon::WindowManager::XA_ATOM
Atom XA_ATOM
Definition: X11.h:79
Gorgon::Window::GetMinimumRequiredSize
static Geometry::Size GetMinimumRequiredSize()
Returns the minimum size required to fit any window inside.
Definition: WindowManager.cpp:14
Gorgon::swap
void swap(Event< Source_, Args_... > &l, Event< Source_, Args_... > &r)
Swaps two events.
Definition: Event.h:351
Gorgon::WindowManager::GetMousePosition
Geometry::Point GetMousePosition(Gorgon::internal::windowdata *wind)
Definition: X11.cpp:223
DnD.h
Gorgon::Window
This class represents a window.
Definition: Window.h:31
Gorgon::Geometry::IsInside
bool IsInside(const basic_Bounds< T_ > &b, const basic_Point< T_ > &p)
Checks whether the given point is inside this bounds.
Definition: Bounds.h:514
Gorgon::GL::FrameBuffer::UpdateSizes
static void UpdateSizes()
Updates the size of all framebuffers.
Definition: FrameBuffer.cpp:34
Gorgon::Window::PressedButtons
Input::Mouse::Button PressedButtons() const
Returns currently pressed buttons.
Definition: Window.h:307
Layer.h
Gorgon::WindowManager::handleinputevent
void handleinputevent(XEvent event, Window &wind)
Definition: Input.cpp:463
Gorgon::WindowManager::ClickThreshold
int ClickThreshold
The maximum distance allowed for mouse to move between the press of the button and the release for cl...
Definition: Config.cpp:13
Gorgon::Window::IsVisible
virtual bool IsVisible() const override
Returns whether this layer is effectively visible.
Definition: Window.h:229
Gorgon::Graphics::Layer::Clear
virtual void Clear() override
Clears drawing buffer, in layer architecture this request only affects the layer itself,...
Definition: Layer.h:269
Gorgon::Graphics::PointerStack::Current
const Pointer & Current() const
Returns the pointer on top of the stack, if no pointer is on the stack, first pointer in the order of...
Definition: Pointer.cpp:53
Gorgon::Window::SetIcon
void SetIcon(const WindowManager::Icon &icon)
Changes the icon of the window.
Definition: Window.cpp:644
Gorgon::internal::windowdata::focused
bool focused
Definition: X11.h:42
Gorgon::WindowManager::XA_PROTOCOLS
Atom XA_PROTOCOLS
Definition: X11.h:69
X11Keysym.h
Gorgon::GL::Clear
void Clear()
Clears the window pointed by the active context.
Definition: OpenGL.cpp:277
Gorgon::Input::DragInfo::GetTarget
DropTarget & GetTarget() const
Returns the target of the drag operation.
Definition: DnD.h:890
Gorgon::Window::Resize
virtual void Resize(int width, int height) override
Resizes the window to the given size.
Definition: Window.h:186
Rectangle.h
contains the Rectangle class
Gorgon::Event
This class provides event mechanism.
Definition: Event.h:134
Gorgon::WindowManager::Monitor::GetUsable
Geometry::Bounds GetUsable() const
Returns the area usable rectangle of the monitor. This region excludes any panels on the screen.
Definition: WindowManager.h:105
Gorgon::Layer::Add
void Add(Layer &layer)
Adds the given layer as a child.
Definition: Layer.cpp:23
Gorgon::Window::RestoredEvent
Event< Window > RestoredEvent
Called after the window is restored from minimized state, either by the user or programmatically.
Definition: Window.h:377
Gorgon::Input::Mouse::HitCheck
@ HitCheck
Checks if the coordinate hits the layer, always called first.
Definition: Mouse.h:15
Gorgon::Input::Mouse::Click
@ Click
Definition: Mouse.h:22
Gorgon::WindowManager::XA_NET_FRAME_EXTENTS
Atom XA_NET_FRAME_EXTENTS
Definition: X11.h:82
Collection.h
contains collection, a vector of references.
Gorgon::Window::IsClosed
bool IsClosed() const
Whether the window is currently closed and cannot be acted on.
Definition: Window.cpp:413
Gorgon::Window::IsX1ButtonPressed
bool IsX1ButtonPressed() const
Query whether the X1 mouse button is pressed.
Definition: Window.h:327
OS.h
contains operating system functionality.
Gorgon::Input::Mouse::X2
@ X2
Definition: Mouse.h:37
Gorgon::Window::Window
Window()
Empty constructor creates a non-initialized window.
Definition: Window.h:45
Point.h
contains point class.
Gorgon::Window::GetTitle
std::string GetTitle() const
Returns the current title of the window.
Definition: Window.cpp:392
Gorgon::Geometry::basic_Point::X
T_ X
X coordinate.
Definition: Point.h:368
Gorgon::Window::Move
virtual void Move(const Geometry::Point &position) override
Moves the window to the given position.
Definition: Window.cpp:309
Gorgon::Window::CharacterEvent
ConsumableEvent< Window, Input::Keyboard::Char > CharacterEvent
Called when a character is received.
Definition: Window.h:397
Gorgon::Window::~Window
~Window()
Destroys this window.
Definition: Window.h:135
Gorgon::Geometry::basic_Rectangle::X
T_ X
X coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:354
Gorgon::WindowManager::XA_CARDINAL
Atom XA_CARDINAL
Definition: X11.h:80
Window.h
Gorgon::Window::IsLeftButtonPressed
bool IsLeftButtonPressed() const
Query whether the left mouse button is pressed.
Definition: Window.h:312
Gorgon::Geometry::basic_Size::Height
T_ Height
Height of this size object.
Definition: Size.h:261
Gorgon::Window::Fullscreen
static const struct Gorgon::Window::FullscreenTag Fullscreen
Definition: WindowManager.cpp:12
Gorgon::Window::SetTitle
void SetTitle(const std::string &title)
Changes the title of the window to the specified string.
Definition: Window.cpp:387
Gorgon::WindowManager::XdndLeave
Atom XdndLeave
Definition: X11.h:105
Gorgon::WindowManager::internal::getdata
Gorgon::internal::windowdata * getdata(const Window &w)
Definition: Window.cpp:15
Gorgon::Window::IsRightButtonPressed
bool IsRightButtonPressed() const
Query whether the right mouse button is pressed.
Definition: Window.h:317
Gorgon::OS::DisplayMessage
void DisplayMessage(const std::string &message)
This function shows a OS message box to display errors, for other messages its better to use in-game ...
Definition: Linux.cpp:104
Gorgon::Clip
Geometry::Bounds Clip
Current clipping size, for mouse and clipping events.
Definition: Layer.cpp:20
Gorgon::internal::windowdata::min
bool min
Definition: X11.h:36
Gorgon::Graphics::RGBAf
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Gorgon::Input::Mouse::Move
@ Move
Definition: Mouse.h:17
Gorgon::Input::Mouse::X1
@ X1
Definition: Mouse.h:36
Gorgon::Window::operator=
Window & operator=(Window &&other)
Moves another window into this one.
Definition: Window.h:141
Gorgon::Window::IsLocalPointer
bool IsLocalPointer() const
Returns whether the current pointer is a local pointer.
Definition: Window.h:279
Gorgon::WindowManager::getanywindow
::Window getanywindow()
Definition: Window.cpp:21
Gorgon::Window::Minimize
void Minimize()
Minimizes the window.
Definition: Window.cpp:454
Gorgon::Geometry::basic_Rectangle::Width
T_ Width
Width of the rectangle.
Definition: Rectangle.h:360
Gorgon::Window::IsPointerVisible
bool IsPointerVisible() const
Returns whether the pointer is visible.
Definition: Window.h:265
Gorgon::Window::Focus
void Focus()
Focuses this window.
Definition: Window.cpp:432
Gorgon::Geometry::Size
basic_Size< int > Size
Definition: Size.h:385
Gorgon::Window::IsMaximized
bool IsMaximized() const
Returns if the window is maximized.
Definition: Window.cpp:599
Gorgon::GL::SetupContext
void SetupContext(const Geometry::Size &size)
Performs first time initialization on GL context.
Definition: OpenGL.cpp:225
Gorgon::MouseHandler::Swap
void Swap(MouseHandler &other)
Definition: Layer.h:57
Gorgon::ResetTransform
void ResetTransform(const Geometry::Size &size)
This should be called by the windows to reset transformation stack.
Definition: Layer.h:65
Gorgon::Layer::IsVisible
virtual bool IsVisible() const
Returns whether this layer is effectively visible.
Definition: Layer.h:459
Gorgon::Graphics::Layer
This layer allows drawing texture images on.
Definition: Layer.h:169
Gorgon::Geometry::basic_Rectangle::GetSize
basic_Size< T_ > GetSize() const
Returns the size of the rectangle.
Definition: Rectangle.h:218
Gorgon::Window::IsMinimized
bool IsMinimized() const
Returns if the window is minimized.
Definition: Window.cpp:580
Gorgon::Utils::ASSERT_FALSE
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
Color.h
Gorgon::Window::mouse_location
void mouse_location()
These functions are used internally.
Definition: Window.cpp:166
Gorgon::internal::windowdata::pointerdisplayed
bool pointerdisplayed
Definition: X11.h:37
Gorgon::Window::IsX2ButtonPressed
bool IsX2ButtonPressed() const
Query whether the X2 mouse button is pressed.
Definition: Window.h:332
Gorgon::Graphics::PointerStack::IsValid
bool IsValid() const
Returns if the stack is valid to be used.
Definition: Pointer.cpp:67
Config.h
Gorgon::Window::mouse_up
void mouse_up(Geometry::Point location, Input::Mouse::Button button)
These functions are used internally.
Definition: Window.cpp:120
Gorgon::Window::mouse_event
void mouse_event(Input::Mouse::EventType event, Geometry::Point location, Input::Mouse::Button button, float amount)
These functions are used internally.
Definition: Window.cpp:158
Gorgon::internal::windowdata::moveto
Geometry::Point moveto
Definition: X11.h:39
Gorgon::Window::Hide
virtual void Hide() override
Hides this window, may generate Deactivated event.
Definition: Window.cpp:273
Gorgon::WindowManager::Monitor::GetSize
Geometry::Size GetSize() const
Returns the size of this monitor in pixels.
Definition: WindowManager.h:89
Gorgon::Window::MinimizedEvent
Event< Window > MinimizedEvent
Called after the window is minimized, either by the user or programmatically.
Definition: Window.h:374
Gorgon::Window::ClosingEvent
Event< Window, bool & > ClosingEvent
Called when user tries to close the window.
Definition: Window.h:365
Gorgon::internal::windowdata::context
GLXContext context
Definition: X11.h:41
Gorgon::WindowManager::XA_UTF8_STRING
Atom XA_UTF8_STRING
Definition: X11.h:73
Gorgon::Window::Restore
void Restore()
Restores a minimized or maximized window.
Definition: Window.cpp:508
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::Geometry::basic_Rectangle::Move
void Move(const basic_Point< T_ > &p)
Changes the position of the rectangle.
Definition: Rectangle.h:181
Gorgon::Window::AllowResize
void AllowResize()
Allows window to be resized by the user.
Definition: Window.cpp:619
Gorgon::Layer::bounds
Geometry::Bounds bounds
Bounds of this layer.
Definition: Layer.h:507
Gorgon::WindowManager::assertkeys
void assertkeys(Window &wind, Gorgon::internal::windowdata *data)
Definition: Input.cpp:267
Gorgon::Input::Keyboard::Keycodes::Up
constexpr Key Up
Definition: Keyboard.h:63
Gorgon::Window::Show
virtual void Show() override
Displays this window, may generate Activated event.
Definition: Window.cpp:257
Gorgon::WindowManager::handledndevent
void handledndevent(XEvent event, Window &wind)
Definition: DnD.cpp:312
WindowManager.h
contains window manager dependent functionality.
Gorgon::WindowManager::XA_NET_WM_STATE_ADD
Atom XA_NET_WM_STATE_ADD
Definition: X11.h:88
Gorgon::WindowManager::Monitor::GetLocation
Geometry::Point GetLocation() const
Returns the location of this monitor relative to the other monitors in pixels.
Definition: WindowManager.h:95
Gorgon::Layer::propagate_mouseevent
virtual bool propagate_mouseevent(Input::Mouse::EventType evet, Geometry::Point location, Input::Mouse::Button button, float amount, MouseHandler &handlers)
Propagates a mouse event.
Definition: Layer.cpp:63
Gorgon::WindowManager::Monitor::Primary
static Monitor & Primary()
Returns the default monitor.
Definition: WindowManager.h:122
Gorgon::Input::Mouse::MovePressed
@ MovePressed
Move event while a button is pressed.
Definition: Mouse.h:18
Layer.h
Gorgon::Window::HidePointer
void HidePointer()
Hides the pointer.
Definition: Window.cpp:280
Gorgon::Window::Resize
virtual void Resize(const Geometry::Size &size) override
Resizes the window to the given size.
Definition: Window.cpp:323
ASSERT
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
Gorgon::MouseHandler::Clear
void Clear()
Definition: Layer.h:49
Gorgon::Containers::Collection
Collection is a container for reference typed objects.
Definition: Collection.h:21
Gorgon::Geometry::Point
basic_Point< int > Point
Definition: Point.h:598
Gorgon::WindowManager::XA_NET_WM_ICON
Atom XA_NET_WM_ICON
Definition: X11.h:96
Gorgon::Transform
Geometry::Transform3D Transform
Current layer transformation, only for render and mouse.
Definition: Layer.cpp:18
Gorgon::WindowManager::XdndPosition
Atom XdndPosition
Definition: X11.h:104
Gorgon::internal::windowdata::handle
::Window handle
Definition: X11.h:35
Gorgon::MouseHandler
Definition: Layer.h:22
Gorgon::Input::Mouse::Over
@ Over
Definition: Mouse.h:16
Gorgon::Input::Mouse::DownPressed
@ DownPressed
Down event while a button is already pressed.
Definition: Mouse.h:21
Gorgon::Layer::Render
virtual void Render()
Renders the current layer, default handling is to pass the request to the sub-layers....
Definition: Layer.cpp:51
Gorgon::Input::DropTarget::propagate_mouseevent
virtual bool propagate_mouseevent(Input::Mouse::EventType event, Geometry::Point location, Input::Mouse::Button button, float amount, MouseHandler &handlers) override
Propagates a mouse event. Some events will be called directly.
Definition: DnD.cpp:67
Gorgon::Window::IsMiddleButtonPressed
bool IsMiddleButtonPressed() const
Query whether the middle mouse button is pressed.
Definition: Window.h:322
Gorgon::Graphics::Drawable::Draw
void Draw(TextureTarget &target, int x, int y, RGBAf color=RGBAf(1.f)) const
Draw to the given coordinates.
Definition: Drawables.h:22
Gorgon::WindowManager::WM_DELETE_WINDOW
Atom WM_DELETE_WINDOW
Definition: X11.h:70
Gorgon::internal::windowdata::ppoint
Geometry::Point ppoint
Definition: X11.h:43
Gorgon::Window::Render
virtual void Render() override
Renders the contents of the window.
Definition: Window.cpp:81
Gorgon::Window::GetExteriorBounds
Geometry::Bounds GetExteriorBounds() const
Returns the exterior bounding box of the window.
Definition: Window.cpp:417
Gorgon::Geometry::Bounds
basic_Bounds< int > Bounds
Definition: Bounds.h:722
Gorgon::Geometry::basic_Point::Distance
Float Distance(const basic_Point &target) const
Calculates Euclidean distance from this point to the given target.
Definition: Point.h:276
Gorgon::Window::Pointers
Graphics::PointerStack Pointers
Pointer system to be used within the window.
Definition: Window.h:346
Gorgon::Graphics::PointerStack
This class manages a pointer stack that allows multiple pointers to be registered and switched.
Definition: Pointer.h:309
Gorgon::Layer
This class is the base class for all layer types.
Definition: Layer.h:79
Gorgon::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Input.h
Gorgon::WindowManager::XA_NET_WM_STATE_FULLSCREEN
Atom XA_NET_WM_STATE_FULLSCREEN
Definition: X11.h:89
Gorgon::WindowManager::XA_NET_WM_STATE_MAXIMIZED_HORZ
Atom XA_NET_WM_STATE_MAXIMIZED_HORZ
Definition: X11.h:90
Gorgon::WindowManager::XA_NET_WM_STATE_MAXIMIZED_VERT
Atom XA_NET_WM_STATE_MAXIMIZED_VERT
Definition: X11.h:91
Gorgon::Window::IsFocused
bool IsFocused() const
Returns if this window has the focus.
Definition: Window.cpp:445
Gorgon::Window::SwitchToLocalPointers
void SwitchToLocalPointers()
Removes the operating system pointer and starts using Locally defined pointers.
Definition: Window.cpp:222
Gorgon::WindowManager::XA_NET_ACTIVE_WINDOW
Atom XA_NET_ACTIVE_WINDOW
Definition: X11.h:93
Gorgon::Window::mouse_down
void mouse_down(Geometry::Point location, Input::Mouse::Button button)
These functions are used internally.
Definition: Window.cpp:99
Gorgon::Input::Mouse::EventType
EventType
The type of a mouse event.
Definition: Mouse.h:14
Gorgon::Window::FocusedEvent
Event< Window > FocusedEvent
Called when this window is focused.
Definition: Window.h:352
Gorgon::Input::IsDragging
bool IsDragging()
Returns whether a drag operation is in progress.
Definition: DnD.h:1099
Gorgon::Graphics::Initialize
void Initialize()
Initializes Graphics module, should be performed after an OpenGL context is created.
Definition: Graphics.cpp:37
Gorgon::WindowManager::Monitor::Monitors
static const Containers::Collection< Monitor > & Monitors()
Returns all monitors connected to this device.
Definition: WindowManager.h:131
Gorgon::WindowManager::XA_NET_WM_NAME
Atom XA_NET_WM_NAME
Definition: X11.h:86
Gorgon::Window::DestroyedEvent
Event< Window > DestroyedEvent
Called when this window is destroyed.
Definition: Window.h:359
Gorgon::Graphics::PointerStack::Swap
void Swap(PointerStack &other)
Definition: Pointer.h:368
Event.h
contains event distribution mechanism
Gorgon::Byte
unsigned char Byte
Represents smallest cell in memory.
Definition: Types.h:9
Gorgon::Window::Windows
static const Containers::Collection< Window > & Windows
List of currently created windows.
Definition: Window.h:401
Gorgon::Window::Destroy
void Destroy()
Destroys this window.
Definition: Window.cpp:243
Gorgon::Geometry::basic_Rectangle::Y
T_ Y
Y coordinate of the top left corner of this rectangle.
Definition: Rectangle.h:357
Gorgon::Window::ResizedEvent
Event< Window > ResizedEvent
Called after the window is resized, either by the user or programmatically.
Definition: Window.h:371
Gorgon::Window::Move
virtual void Move(int x, int y) override
Moves the window to the given position.
Definition: Window.h:168
Gorgon::Window::GetMonitor
const WindowManager::Monitor & GetMonitor() const
Returns the monitor that the window is currently on.
Definition: Window.cpp:205
Gorgon::Input::Mouse::Middle
@ Middle
Definition: Mouse.h:35
Pointer.h
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::Geometry::basic_Rectangle::Height
T_ Height
Height of the rectangle.
Definition: Rectangle.h:363
Gorgon::WindowManager::XA_NET_WM_STATE_HIDDEN
Atom XA_NET_WM_STATE_HIDDEN
Definition: X11.h:92
Gorgon::Window::Center
void Center(const WindowManager::Monitor &monitor)
Centers the window to the given monitor.
Definition: Window.h:289
Gorgon::Geometry::basic_Bounds::Center
basic_Point< T_ > Center() const
Returns center of bounds.
Definition: Bounds.h:115
Gorgon::Window::LostFocusEvent
Event< Window > LostFocusEvent
Called when this window is deactivated.
Definition: Window.h:355
Gorgon::Geometry::basic_Point::Y
T_ Y
Y coordinate.
Definition: Point.h:371
Gorgon::Geometry::basic_Bounds::TopLeft
basic_Point< T_ > TopLeft() const
Returns top left corner.
Definition: Bounds.h:105
Gorgon::Layer::Hide
virtual void Hide()
Hides this layer.
Definition: Layer.h:456
Gorgon::Layer::Show
virtual void Show()
Displays this layer.
Definition: Layer.h:453
Gorgon::WindowManager::Icon
Represents an icon object that can be used as window icon.
Definition: WindowManager.h:43
Gorgon::Geometry::basic_Size::Width
T_ Width
Width of this size object.
Definition: Size.h:258
Gorgon::Geometry::basic_Bounds::GetSize
basic_Size< T_ > GetSize() const
Returns the size of the bounds object.
Definition: Bounds.h:141
Gorgon::Window::GetName
std::string GetName() const
Returns the name of the window that is set at creation time.
Definition: Window.h:247
Gorgon::Window::added
virtual void added(Layer &layer) override
Will be called when a layer is added.
Definition: Window.cpp:216
Gorgon::Input::Mouse::Button
Button
Lists the mouse button constants.
Definition: Mouse.h:31
Gorgon::Input::Keyboard::Keycodes::Right
constexpr Key Right
Definition: Keyboard.h:64
Gorgon::Window::located
virtual void located(Layer *) override
A window cannot be placed in another layer. This function always fails.
Definition: Window.h:419
Gorgon::Window::ShowPointer
void ShowPointer()
Displays the pointer.
Definition: Window.cpp:295
Gorgon::internal::windowdata::ismapped
bool ismapped
Definition: X11.h:40
Gorgon::Window::Maximize
void Maximize()
Maximizes the window to cover the usable area of the screen.
Definition: Window.cpp:459
Gorgon::Layer::Swap
void Swap(Layer &other)
Swaps two layers, mostly used for move semantics.
Definition: Layer.h:125
Gorgon::Window::Center
void Center()
Centers the window to the default monitor.
Definition: Window.h:284
Gorgon::Offset
Geometry::Point Offset
Current layer offset from the top left of the window.
Definition: Layer.cpp:21
Gorgon::Input::DropTarget
This layer acts as a drop target.
Definition: DnD.h:63
Gorgon::Input::GetDragOperation
DragInfo & GetDragOperation()
Returns the current drag operation, throws if IsDragPrepared is false.
Definition: DnD.h:1109
Gorgon::Window::deleting
void deleting(Layer *layer)
Definition: Window.h:424
Gorgon::GL::Resize
void Resize(const Geometry::Size &size)
Resizes the active context.
Definition: OpenGL.cpp:273
Gorgon::Geometry::basic_Rectangle
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
Gorgon::Layer::children
Containers::Collection< Layer > children
Child layers that this layer holds, all child layers are considered to be above current layer.
Definition: Layer.h:501
Gorgon::WindowManager::XdndDrop
Atom XdndDrop
Definition: X11.h:106
Gorgon::MouseHandler::layers
Containers::Collection< Layer > layers
Definition: Layer.h:61
Gorgon::Window::windaccess
friend class windaccess
Definition: Window.h:35
X11.h
Gorgon::Input::Mouse::Out
@ Out
Definition: Mouse.h:19
Gorgon::Window::SwitchToWMPointers
void SwitchToWMPointers()
Stops showing local pointers and makes window manager pointer visible.
Definition: Window.cpp:228
Gorgon::Window::Close
void Close()
Closes the window. After this function, any use of this object might fail.
Definition: Window.cpp:340
Gorgon::Window::GetMouseLocation
Geometry::Point GetMouseLocation() const
Returns the mouse location on the window.
Definition: Window.h:302
Gorgon::WindowManager::XA_NET_WM_STATE
Atom XA_NET_WM_STATE
Definition: X11.h:87
Gorgon::Window::activatecontext
void activatecontext()
Activates the GL context of the window.
Definition: Window.cpp:77
Gorgon::Layer::isvisible
bool isvisible
Whether this layer is visible, invisible layers will not be drawn or receive any events.
Definition: Layer.h:511
Gorgon::Input::Keyboard::Keycodes::Left
constexpr Key Left
Definition: Keyboard.h:62
Gorgon::ScreenSize
Geometry::Size ScreenSize
Definition: Window.cpp:15
Keyboard.h
Gorgon::LayerColor
Graphics::RGBAf LayerColor
Definition: Layer.cpp:172
Gorgon::Window::MovedEvent
Event< Window > MovedEvent
Called after the window is moved, either by the user or programmatically.
Definition: Window.h:368
Gorgon::Window::GetPosition
Geometry::Point GetPosition() const
Returns the current position of the window.
Definition: Window.h:196
FrameBuffer.h
Gorgon::Input::CancelDrag
void CancelDrag()
Cancel the current drag operation.
Definition: DnD.cpp:207
Gorgon::Window::KeyEvent
ConsumableEvent< Window, Input::Key, float > KeyEvent
Called when a key is pressed or released.
Definition: Window.h:392
Gorgon::internal::windowdata
Definition: X11.h:34
Gorgon::WindowManager::Monitor
Definition: WindowManager.h:84
Gorgon::WindowManager::XdndEnter
Atom XdndEnter
Definition: X11.h:101
Gorgon::Layer::GetSize
Geometry::Size GetSize() const
Returns the size of the layer.
Definition: Layer.h:362
Gorgon::Input::Keyboard::Keycodes::Down
constexpr Key Down
Definition: Keyboard.h:65
Gorgon::Window::PreventResize
void PreventResize()
Prevents window to be resized by the user.
Definition: Window.cpp:631