diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/window.cpp --- a/ui/winui/window.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/window.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,19 +26,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" + #include "window.h" -#include -#undef GetCurrentTime -#include -#include -#include -#include -#include -#include -#include - #include "appmenu.h" +#include "commandbar.h" #include "container.h" #include "util.h" @@ -48,6 +41,8 @@ #include +#include "MainWindow.xaml.h" + using namespace winrt; using namespace Microsoft::UI::Xaml; using namespace Microsoft::UI::Xaml::Controls; @@ -58,7 +53,6 @@ UiWindow::UiWindow(winrt::Microsoft::UI::Xaml::Window& win) : window(win) {} - UiObject* ui_window(const char* title, void* window_data) { CxMempool* mp = cxBasicMempoolCreate(256); UiObject* obj = (UiObject*)cxCalloc(mp->allocator, 1, sizeof(UiObject)); @@ -66,15 +60,16 @@ obj->ctx = uic_context(obj, mp); obj->window = window_data; - Window window = Window(); + //Window window = Window(); + Window window = make(); if (title) { wchar_t *wtitle = str2wstr(title, nullptr); window.Title(wtitle); free(wtitle); } - auto backdrop = winrt::Microsoft::UI::Xaml::Media::MicaBackdrop(); - backdrop.Kind(winrt::Microsoft::UI::Composition::SystemBackdrops::MicaKind::Base); // alternative: BaseAlt + //auto backdrop = winrt::Microsoft::UI::Xaml::Media::MicaBackdrop(); + //backdrop.Kind(winrt::Microsoft::UI::Composition::SystemBackdrops::MicaKind::Base); // alternative: BaseAlt // TODO: https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/system-backdrop-controller#example-use-mica-in-a-windows-appsdkwinui-3-app Grid grid = Grid(); @@ -97,6 +92,13 @@ obj->container->Add(mb, false); } + if (uic_toolbar_isenabled()) { + // create/add toolbar + CommandBar toolbar = ui_create_toolbar(); + toolbar.VerticalAlignment(VerticalAlignment::Top); + obj->container->Add(toolbar, false); + } + obj->window = window_data; return obj;