diff --git a/include/zwidget/widgets/imagebox/imagebox.h b/include/zwidget/widgets/imagebox/imagebox.h index e3a7243..7d3aa52 100644 --- a/include/zwidget/widgets/imagebox/imagebox.h +++ b/include/zwidget/widgets/imagebox/imagebox.h @@ -11,6 +11,7 @@ class ImageBox : public Widget void SetImage(std::shared_ptr newImage); + double GetPreferredWidth() const; double GetPreferredHeight() const; protected: diff --git a/include/zwidget/widgets/menubar/menubar.h b/include/zwidget/widgets/menubar/menubar.h index 9c13283..d9f0843 100644 --- a/include/zwidget/widgets/menubar/menubar.h +++ b/include/zwidget/widgets/menubar/menubar.h @@ -2,6 +2,13 @@ #pragma once #include "../../core/widget.h" +#include "../textlabel/textlabel.h" +#include "../imagebox/imagebox.h" + +class Menu; +class MenubarItem; +class MenuItem; +class MenuItemSeparator; class Menubar : public Widget { @@ -9,6 +16,83 @@ class Menubar : public Widget Menubar(Widget* parent); ~Menubar(); + MenubarItem* AddItem(std::string text, std::function onOpen, bool alignRight = false); + +protected: + void OnGeometryChanged() override; + +private: + void ShowMenu(MenubarItem* item); + void CloseMenu(); + + std::vector menuItems; + Menu* openMenu = nullptr; + + friend class MenubarItem; +}; + +class MenubarItem : public Widget +{ +public: + MenubarItem(Menubar* menubar, std::string text, bool alignRight); + + void SetOpenCallback(std::function callback) { onOpen = std::move(callback); } + const std::function& GetOpenCallback() const { return onOpen; } + + double GetPreferredWidth() const; + + bool AlignRight = false; + protected: void OnPaint(Canvas* canvas) override; + bool OnMouseDown(const Point& pos, InputKey key) override; + bool OnMouseUp(const Point& pos, InputKey key) override; + void OnMouseMove(const Point& pos) override; + void OnMouseLeave() override; + +private: + Menubar* menubar = nullptr; + std::function onOpen; + std::string text; +}; + +class Menu : public Widget +{ +public: + Menu(Widget* parent); + + void SetLeftPosition(const Point& globalPos); + void SetRightPosition(const Point& globalPos); + MenuItem* AddItem(std::shared_ptr icon, std::string text, std::function onClick = {}); + MenuItemSeparator* AddSeparator(); + + double GetPreferredWidth() const; + double GetPreferredHeight() const; + +protected: + void OnGeometryChanged() override; + + std::function onCloseMenu; + + friend class Menubar; +}; + +class MenuItem : public Widget +{ +public: + MenuItem(Widget* parent); + + ImageBox* icon = nullptr; + TextLabel* text = nullptr; + +protected: + void OnMouseMove(const Point& pos) override; + void OnMouseLeave() override; + void OnGeometryChanged() override; +}; + +class MenuItemSeparator : public Widget +{ +public: + MenuItemSeparator(Widget* parent); }; diff --git a/include/zwidget/window/window.h b/include/zwidget/window/window.h index 8515f50..538c704 100644 --- a/include/zwidget/window/window.h +++ b/include/zwidget/window/window.h @@ -118,7 +118,7 @@ class DisplayWindowHost class DisplayWindow { public: - static std::unique_ptr Create(DisplayWindowHost* windowHost); + static std::unique_ptr Create(DisplayWindowHost* windowHost, bool popupWindow); static void ProcessEvents(); static void RunLoop(); @@ -157,6 +157,9 @@ class DisplayWindow virtual int GetPixelHeight() const = 0; virtual double GetDpiScale() const = 0; + virtual Point MapFromGlobal(const Point& pos) const = 0; + virtual Point MapToGlobal(const Point& pos) const = 0; + virtual void SetBorderColor(uint32_t bgra8) = 0; virtual void SetCaptionColor(uint32_t bgra8) = 0; virtual void SetCaptionTextColor(uint32_t bgra8) = 0; diff --git a/src/core/theme.cpp b/src/core/theme.cpp index f30bffd..b85b897 100644 --- a/src/core/theme.cpp +++ b/src/core/theme.cpp @@ -154,6 +154,9 @@ DarkWidgetTheme::DarkWidgetTheme() auto tabbar_tab = RegisterStyle(std::make_unique(widget), "tabbar-tab"); auto tabwidget_stack = RegisterStyle(std::make_unique(widget), "tabwidget-stack"); auto checkbox_label = RegisterStyle(std::make_unique(widget), "checkbox-label"); + auto menubaritem = RegisterStyle(std::make_unique(widget), "menubaritem"); + auto menu = RegisterStyle(std::make_unique(widget), "menu"); + auto menuitem = RegisterStyle(std::make_unique(widget), "menuitem"); widget->SetString("font-family", "NotoSans"); widget->SetColor("color", Colorf::fromRgba8(226, 223, 219)); @@ -229,6 +232,21 @@ DarkWidgetTheme::DarkWidgetTheme() checkbox_label->SetColor("checked-color", Colorf::fromRgba8(226, 223, 219)); checkbox_label->SetColor("unchecked-outer-border-color", Colorf::fromRgba8(99, 99, 99)); checkbox_label->SetColor("unchecked-inner-border-color", Colorf::fromRgba8(51, 51, 51)); + + menubaritem->SetColor("hover", "background-color", Colorf::fromRgba8(78, 78, 78)); + menubaritem->SetColor("down", "background-color", Colorf::fromRgba8(88, 88, 88)); + + menu->SetDouble("noncontent-left", 5.0); + menu->SetDouble("noncontent-top", 5.0); + menu->SetDouble("noncontent-right", 5.0); + menu->SetDouble("noncontent-bottom", 5.0); + menu->SetColor("border-left-color", Colorf::fromRgba8(100, 100, 100)); + menu->SetColor("border-top-color", Colorf::fromRgba8(100, 100, 100)); + menu->SetColor("border-right-color", Colorf::fromRgba8(100, 100, 100)); + menu->SetColor("border-bottom-color", Colorf::fromRgba8(100, 100, 100)); + + menuitem->SetColor("hover", "background-color", Colorf::fromRgba8(78, 78, 78)); + menuitem->SetColor("down", "background-color", Colorf::fromRgba8(88, 88, 88)); } ///////////////////////////////////////////////////////////////////////////// @@ -246,6 +264,9 @@ LightWidgetTheme::LightWidgetTheme() auto tabbar_tab = RegisterStyle(std::make_unique(widget), "tabbar-tab"); auto tabwidget_stack = RegisterStyle(std::make_unique(widget), "tabwidget-stack"); auto checkbox_label = RegisterStyle(std::make_unique(widget), "checkbox-label"); + auto menubaritem = RegisterStyle(std::make_unique(widget), "menubaritem"); + auto menu = RegisterStyle(std::make_unique(widget), "menu"); + auto menuitem = RegisterStyle(std::make_unique(widget), "menuitem"); widget->SetString("font-family", "NotoSans"); widget->SetColor("color", Colorf::fromRgba8(0, 0, 0)); @@ -321,4 +342,19 @@ LightWidgetTheme::LightWidgetTheme() checkbox_label->SetColor("checked-color", Colorf::fromRgba8(50, 50, 50)); checkbox_label->SetColor("unchecked-outer-border-color", Colorf::fromRgba8(156, 156, 156)); checkbox_label->SetColor("unchecked-inner-border-color", Colorf::fromRgba8(200, 200, 200)); + + menubaritem->SetColor("hover", "background-color", Colorf::fromRgba8(200, 200, 200)); + menubaritem->SetColor("down", "background-color", Colorf::fromRgba8(190, 190, 190)); + + menu->SetDouble("noncontent-left", 5.0); + menu->SetDouble("noncontent-top", 5.0); + menu->SetDouble("noncontent-right", 5.0); + menu->SetDouble("noncontent-bottom", 5.0); + menu->SetColor("border-left-color", Colorf::fromRgba8(155, 155, 155)); + menu->SetColor("border-top-color", Colorf::fromRgba8(155, 155, 155)); + menu->SetColor("border-right-color", Colorf::fromRgba8(155, 155, 155)); + menu->SetColor("border-bottom-color", Colorf::fromRgba8(155, 155, 155)); + + menuitem->SetColor("hover", "background-color", Colorf::fromRgba8(200, 200, 200)); + menuitem->SetColor("down", "background-color", Colorf::fromRgba8(190, 190, 190)); } diff --git a/src/core/widget.cpp b/src/core/widget.cpp index 299857c..c1a8156 100644 --- a/src/core/widget.cpp +++ b/src/core/widget.cpp @@ -9,7 +9,7 @@ Widget::Widget(Widget* parent, WidgetType type) : Type(type) { if (type != WidgetType::Child) { - DispWindow = DisplayWindow::Create(this); + DispWindow = DisplayWindow::Create(this, type == WidgetType::Popup); DispCanvas = Canvas::create(DispWindow.get()); SetStyleState("root"); @@ -510,7 +510,7 @@ Point Widget::MapFromGlobal(const Point& pos) const { if (cur->DispWindow) { - return p - cur->GetFrameGeometry().topLeft(); + return cur->DispWindow->MapFromGlobal(p); } p -= cur->ContentGeometry.topLeft(); } @@ -536,7 +536,7 @@ Point Widget::MapToGlobal(const Point& pos) const { if (cur->DispWindow) { - return cur->GetFrameGeometry().topLeft() + p; + return cur->DispWindow->MapToGlobal(p); } p += cur->ContentGeometry.topLeft(); } @@ -705,9 +705,21 @@ void Widget::OnWindowKeyUp(InputKey key) void Widget::OnWindowGeometryChanged() { + if (!DispWindow) + return; Size size = DispWindow->GetClientSize(); FrameGeometry = Rect::xywh(0.0, 0.0, size.width, size.height); - ContentGeometry = FrameGeometry; + + double left = FrameGeometry.left() + GetNoncontentLeft(); + double top = FrameGeometry.top() + GetNoncontentTop(); + double right = FrameGeometry.right() - GetNoncontentRight(); + double bottom = FrameGeometry.bottom() - GetNoncontentBottom(); + left = std::min(left, FrameGeometry.right()); + top = std::min(top, FrameGeometry.bottom()); + right = std::max(right, FrameGeometry.left()); + bottom = std::max(bottom, FrameGeometry.top()); + ContentGeometry = Rect::ltrb(left, top, right, bottom); + OnGeometryChanged(); } diff --git a/src/widgets/imagebox/imagebox.cpp b/src/widgets/imagebox/imagebox.cpp index 45d35a1..37253c8 100644 --- a/src/widgets/imagebox/imagebox.cpp +++ b/src/widgets/imagebox/imagebox.cpp @@ -5,6 +5,14 @@ ImageBox::ImageBox(Widget* parent) : Widget(parent) { } +double ImageBox::GetPreferredWidth() const +{ + if (image) + return (double)image->GetWidth(); + else + return 0.0; +} + double ImageBox::GetPreferredHeight() const { if (image) diff --git a/src/widgets/lineedit/lineedit.cpp b/src/widgets/lineedit/lineedit.cpp index 2905604..38b928f 100644 --- a/src/widgets/lineedit/lineedit.cpp +++ b/src/widgets/lineedit/lineedit.cpp @@ -1,4 +1,4 @@ -#include + #include "widgets/lineedit/lineedit.h" #include "core/utf8reader.h" #include "core/colorf.h" diff --git a/src/widgets/menubar/menubar.cpp b/src/widgets/menubar/menubar.cpp index 8a66ce8..5171285 100644 --- a/src/widgets/menubar/menubar.cpp +++ b/src/widgets/menubar/menubar.cpp @@ -4,13 +4,214 @@ Menubar::Menubar(Widget* parent) : Widget(parent) { + SetStyleClass("menubar"); } Menubar::~Menubar() { } -void Menubar::OnPaint(Canvas* canvas) +MenubarItem* Menubar::AddItem(std::string text, std::function onOpen, bool alignRight) { - canvas->drawText(Point(16.0, 21.0), Colorf::fromRgba8(0, 0, 0), "File Edit View Tools Window Help"); + auto item = new MenubarItem(this, text, alignRight); + item->SetOpenCallback(std::move(onOpen)); + menuItems.push_back(item); + OnGeometryChanged(); + return item; +} + +void Menubar::ShowMenu(MenubarItem* item) +{ + CloseMenu(); + if (item->GetOpenCallback()) + { + openMenu = new Menu(this); + openMenu->onCloseMenu = [=]() { CloseMenu(); }; + item->GetOpenCallback()(openMenu); + if (item->AlignRight) + openMenu->SetRightPosition(item->MapToGlobal(Point(item->GetWidth(), item->GetHeight()))); + else + openMenu->SetLeftPosition(item->MapToGlobal(Point(0.0, item->GetHeight()))); + openMenu->Show(); + } +} + +void Menubar::CloseMenu() +{ + //delete openMenu; + //openMenu = nullptr; +} + +void Menubar::OnGeometryChanged() +{ + double w = GetWidth(); + double h = GetHeight(); + double left = 0.0; + double right = w; + for (MenubarItem* item : menuItems) + { + double itemwidth = item->GetPreferredWidth(); + itemwidth += 16.0; + if (!item->AlignRight) + { + item->SetFrameGeometry(left, 0.0, itemwidth, h); + left += itemwidth; + } + else + { + right -= itemwidth; + item->SetFrameGeometry(right, 0.0, itemwidth, h); + } + } +} + +///////////////////////////////////////////////////////////////////////////// + +MenubarItem::MenubarItem(Menubar* menubar, std::string text, bool alignRight) : Widget(menubar), menubar(menubar), text(text), AlignRight(alignRight) +{ + SetStyleClass("menubaritem"); +} + +bool MenubarItem::OnMouseDown(const Point& pos, InputKey key) +{ + menubar->ShowMenu(this); + return true; +} + +bool MenubarItem::OnMouseUp(const Point& pos, InputKey key) +{ + return true; +} + +void MenubarItem::OnMouseMove(const Point& pos) +{ + if (GetStyleState().empty()) + { + SetStyleState("hover"); + } +} + +void MenubarItem::OnMouseLeave() +{ + SetStyleState(""); +} + +double MenubarItem::GetPreferredWidth() const +{ + Canvas* canvas = GetCanvas(); + return canvas->measureText(text).width; +} + +void MenubarItem::OnPaint(Canvas* canvas) +{ + double x = (GetWidth() - canvas->measureText(text).width) * 0.5; + canvas->drawText(Point(x, 21.0), GetStyleColor("color"), text); +} + +///////////////////////////////////////////////////////////////////////////// + +Menu::Menu(Widget* parent) : Widget(parent, WidgetType::Popup) +{ + SetStyleClass("menu"); +} + +void Menu::SetLeftPosition(const Point& pos) +{ + SetFrameGeometry(Rect::xywh(pos.x, pos.y, GetPreferredWidth() + GetNoncontentLeft() + GetNoncontentRight(), GetPreferredHeight() + GetNoncontentTop() + GetNoncontentBottom())); +} + +void Menu::SetRightPosition(const Point& pos) +{ + SetFrameGeometry(Rect::xywh(pos.x - GetWidth() - GetNoncontentLeft() - GetNoncontentRight(), pos.y, GetWidth() + GetNoncontentLeft() + GetNoncontentRight(), GetHeight() + GetNoncontentTop() + GetNoncontentBottom())); +} + +MenuItem* Menu::AddItem(std::shared_ptr icon, std::string text, std::function onClick) +{ + auto item = new MenuItem(this); + if (icon) + item->icon->SetImage(icon); + item->text->SetText(text); + /* + item->element->addEventListener("click", [=](Event* event) + { + event->stopPropagation(); + if (onCloseMenu) + onCloseMenu(); + if (onClick) + onClick(); + }); + */ + return item; +} + +MenuItemSeparator* Menu::AddSeparator() +{ + auto sep = new MenuItemSeparator(this); + return sep; +} + +double Menu::GetPreferredWidth() const +{ + return 200.0; +} + +double Menu::GetPreferredHeight() const +{ + double h = 0.0; + for (Widget* item = FirstChild(); item != nullptr; item = item->NextSibling()) + { + h += 20.0; + } + return h; +} + +void Menu::OnGeometryChanged() +{ + double w = GetWidth(); + double h = GetHeight(); + double y = 0.0; + for (Widget* item = FirstChild(); item != nullptr; item = item->NextSibling()) + { + item->SetFrameGeometry(Rect::xywh(0.0, y, w, 20.0)); + y += 20.0; + } +} + +///////////////////////////////////////////////////////////////////////////// + +MenuItem::MenuItem(Widget* parent) : Widget(parent) +{ + SetStyleClass("menuitem"); + icon = new ImageBox(this); + text = new TextLabel(this); +} + +void MenuItem::OnMouseMove(const Point& pos) +{ + if (GetStyleState().empty()) + { + SetStyleState("hover"); + } +} + +void MenuItem::OnMouseLeave() +{ + SetStyleState(""); +} + +void MenuItem::OnGeometryChanged() +{ + double iconwidth = icon->GetPreferredWidth(); + double iconheight = icon->GetPreferredHeight(); + double w = GetWidth(); + double h = GetHeight(); + icon->SetFrameGeometry(Rect::xywh(0.0, (h - iconheight) * 0.5, iconwidth, iconheight)); + text->SetFrameGeometry(Rect::xywh(iconwidth, 0.0, w - iconwidth, h)); +} + +///////////////////////////////////////////////////////////////////////////// + +MenuItemSeparator::MenuItemSeparator(Widget* parent) : Widget(parent) +{ + SetStyleClass("menuitemseparator"); } diff --git a/src/window/sdl2/sdl2displaywindow.cpp b/src/window/sdl2/sdl2displaywindow.cpp index f80fe86..5e44cb6 100644 --- a/src/window/sdl2/sdl2displaywindow.cpp +++ b/src/window/sdl2/sdl2displaywindow.cpp @@ -24,11 +24,14 @@ static void CheckInitSDL() static InitSDL initsdl; } -SDL2DisplayWindow::SDL2DisplayWindow(DisplayWindowHost* windowHost) : WindowHost(windowHost) +SDL2DisplayWindow::SDL2DisplayWindow(DisplayWindowHost* windowHost, bool popupWindow) : WindowHost(windowHost) { CheckInitSDL(); - int result = SDL_CreateWindowAndRenderer(320, 200, SDL_WINDOW_HIDDEN /*| SDL_WINDOW_ALLOW_HIGHDPI*/, &WindowHandle, &RendererHandle); + unsigned int flags = SDL_WINDOW_HIDDEN /*| SDL_WINDOW_ALLOW_HIGHDPI*/; + if (popupWindow) + flags |= SDL_WINDOW_BORDERLESS; + int result = SDL_CreateWindowAndRenderer(320, 200, flags, &WindowHandle, &RendererHandle); if (result != 0) throw std::runtime_error(std::string("Unable to create SDL window:") + SDL_GetError()); @@ -174,6 +177,24 @@ Rect SDL2DisplayWindow::GetWindowFrame() const return Rect::xywh(x / uiscale, y / uiscale, w / uiscale, h / uiscale); } +Point SDL2DisplayWindow::MapFromGlobal(const Point& pos) const +{ + int x = 0; + int y = 0; + double uiscale = GetDpiScale(); + SDL_GetWindowPosition(WindowHandle, &x, &y); + return Point(pos.x - x / uiscale, pos.y - y / uiscale); +} + +Point SDL2DisplayWindow::MapToGlobal(const Point& pos) const +{ + int x = 0; + int y = 0; + double uiscale = GetDpiScale(); + SDL_GetWindowPosition(WindowHandle, &x, &y); + return Point(pos.x + x / uiscale, pos.y + y / uiscale); +} + Size SDL2DisplayWindow::GetClientSize() const { int w = 0; diff --git a/src/window/sdl2/sdl2displaywindow.h b/src/window/sdl2/sdl2displaywindow.h index ca0a61f..7f54544 100644 --- a/src/window/sdl2/sdl2displaywindow.h +++ b/src/window/sdl2/sdl2displaywindow.h @@ -8,7 +8,7 @@ class SDL2DisplayWindow : public DisplayWindow { public: - SDL2DisplayWindow(DisplayWindowHost* windowHost); + SDL2DisplayWindow(DisplayWindowHost* windowHost, bool popupWindow); ~SDL2DisplayWindow(); void SetWindowTitle(const std::string& text) override; @@ -45,6 +45,9 @@ class SDL2DisplayWindow : public DisplayWindow std::string GetClipboardText() override; void SetClipboardText(const std::string& text) override; + Point MapFromGlobal(const Point& pos) const override; + Point MapToGlobal(const Point& pos) const override; + void* GetNativeHandle() override { return WindowHandle; } static void DispatchEvent(const SDL_Event& event); diff --git a/src/window/win32/win32displaywindow.cpp b/src/window/win32/win32displaywindow.cpp index 2bf0acf..6d4be07 100644 --- a/src/window/win32/win32displaywindow.cpp +++ b/src/window/win32/win32displaywindow.cpp @@ -56,7 +56,7 @@ static std::wstring to_utf16(const std::string& str) return result; } -Win32DisplayWindow::Win32DisplayWindow(DisplayWindowHost* windowHost) : WindowHost(windowHost) +Win32DisplayWindow::Win32DisplayWindow(DisplayWindowHost* windowHost, bool popupWindow) : WindowHost(windowHost) { Windows.push_front(this); WindowsIterator = Windows.begin(); @@ -74,7 +74,18 @@ Win32DisplayWindow::Win32DisplayWindow(DisplayWindowHost* windowHost) : WindowHo // WS_CAPTION shows the caption (yay! actually a flag that does what it says it does!) // WS_SYSMENU shows the min/max/close buttons // WS_THICKFRAME makes the window resizable - CreateWindowEx(WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME, L"ZWidgetWindow", L"", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); + + DWORD style = 0, exstyle = 0; + if (popupWindow) + { + style = WS_POPUP; + } + else + { + exstyle = WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME; + style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + } + CreateWindowEx(exstyle, L"ZWidgetWindow", L"", style, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); /* RAWINPUTDEVICE rid; @@ -246,6 +257,26 @@ Rect Win32DisplayWindow::GetWindowFrame() const return Rect(box.left / dpiscale, box.top / dpiscale, box.right / dpiscale, box.bottom / dpiscale); } +Point Win32DisplayWindow::MapFromGlobal(const Point& pos) const +{ + double dpiscale = GetDpiScale(); + POINT point = {}; + point.x = (LONG)std::round(pos.x / dpiscale); + point.y = (LONG)std::round(pos.y / dpiscale); + ScreenToClient(WindowHandle, &point); + return Point(point.x * dpiscale, point.y * dpiscale); +} + +Point Win32DisplayWindow::MapToGlobal(const Point& pos) const +{ + double dpiscale = GetDpiScale(); + POINT point = {}; + point.x = (LONG)std::round(pos.x * dpiscale); + point.y = (LONG)std::round(pos.y * dpiscale); + ClientToScreen(WindowHandle, &point); + return Point(point.x / dpiscale, point.y / dpiscale); +} + Size Win32DisplayWindow::GetClientSize() const { RECT box = {}; diff --git a/src/window/win32/win32displaywindow.h b/src/window/win32/win32displaywindow.h index 8aa00e4..7bb4818 100644 --- a/src/window/win32/win32displaywindow.h +++ b/src/window/win32/win32displaywindow.h @@ -14,7 +14,7 @@ class Win32DisplayWindow : public DisplayWindow { public: - Win32DisplayWindow(DisplayWindowHost* windowHost); + Win32DisplayWindow(DisplayWindowHost* windowHost, bool popupWindow); ~Win32DisplayWindow(); void SetWindowTitle(const std::string& text) override; @@ -53,6 +53,9 @@ class Win32DisplayWindow : public DisplayWindow std::string GetClipboardText() override; void SetClipboardText(const std::string& text) override; + Point MapFromGlobal(const Point& pos) const override; + Point MapToGlobal(const Point& pos) const override; + Point GetLParamPos(LPARAM lparam) const; void* GetNativeHandle() override { return reinterpret_cast(WindowHandle); } diff --git a/src/window/window.cpp b/src/window/window.cpp index 4ceb494..fa7aaac 100644 --- a/src/window/window.cpp +++ b/src/window/window.cpp @@ -6,9 +6,9 @@ #include "win32/win32displaywindow.h" -std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost) +std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost, bool popupWindow) { - return std::make_unique(windowHost); + return std::make_unique(windowHost, popupWindow); } void DisplayWindow::ProcessEvents() @@ -43,7 +43,7 @@ void DisplayWindow::StopTimer(void* timerID) #elif defined(__APPLE__) -std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost) +std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost, bool popupWindow) { throw std::runtime_error("DisplayWindow::Create not implemented"); } @@ -82,9 +82,9 @@ void DisplayWindow::StopTimer(void* timerID) #include "sdl2/sdl2displaywindow.h" -std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost) +std::unique_ptr DisplayWindow::Create(DisplayWindowHost* windowHost, bool popupWindow) { - return std::make_unique(windowHost); + return std::make_unique(windowHost, popupWindow); } void DisplayWindow::ProcessEvents()