aboutsummaryrefslogtreecommitdiff
path: root/src/platform/gui/sdl/Window.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-27 17:39:31 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-27 17:39:31 +0800
commit97ca464fc9e9da4e20e3320559a6f4ac3203fe84 (patch)
treefa23dd3d31fd6c86814ef4505ae2f7966b840ed2 /src/platform/gui/sdl/Window.cpp
parent6e8d570e3d63b5bc4e24d258d2dd383530ace2a3 (diff)
downloadcru-97ca464fc9e9da4e20e3320559a6f4ac3203fe84.tar.gz
cru-97ca464fc9e9da4e20e3320559a6f4ac3203fe84.tar.bz2
cru-97ca464fc9e9da4e20e3320559a6f4ac3203fe84.zip
Clean code. Use event define macro of native window on linux.
Diffstat (limited to 'src/platform/gui/sdl/Window.cpp')
-rw-r--r--src/platform/gui/sdl/Window.cpp56
1 files changed, 9 insertions, 47 deletions
diff --git a/src/platform/gui/sdl/Window.cpp b/src/platform/gui/sdl/Window.cpp
index 72ccc873..654ac4cd 100644
--- a/src/platform/gui/sdl/Window.cpp
+++ b/src/platform/gui/sdl/Window.cpp
@@ -15,7 +15,7 @@
namespace cru::platform::gui::sdl {
-SdlWindow::SdlWindow(SdlUiApplication *application)
+SdlWindow::SdlWindow(SdlUiApplication* application)
: application_(application), parent_(nullptr) {
application->RegisterWindow(this);
}
@@ -30,9 +30,9 @@ void SdlWindow::Close() {
}
}
-INativeWindow *SdlWindow::GetParent() { return parent_; }
+INativeWindow* SdlWindow::GetParent() { return parent_; }
-void SdlWindow::SetParent(INativeWindow *parent) {
+void SdlWindow::SetParent(INativeWindow* parent) {
parent_ = CheckPlatform<SdlWindow>(parent, GetPlatformId());
NotImplemented();
}
@@ -56,7 +56,7 @@ void SdlWindow::SetVisibility(WindowVisibilityType visibility) {
Size SdlWindow::GetClientSize() { return GetClientRect().GetSize(); }
-void SdlWindow::SetClientSize(const Size &size) {
+void SdlWindow::SetClientSize(const Size& size) {
auto rect = GetClientRect();
SetClientRect(Rect(rect.GetLeftTop(), size));
}
@@ -66,7 +66,7 @@ Rect SdlWindow::GetClientRect() {
NotImplemented();
}
-void SdlWindow::SetClientRect(const Rect &rect) {
+void SdlWindow::SetClientRect(const Rect& rect) {
if (!sdl_window_) return;
NotImplemented();
}
@@ -76,7 +76,7 @@ Rect SdlWindow::GetWindowRect() {
NotImplemented();
}
-void SdlWindow::SetWindowRect(const Rect &rect) {
+void SdlWindow::SetWindowRect(const Rect& rect) {
if (!sdl_window_) return;
NotImplemented();
}
@@ -121,48 +121,10 @@ std::unique_ptr<graphics::IPainter> SdlWindow::BeginPaint() {
NotImplemented();
}
-IEvent<std::nullptr_t> *SdlWindow::CreateEvent() { return &create_event_; }
+IInputMethodContext* SdlWindow::GetInputMethodContext() { NotImplemented(); }
-IEvent<std::nullptr_t> *SdlWindow::DestroyEvent() { return &destroy_event_; }
+std::optional<SDL_Window*> SdlWindow::GetSdlWindow() { return sdl_window_; }
-IEvent<std::nullptr_t> *SdlWindow::PaintEvent() { return &paint_event_; }
-
-IEvent<WindowVisibilityType> *SdlWindow::VisibilityChangeEvent() {
- return &visibility_change_event_;
-}
-
-IEvent<const Size&> *SdlWindow::ResizeEvent() { return &resize_event_; }
-
-IEvent<FocusChangeType> *SdlWindow::FocusEvent() { return &focus_event_; }
-
-IEvent<MouseEnterLeaveType> *SdlWindow::MouseEnterLeaveEvent() {
- return &mouse_enter_leave_event_;
-}
-
-IEvent<const Point&> *SdlWindow::MouseMoveEvent() { return &mouse_move_event_; }
-
-IEvent<const NativeMouseButtonEventArgs&> *SdlWindow::MouseDownEvent() {
- return &mouse_down_event_;
-}
-
-IEvent<const NativeMouseButtonEventArgs&> *SdlWindow::MouseUpEvent() {
- return &mouse_up_event_;
-}
-
-IEvent<const NativeMouseWheelEventArgs&> *SdlWindow::MouseWheelEvent() {
- return &mouse_wheel_event_;
-}
-
-IEvent<const NativeKeyEventArgs&> *SdlWindow::KeyDownEvent() {
- return &key_down_event_;
-}
-
-IEvent<const NativeKeyEventArgs&> *SdlWindow::KeyUpEvent() { return &key_up_event_; }
-
-IInputMethodContext *SdlWindow::GetInputMethodContext() { NotImplemented(); }
-
-std::optional<SDL_Window *> SdlWindow::GetSdlWindow() { return sdl_window_; }
-
-SdlUiApplication *SdlWindow::GetSdlUiApplication() { return application_; }
+SdlUiApplication* SdlWindow::GetSdlUiApplication() { return application_; }
} // namespace cru::platform::gui::sdl