# HG changeset patch # User Olaf Wintermann # Date 1696928294 -7200 # Node ID b1ac0dd1d38bb4b04b016a187a3a44c438b9bdb3 # Parent 4a258d47f9641f1bcd3ca309a280c84fd6845c71 new winui vs project, add toolbar diff -r 4a258d47f964 -r b1ac0dd1d38b .hgignore --- a/.hgignore Fri Oct 06 19:38:10 2023 +0200 +++ b/.hgignore Tue Oct 10 10:58:14 2023 +0200 @@ -5,6 +5,7 @@ relre:^make/vs/packages/.* relre:^make/vs/.*vcxproj\.user relre:^ui/winui/winui\.vcxproj\.user +relre:^ui/winui/Generated Files relre:^ui/wpf/UIcore/obj relre:^ui/wpf/UIwrapper/.vs relre:^ui/wpf/UIwrapper/UIwrapper.VC diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/testapp/main.c --- a/make/vs/testapp/main.c Fri Oct 06 19:38:10 2023 +0200 +++ b/make/vs/testapp/main.c Tue Oct 10 10:58:14 2023 +0200 @@ -268,6 +268,10 @@ ui_submenu_end(); ui_menuitem("Exit", NULL, NULL); + ui_toolbar_item("Test", .label = "Test"); + + ui_toolbar_add_default("Test"); + ui_main(); return (EXIT_SUCCESS); diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/testapp/testapp.vcxproj --- a/make/vs/testapp/testapp.vcxproj Fri Oct 06 19:38:10 2023 +0200 +++ b/make/vs/testapp/testapp.vcxproj Tue Oct 10 10:58:14 2023 +0200 @@ -145,7 +145,7 @@ - {04d5ee2c-6076-4c7c-8b70-b0f6d602ff55} + {59f97886-bf49-4b3f-9ef6-fa7a84f3ab56} {27da0164-3475-43e2-a1a4-a5d07d305749} diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/testapp/testapp.vcxproj.filters --- a/make/vs/testapp/testapp.vcxproj.filters Fri Oct 06 19:38:10 2023 +0200 +++ b/make/vs/testapp/testapp.vcxproj.filters Tue Oct 10 10:58:14 2023 +0200 @@ -22,4 +22,7 @@ + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/toolkit.sln --- a/make/vs/toolkit.sln Fri Oct 06 19:38:10 2023 +0200 +++ b/make/vs/toolkit.sln Tue Oct 10 10:58:14 2023 +0200 @@ -5,42 +5,76 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testapp", "testapp\testapp.vcxproj", "{3541F08B-E6CC-4C23-A0D3-51983AAB33C6}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winui", "..\..\ui\winui\winui.vcxproj", "{04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ucx", "ucx\ucx.vcxproj", "{27DA0164-3475-43E2-A1A4-A5D07D305749}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ucx", "ucx\ucx.vcxproj", "{27DA0164-3475-43E2-A1A4-A5D07D305749}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winui", "..\..\ui\winui\winui.vcxproj", "{59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uicommon", "uicommon\uicommon.vcxproj", "{8B88698E-C185-4383-99FE-0C34D6DEED2E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|ARM64.ActiveCfg = Debug|x64 + {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|ARM64.Build.0 = Debug|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|x64.ActiveCfg = Debug|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|x64.Build.0 = Debug|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|x86.ActiveCfg = Debug|Win32 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Debug|x86.Build.0 = Debug|Win32 + {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|ARM64.ActiveCfg = Release|x64 + {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|ARM64.Build.0 = Release|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|x64.ActiveCfg = Release|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|x64.Build.0 = Release|x64 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|x86.ActiveCfg = Release|Win32 {3541F08B-E6CC-4C23-A0D3-51983AAB33C6}.Release|x86.Build.0 = Release|Win32 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Debug|x64.ActiveCfg = Debug|x64 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Debug|x64.Build.0 = Debug|x64 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Debug|x86.ActiveCfg = Debug|Win32 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Debug|x86.Build.0 = Debug|Win32 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Release|x64.ActiveCfg = Release|x64 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Release|x64.Build.0 = Release|x64 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Release|x86.ActiveCfg = Release|Win32 - {04D5EE2C-6076-4C7C-8B70-B0F6D602FF55}.Release|x86.Build.0 = Release|Win32 + {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|ARM64.ActiveCfg = Debug|x64 + {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|ARM64.Build.0 = Debug|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|x64.ActiveCfg = Debug|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|x64.Build.0 = Debug|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|x86.ActiveCfg = Debug|Win32 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Debug|x86.Build.0 = Debug|Win32 + {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|ARM64.ActiveCfg = Release|x64 + {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|ARM64.Build.0 = Release|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|x64.ActiveCfg = Release|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|x64.Build.0 = Release|x64 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|x86.ActiveCfg = Release|Win32 {27DA0164-3475-43E2-A1A4-A5D07D305749}.Release|x86.Build.0 = Release|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|ARM64.Build.0 = Debug|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x64.ActiveCfg = Debug|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x64.Build.0 = Debug|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x64.Deploy.0 = Debug|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x86.ActiveCfg = Debug|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x86.Build.0 = Debug|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Debug|x86.Deploy.0 = Debug|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|ARM64.ActiveCfg = Release|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|ARM64.Build.0 = Release|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|ARM64.Deploy.0 = Release|ARM64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x64.ActiveCfg = Release|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x64.Build.0 = Release|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x64.Deploy.0 = Release|x64 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x86.ActiveCfg = Release|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x86.Build.0 = Release|Win32 + {59F97886-BF49-4B3F-9EF6-FA7A84F3AB56}.Release|x86.Deploy.0 = Release|Win32 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|ARM64.ActiveCfg = Debug|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|ARM64.Build.0 = Debug|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|x64.ActiveCfg = Debug|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|x64.Build.0 = Debug|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|x86.ActiveCfg = Debug|Win32 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Debug|x86.Build.0 = Debug|Win32 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|ARM64.ActiveCfg = Release|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|ARM64.Build.0 = Release|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|x64.ActiveCfg = Release|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|x64.Build.0 = Release|x64 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|x86.ActiveCfg = Release|Win32 + {8B88698E-C185-4383-99FE-0C34D6DEED2E}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/uicommon/uicommon.vcxproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/vs/uicommon/uicommon.vcxproj Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {8b88698e-c185-4383-99fe-0c34d6deed2e} + uicommon + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\..\build\vs\$(Platform)\$(Configuration)\ + ..\..\..\build\vs\testapp\$(Platform)\$(Configuration)\ + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + false + _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;UI_WINUI;%(PreprocessorDefinitions) + true + stdc17 + $(SolutionDir)..\..\ucx;%(AdditionalIncludeDirectories) + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/uicommon/uicommon.vcxproj.filters --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/vs/uicommon/uicommon.vcxproj.filters Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,65 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b make/vs/uicommon/uicommon.vcxproj.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/vs/uicommon/uicommon.vcxproj.user Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/common/menu.c --- a/ui/common/menu.c Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/common/menu.c Tue Oct 10 10:58:14 2023 +0200 @@ -253,3 +253,4 @@ UiMenu* uic_get_menu_list(void) { return menus_begin; } + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/common/toolbar.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/common/toolbar.c Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,102 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2023 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "toolbar.h" + +#include + +static CxMap* toolbar_items; + +static CxList* toolbar_defaults; + +void uic_toolbar_init(void) { + toolbar_items = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16); + toolbar_defaults = cxLinkedListCreateSimple(CX_STORE_POINTERS); +} + +static char* nl_strdup(char* str) { + return str ? strdup(str) : NULL; +} + +static UiToolbarItemArgs itemargs_copy(UiToolbarItemArgs args) { + UiToolbarItemArgs newargs; + newargs.label = nl_strdup(args.label); + newargs.stockid = nl_strdup(args.stockid); + newargs.icon = nl_strdup(args.icon); + newargs.onclick = args.onclick; + newargs.onclickdata = args.onclickdata; + return newargs; +} + +void ui_toolbar_item_create(const char* name, UiToolbarItemArgs args) { + UiToolbarItem* item = malloc(sizeof(UiToolbarItem)); + item->item.type = UI_TOOLBAR_ITEM; + item->args = itemargs_copy(args); + cxMapPut(toolbar_items, name, item); +} + + +static UiToolbarToggleItemArgs toggleitemargs_copy(UiToolbarToggleItemArgs args) { + UiToolbarToggleItemArgs newargs; + newargs.label = nl_strdup(args.label); + newargs.stockid = nl_strdup(args.stockid); + newargs.icon = nl_strdup(args.icon); + newargs.varname = nl_strdup(args.varname); + newargs.onchange = args.onchange; + newargs.onchangedata = args.onchangedata; + return newargs; +} + +void ui_toolbar_toggleitem_create(const char* name, UiToolbarToggleItemArgs args) { + UiToolbarToggleItem* item = malloc(sizeof(UiToolbarToggleItem)); + item->item.type = UI_TOOLBAR_TOGGLEITEM; + item->args = toggleitemargs_copy(args); + cxMapPut(toolbar_items, name, item); +} + + +CxMap* uic_get_toolbar_items(void) { + return toolbar_items; +} + +CxList* uic_get_toolbar_defaults(void) { + return toolbar_defaults; +} + +void ui_toolbar_add_default(const char* name) { + char* cp = strdup(name); + cxListAdd(toolbar_defaults, cp); +} + +UiBool uic_toolbar_isenabled(void) { + return toolbar_defaults->size > 0; +} + +UiToolbarItemI* uic_toolbar_get_item(const char* name) { + return cxMapGet(toolbar_items, name); +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/common/toolbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/common/toolbar.h Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,81 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2023 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UIC_TOOLBAR_H +#define UIC_TOOLBAR_H + +#include "../ui/toolbar.h" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct UiToolbarItemI UiToolbarItemI; + +typedef struct UiToolbarItem UiToolbarItem; +typedef struct UiToolbarToggleItem UiToolbarToggleItem; + +enum UiToolbarItemType { + UI_TOOLBAR_ITEM = 0, + UI_TOOLBAR_TOGGLEITEM +}; + +typedef enum UiToolbarItemType UiToolbarItemType; + +struct UiToolbarItemI { + UiToolbarItemType type; +}; + +struct UiToolbarItem { + UiToolbarItemI item; + UiToolbarItemArgs args; +}; + +struct UiToolbarToggleItem { + UiToolbarItemI item; + UiToolbarToggleItemArgs args; +}; + +void uic_toolbar_init(void); + +CxMap* uic_get_toolbar_items(void); +CxList* uic_get_toolbar_defaults(void); + +UiBool uic_toolbar_isenabled(void); + +UiToolbarItemI* uic_toolbar_get_item(const char* name); + +#ifdef __cplusplus +} +#endif + +#endif /* UIC_TOOLBAR_H */ + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/ui/toolbar.h --- a/ui/ui/toolbar.h Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/ui/toolbar.h Tue Oct 10 10:58:14 2023 +0200 @@ -36,7 +36,35 @@ extern "C" { #endif -void ui_toolitem(char *name, char *label, ui_callback f, void *udata); +typedef struct UiToolbarItemArgs { + const char* label; + const char* stockid; + const char* icon; + + ui_callback onclick; + void* onclickdata; +} UiToolbarItemArgs; + +typedef struct UiToolbarToggleItemArgs { + const char* label; + const char* stockid; + const char* icon; + + const char* varname; + ui_callback onchange; + void* onchangedata; +} UiToolbarToggleItemArgs; + + +#define ui_toolbar_item(name, ...) ui_toolbar_item_create(name, (UiToolbarItemArgs){ __VA_ARGS__ } ) +#define ui_toolbar_toggleitem(name, ...) ui_toolbar_item_create(name, (UiToolbarItemArgs){ __VA_ARGS__ } ) + +UIEXPORT void ui_toolbar_item_create(const char* name, UiToolbarItemArgs args); +UIEXPORT void ui_toolbar_toggleitem_create(const char* name, UiToolbarToggleItemArgs args); + + + +void ui_toolitem_deprecated(char *name, char *label, ui_callback f, void *udata); void ui_toolitem_st(char *name, char *stockid, ui_callback f, void *udata); void ui_toolitem_sti(char *name, char *stockid, ui_callback f, void *udata); void ui_toolitem_stgr(char *name, char *stockid, ui_callback f, void *udata, ...); @@ -52,7 +80,7 @@ void ui_toolbar_combobox_str(char *name, UiList *list, ui_callback f, void *udata); void ui_toolbar_combobox_nv(char *name, char *listname, ui_getvaluefunc getvalue, ui_callback f, void *udata); -void ui_toolbar_add_default(char *name); +UIEXPORT void ui_toolbar_add_default(const char *name); #ifdef __cplusplus } diff -r 4a258d47f964 -r b1ac0dd1d38b ui/ui/toolkit.h --- a/ui/ui/toolkit.h Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/ui/toolkit.h Tue Oct 10 10:58:14 2023 +0200 @@ -73,11 +73,13 @@ #ifdef __cplusplus +#ifndef UI_WINUI_PCH #include #undef GetCurrentTime #include #include #include +#endif class UiWindow { public: diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/App.idl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/App.idl Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +namespace winui +{ +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/App.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/App.xaml Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/App.xaml.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/App.xaml.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#include "pch.h" + +#include "App.xaml.h" +#include "MainWindow.xaml.h" + +using namespace winrt; +using namespace Windows::Foundation; +using namespace Microsoft::UI::Xaml; +using namespace Microsoft::UI::Xaml::Controls; +using namespace Microsoft::UI::Xaml::Navigation; +using namespace winui; +using namespace winui::implementation; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + +#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION + UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e) + { + if (IsDebuggerPresent()) + { + auto errorMessage = e.Message(); + __debugbreak(); + } + }); +#endif +} + +/// +/// Invoked when the application is launched. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs const&) +{ + window = make(); + window.Activate(); +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/App.xaml.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/App.xaml.h Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#pragma once + +#include "App.xaml.g.h" + +namespace winrt::winui::implementation +{ + struct App : AppT + { + App(); + + void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&); + + private: + winrt::Microsoft::UI::Xaml::Window window{ nullptr }; + }; +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/LockScreenLogo.scale-200.png Binary file ui/winui/Assets/LockScreenLogo.scale-200.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/SplashScreen.scale-200.png Binary file ui/winui/Assets/SplashScreen.scale-200.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/Square150x150Logo.scale-200.png Binary file ui/winui/Assets/Square150x150Logo.scale-200.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/Square44x44Logo.scale-200.png Binary file ui/winui/Assets/Square44x44Logo.scale-200.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png Binary file ui/winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/StoreLogo.png Binary file ui/winui/Assets/StoreLogo.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Assets/Wide310x150Logo.scale-200.png Binary file ui/winui/Assets/Wide310x150Logo.scale-200.png has changed diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/MainWindow.idl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/MainWindow.idl Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +namespace winui +{ + [default_interface] + runtimeclass MainWindow : Microsoft.UI.Xaml.Window + { + MainWindow(); + Int32 MyProperty; + } +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/MainWindow.xaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/MainWindow.xaml Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,18 @@ + + + + + + + + + + + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/MainWindow.xaml.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/MainWindow.xaml.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#include "pch.h" +#include "MainWindow.xaml.h" +#if __has_include("MainWindow.g.cpp") +#include "MainWindow.g.cpp" +#endif + +using namespace winrt; +using namespace Microsoft::UI::Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace winrt::winui::implementation +{ + MainWindow::MainWindow() + { + InitializeComponent(); + } + + int32_t MainWindow::MyProperty() + { + throw hresult_not_implemented(); + } + + void MainWindow::MyProperty(int32_t /* value */) + { + throw hresult_not_implemented(); + } + + void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) + { + myButton().Content(box_value(L"Clicked")); + } +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/MainWindow.xaml.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/MainWindow.xaml.h Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#pragma once + +#include "MainWindow.g.h" + +namespace winrt::winui::implementation +{ + struct MainWindow : MainWindowT + { + MainWindow(); + + int32_t MyProperty(); + void MyProperty(int32_t value); + + void myButton_Click(Windows::Foundation::IInspectable const& sender, Microsoft::UI::Xaml::RoutedEventArgs const& args); + }; +} + +namespace winrt::winui::factory_implementation +{ + struct MainWindow : MainWindowT + { + }; +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/Package.appxmanifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/Package.appxmanifest Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,51 @@ + + + + + + + + + + winui + Olaf + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/app.manifest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/app.manifest Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + PerMonitorV2 + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/appmenu.cpp --- a/ui/winui/appmenu.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/appmenu.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,16 +26,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "appmenu.h" +#include "pch.h" -#include -#undef GetCurrentTime -#include -#include -#include -#include -#include -#include +#include "appmenu.h" #include #include diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/button.cpp --- a/ui/winui/button.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/button.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,6 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" #include "button.h" diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/commandbar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/commandbar.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,88 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2023 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "pch.h" + +#include "commandbar.h" + +#include "util.h" + +using namespace winrt; +using namespace Microsoft::UI::Xaml; +using namespace Microsoft::UI::Xaml::Controls; +using namespace Microsoft::UI::Xaml::XamlTypeInfo; +using namespace Microsoft::UI::Xaml::Markup; +using namespace Windows::UI::Xaml::Interop; + +static void create_item(CommandBar cb, UiToolbarItemI* i); +static void create_cmditem(CommandBar cb, UiToolbarItem* item); +static void create_toggleitem(CommandBar cb, UiToolbarToggleItem* item); + +CommandBar ui_create_toolbar() { + CxList* defaults = uic_get_toolbar_defaults(); + CommandBar cb = CommandBar(); + CxIterator i = cxListIterator(defaults); + cx_foreach(char*, def, i) { + UiToolbarItemI* item = uic_toolbar_get_item(def); + if (!item) { + exit(-1); // TODO: maybe a error dialog? + } + + create_item(cb, item); + } + + return cb; +} + +static void create_item(CommandBar cb, UiToolbarItemI* i) { + switch (i->type) { + case UI_TOOLBAR_ITEM: { + create_cmditem(cb, (UiToolbarItem*)i); + break; + } + case UI_TOOLBAR_TOGGLEITEM: { + create_toggleitem(cb, (UiToolbarToggleItem*)i); + break; + } + } +} + +static void create_cmditem(CommandBar cb, UiToolbarItem* item) { + AppBarButton button = AppBarButton(); + if (item->args.label) { + wchar_t* wlabel = str2wstr(item->args.label, nullptr); + button.Content(box_value(wlabel)); + free(wlabel); + } + + cb.PrimaryCommands().Append(button); +} + +static void create_toggleitem(CommandBar cb, UiToolbarToggleItem* item) { + +} diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/commandbar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/commandbar.h Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,45 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2023 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "toolkit.h" +#include "../ui/toolbar.h" +#include "../common/toolbar.h" + +#include +#undef GetCurrentTime +#include +#include +#include +#include +#include +#include + +winrt::Microsoft::UI::Xaml::Controls::CommandBar ui_create_toolbar(); + diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/container.cpp --- a/ui/winui/container.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/container.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,6 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" + #include "container.h" #include "../common/context.h" @@ -33,9 +35,6 @@ #include "util.h" -#include -#include - void ui_container_begin_close(UiObject* obj) { UiContainer* ct = uic_get_current_container(obj); diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/list.cpp --- a/ui/winui/list.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/list.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,6 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" + #include "list.h" #include "container.h" #include "util.h" @@ -33,7 +35,6 @@ #include "../common/context.h" #include "../common/object.h" -#include using namespace winrt; using namespace Microsoft::UI::Xaml; diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/packages.config --- a/ui/winui/packages.config Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/packages.config Tue Oct 10 10:58:14 2023 +0200 @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/pch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/pch.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#include "pch.h" diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/pch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/pch.h Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +#pragma once +#include +#include +#include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/readme.txt Tue Oct 10 10:58:14 2023 +0200 @@ -0,0 +1,27 @@ +======================================================================== + winui Project Overview +======================================================================== + +This project demonstrates how to get started writing WinUI3 apps directly +with standard C++, using the Windows App SDK and C++/WinRT packages and +XAML compiler support to generate implementation headers from interface +(IDL) files. These headers can then be used to implement the local +Windows Runtime classes referenced in the app's XAML pages. + +Steps: +1. Create an interface (IDL) file to define any local Windows Runtime + classes referenced in the app's XAML pages. +2. Build the project once to generate implementation templates under + the "Generated Files" folder, as well as skeleton class definitions + under "Generated Files\sources". +3. Use the skeleton class definitions for reference to implement your + Windows Runtime classes. + +======================================================================== +Learn more about Windows App SDK here: +https://docs.microsoft.com/windows/apps/windows-app-sdk/ +Learn more about WinUI3 here: +https://docs.microsoft.com/windows/apps/winui/winui3/ +Learn more about C++/WinRT here: +http://aka.ms/cppwinrt/ +======================================================================== diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/table.cpp --- a/ui/winui/table.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/table.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,6 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" + #include "table.h" #include "container.h" #include "util.h" diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/text.cpp --- a/ui/winui/text.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/text.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,6 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "pch.h" + #include "text.h" #include "../common/context.h" diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/toolkit.cpp --- a/ui/winui/toolkit.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/toolkit.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -26,22 +26,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "toolkit.h" +#include "pch.h" -#include -#undef GetCurrentTime -#include -#include -#include -#include -#include -#include +#include "toolkit.h" #include #include #include "../common/context.h" +#include "../common/toolbar.h" +#include "MainWindow.xaml.h" + +#include "App.xaml.h" using namespace winrt; using namespace Microsoft::UI::Xaml; @@ -77,6 +74,9 @@ if (startup_func) { startup_func(NULL, startup_data); } + + //auto window = make(); + //window.Activate(); } IXamlType GetXamlType(TypeName const& type) { return provider.GetXamlType(type); @@ -126,6 +126,8 @@ void ui_init(const char* appname, int argc, char** argv) { application_name = appname; + + uic_toolbar_init(); } const char* ui_appname() { diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/util.cpp --- a/ui/winui/util.cpp Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/util.cpp Tue Oct 10 10:58:14 2023 +0200 @@ -1,11 +1,9 @@ - +#include "pch.h" #include "util.h" #include -#include - wchar_t* str2wstr(const char* str, int* newlen) { size_t len = strlen(str); 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; diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/winui.cpp --- a/ui/winui/winui.cpp Fri Oct 06 19:38:10 2023 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#include "winui.h" \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/winui.h --- a/ui/winui/winui.h Fri Oct 06 19:38:10 2023 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -#pragma once - -#include -#undef GetCurrentTime -#include -#include -#include \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/winui.vcxproj --- a/ui/winui/winui.vcxproj Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/winui.vcxproj Tue Oct 10 10:58:14 2023 +0200 @@ -1,159 +1,153 @@ - - - - - + + + + + + + true + true + true + {59f97886-bf49-4b3f-9ef6-fa7a84f3ab56} + winui + winui + + $(RootNamespace) + de-DE + 16.0 + false + false + Windows Store + 10.0 + 10.0 + 10.0.17763.0 + true + true + None + true + + Debug Win32 - - Release - Win32 - Debug x64 + + Debug + ARM64 + + + Release + Win32 + Release x64 + + Release + ARM64 + - - 16.0 - Win32Proj - {04d5ee2c-6076-4c7c-8b70-b0f6d602ff55} - winui - 10.0 - true - None - false - - - - Application - true + + DynamicLibrary v143 Unicode - - - Application - false - v143 - true - Unicode + true - - DynamicLibrary + true - v143 - Unicode + true - - Application + false - v143 true - Unicode + false - - - - - - - - - - - - + - - $(SolutionDir)..\..\build\vs\$(Platform)\$(Configuration)\ - ..\..\build\vs\winui\$(Platform)\$(Configuration)\ - - + - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + + + + + _DEBUG;DISABLE_XAML_GENERATED_MAIN;UI_WINUI;UI_WINUI_PCH;%(PreprocessorDefinitions) + $(SolutionDir)..\..\ucx;%(AdditionalIncludeDirectories) + + + + + NDEBUG;%(PreprocessorDefinitions) - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console true true - true - - - Level3 - true - _DEBUG;_CONSOLE;UI_WINUI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - stdc17 - $(SolutionDir)..\..\ucx;%(AdditionalIncludeDirectories) - - - NotUsing - toolkit.h - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - + + + Designer + + + + + - - - - - - - + + + + + + + + App.xaml + + + MainWindow.xaml + + + + + + + + + + + + + + + Create + + + App.xaml + + + MainWindow.xaml + + @@ -161,65 +155,77 @@ - + + Code + App.xaml + + + Code + MainWindow.xaml + + + + + false + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + {27da0164-3475-43e2-a1a4-a5d07d305749} + + {8b88698e-c185-4383-99fe-0c34d6deed2e} + + + + true + + + $(SolutionDir)..\..\build\vs\$(Platform)\$(Configuration)\ + ..\..\build\vs\winui\$(Platform)\$(Configuration)\ + - - - - + + + + - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - - - + + + + + + + \ No newline at end of file diff -r 4a258d47f964 -r b1ac0dd1d38b ui/winui/winui.vcxproj.filters --- a/ui/winui/winui.vcxproj.filters Fri Oct 06 19:38:10 2023 +0200 +++ b/ui/winui/winui.vcxproj.filters Tue Oct 10 10:58:14 2023 +0200 @@ -1,183 +1,60 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {f54c3ad7-3a41-4d22-8850-ab4d9272e509} - - - {e701397e-2637-4a23-a260-1d3259292fa8} - - - {135ba0dc-0817-4d23-b816-1ac0fa785bb9} + + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + {59f97886-bf49-4b3f-9ef6-fa7a84f3ab56} - - Quelldateien - - - Quelldateien - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien\common - - - Quelldateien - - - Quelldateien - - - Quelldateien - - - Quelldateien - - - Quelldateien - - - Quelldateien - - - Quelldateien - + + + + + + + - - - Headerdateien - - - Headerdateien - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien\common - - - Headerdateien - - - Headerdateien - - - Headerdateien - - - Headerdateien - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - public - - - Headerdateien - - - Headerdateien - - - Headerdateien - - - - - \ No newline at end of file