MCPcopy Create free account
hub / github.com/aseprite/laf / create

Method create

examples/floating_window.cpp:15–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13class CustomWindow {
14public:
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

Callers

nothing calls this directly

Calls 11

instanceFunction · 0.85
floatingMethod · 0.80
parentMethod · 0.80
minimizableMethod · 0.80
x2Method · 0.80
setUserDataMethod · 0.80
frameMethod · 0.45
positionMethod · 0.45
contentRectMethod · 0.45
makeWindowMethod · 0.45
setTitleMethod · 0.45

Tested by

no test coverage detected