| 56 | } |
| 57 | |
| 58 | WindowsWindow::WindowsWindow(const CreateWindowSettings& settings) |
| 59 | : WindowBase(settings) |
| 60 | #if USE_EDITOR |
| 61 | , _refCount(1) |
| 62 | #endif |
| 63 | { |
| 64 | int32 x = Math::TruncToInt(settings.Position.X); |
| 65 | int32 y = Math::TruncToInt(settings.Position.Y); |
| 66 | int32 clientWidth = Math::TruncToInt(settings.Size.X); |
| 67 | int32 clientHeight = Math::TruncToInt(settings.Size.Y); |
| 68 | int32 windowWidth = clientWidth; |
| 69 | int32 windowHeight = clientHeight; |
| 70 | _clientSize = Float2((float)clientWidth, (float)clientHeight); |
| 71 | |
| 72 | // Setup window style |
| 73 | uint32 style = WS_POPUP, exStyle = 0; |
| 74 | #if !WINDOWS_LAZY_SET_LAYERED_FOR_TRANSPARENCY |
| 75 | if (settings.SupportsTransparency) |
| 76 | exStyle |= WS_EX_LAYERED; |
| 77 | #endif |
| 78 | if (!settings.ActivateWhenFirstShown) |
| 79 | exStyle |= WS_EX_NOACTIVATE; |
| 80 | if (settings.ShowInTaskbar) |
| 81 | exStyle |= WS_EX_APPWINDOW; |
| 82 | else |
| 83 | exStyle |= WS_EX_TOOLWINDOW; |
| 84 | if (settings.IsTopmost) |
| 85 | exStyle |= WS_EX_TOPMOST; |
| 86 | if (!settings.AllowInput) |
| 87 | exStyle |= WS_EX_TRANSPARENT; |
| 88 | if (settings.AllowMaximize) |
| 89 | style |= WS_MAXIMIZEBOX; |
| 90 | if (settings.AllowMinimize) |
| 91 | style |= WS_MINIMIZEBOX; |
| 92 | if (settings.HasSizingFrame) |
| 93 | style |= WS_THICKFRAME; |
| 94 | |
| 95 | // Check if window should have a border |
| 96 | if (settings.HasBorder) |
| 97 | { |
| 98 | // Create window style flags |
| 99 | style |= WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WS_CAPTION; |
| 100 | exStyle |= 0; |
| 101 | |
| 102 | // Adjust window size and positions to take into account window border |
| 103 | RECT winRect = { 0, 0, clientWidth, clientHeight }; |
| 104 | AdjustWindowRectEx(&winRect, style, FALSE, exStyle); |
| 105 | x += winRect.left; |
| 106 | y += winRect.top; |
| 107 | windowWidth = winRect.right - winRect.left; |
| 108 | windowHeight = winRect.bottom - winRect.top; |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | // Create window style flags |
| 113 | style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
| 114 | #if WINDOWS_USE_NEW_BORDER_LESS |
| 115 | if (settings.Type == WindowType::Regular) |
nothing calls this directly
no test coverage detected