| 13 | class CustomWindow { |
| 14 | public: |
| 15 | void create(const std::string& title, int w, int h, os::Window* parent = nullptr) |
| 16 | { |
| 17 | os::WindowSpec spec; |
| 18 | |
| 19 | if (parent) { |
| 20 | spec.floating(true); |
| 21 | spec.parent(parent); |
| 22 | spec.minimizable(false); |
| 23 | |
| 24 | gfx::Rect rc = parent->frame(); |
| 25 | spec.frame(gfx::Rect(rc.x2() - w / 2, rc.y + rc.h / 2 - h / 2, w, h)); |
| 26 | spec.position(os::WindowSpec::Position::Frame); |
| 27 | } |
| 28 | else { |
| 29 | spec.contentRect(gfx::Rect(0, 0, w, h)); |
| 30 | spec.position(os::WindowSpec::Position::Default); |
| 31 | } |
| 32 | |
| 33 | m_nativeWindow = System::instance()->makeWindow(spec); |
| 34 | m_nativeWindow->setTitle(title); |
| 35 | m_nativeWindow->setUserData(this); |
| 36 | |
| 37 | redraw(); |
| 38 | } |
| 39 | |
| 40 | void close() { m_nativeWindow = nullptr; } |
| 41 |
nothing calls this directly
no test coverage detected