aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/native/native_window.hpp
blob: 3e83a5317d276c7deb272d86e6318e034499af5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "cru/common/base.hpp"

#include "basic_types.hpp"
#include "cru/common/event.hpp"
#include "cru/common/ui_base.hpp"
#include "native_event.hpp"

namespace cru::platform::graph {
struct IPainter;
}

namespace cru::platform::native {
struct INativeWindow : public virtual Interface {
  // Return if the window is still valid, that is, hasn't been closed or
  // destroyed.
  virtual bool IsValid() = 0;
  virtual void SetDeleteThisOnDestroy(bool value) = 0;

  virtual void Close() = 0;

  virtual INativeWindow* GetParent() = 0;

  virtual bool IsVisible() = 0;
  virtual void SetVisible(bool is_visible) = 0;

  virtual ui::Size GetClientSize() = 0;
  virtual void SetClientSize(const ui::Size& size) = 0;

  // Get the rect of the window containing frame.
  // The lefttop of the rect is relative to screen lefttop.
  virtual ui::Rect GetWindowRect() = 0;

  // Set the rect of the window containing frame.
  // The lefttop of the rect is relative to screen lefttop.
  virtual void SetWindowRect(const ui::Rect& rect) = 0;

  virtual graph::IPainter* BeginPaint() = 0;

  virtual IEvent<std::nullptr_t>* DestroyEvent() = 0;
  virtual IEvent<std::nullptr_t>* PaintEvent() = 0;
  virtual IEvent<ui::Size>* ResizeEvent() = 0;
  virtual IEvent<bool>* FocusEvent() = 0;
  virtual IEvent<bool>* MouseEnterLeaveEvent() = 0;
  virtual IEvent<ui::Point>* MouseMoveEvent() = 0;
  virtual IEvent<NativeMouseButtonEventArgs>* MouseDownEvent() = 0;
  virtual IEvent<NativeMouseButtonEventArgs>* MouseUpEvent() = 0;
  virtual IEvent<int>* KeyDownEvent() = 0;
  virtual IEvent<int>* KeyUpEvent() = 0;
};
}  // namespace cru::platform::native