Tue, 15 Jul 2025 12:09:51 +0200
add missing include
| ui/common/args.h | file | annotate | diff | comparison | revisions | |
| ui/ui/toolkit.h | file | annotate | diff | comparison | revisions | |
| ui/win32/Makefile | file | annotate | diff | comparison | revisions | |
| ui/win32/button.c | file | annotate | diff | comparison | revisions | |
| ui/win32/button.h | file | annotate | diff | comparison | revisions | |
| ui/win32/container.c | file | annotate | diff | comparison | revisions | |
| ui/win32/container.h | file | annotate | diff | comparison | revisions | |
| ui/win32/objs.mk | file | annotate | diff | comparison | revisions |
--- a/ui/common/args.h Mon Jul 14 20:09:54 2025 +0200 +++ b/ui/common/args.h Tue Jul 15 12:09:51 2025 +0200 @@ -35,6 +35,7 @@ #include "../ui/toolbar.h" #include "../ui/tree.h" #include "../ui/text.h" +#include "../ui/webview.h" #ifdef __cplusplus extern "C" {
--- a/ui/ui/toolkit.h Mon Jul 14 20:09:54 2025 +0200 +++ b/ui/ui/toolkit.h Tue Jul 15 12:09:51 2025 +0200 @@ -92,7 +92,11 @@ #define UIEXPORT __declspec(dllexport) -#define UIWIDGET void* +typedef struct W32Widget { + HWND hwnd; +} W32Widget; + +#define UIWIDGET W32Widget* #define UIWINDOW void* #define UIMENU void*
--- a/ui/win32/Makefile Mon Jul 14 20:09:54 2025 +0200 +++ b/ui/win32/Makefile Tue Jul 15 12:09:51 2025 +0200 @@ -33,4 +33,4 @@ $(AR) $(ARFLAGS) $(UI_LIB) $(OBJ) $(UI_SHLIB): $(OBJ) - $(CC) -o $(UI_SHLIB) $(LDFLAGS) $(SHLIB_LDFLAGS) $(TK_LDFLAGS) $(OBJ) -L../build/lib -lucx + $(CC) -o $(UI_SHLIB) $(LDFLAGS) $(SHLIB_LDFLAGS) $(TK_LDFLAGS) $(OBJ) -L../build/$(BUILD_LIB_DIR) -lucx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/win32/button.c Tue Jul 15 12:09:51 2025 +0200 @@ -0,0 +1,33 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2025 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 "button.h" + +UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs *args) { + return NULL; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/win32/button.h Tue Jul 15 12:09:51 2025 +0200 @@ -0,0 +1,35 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2025 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 BUTTON_H +#define BUTTON_H + +#include "../ui/button.h" +#include "container.h" + +#endif //BUTTON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/win32/container.c Tue Jul 15 12:09:51 2025 +0200 @@ -0,0 +1,48 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2025 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 "container.h" + + +/* ---------------------------- Box Container ---------------------------- */ + +static UIWIDGET box_create(UiObject *obj, UiContainerArgs *args, UiBoxOrientation orientation) { + return NULL; +} + +// public +UIWIDGET ui_vbox_create(UiObject *obj, UiContainerArgs *args) { + return box_create(obj, args, UI_BOX_VERTICAL); +} + +// public +UIWIDGET ui_hbox_create(UiObject *obj, UiContainerArgs *args) { + return box_create(obj, args, UI_BOX_HORIZONTAL); +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/win32/container.h Tue Jul 15 12:09:51 2025 +0200 @@ -0,0 +1,91 @@ +/* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2025 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 CONTAINER_H + +#include "../ui/container.h" + +#define CONTAINER_H + +#define UI_APPLY_LAYOUT(layout, args) \ + layout.fill = args->fill; \ + layout.hexpand = args->hexpand; \ + layout.vexpand = args->vexpand; \ + layout.hfill = args->hfill; \ + layout.vfill = args->vfill; \ + layout.override_defaults = args->override_defaults; \ + layout.colspan = args->colspan; \ + layout.rowspan = args->rowspan + +typedef struct UiLayout UiLayout; + +struct UiLayout { + UiTri fill; + UiBool newline; + char *label; + UiBool hexpand; + UiBool vexpand; + UiBool hfill; + UiBool vfill; + UiBool override_defaults; + int width; + int colspan; + int rowspan; +}; + +enum UiBoxOrientation { + UI_BOX_VERTICAL = 0, + UI_BOX_HORIZONTAL +}; +typedef enum UiBoxOrientation UiBoxOrientation; + +enum UiContainerType { + UI_CONTAINER_GENERIC = 0, + UI_CONTAINER_TABVIEW +}; +typedef enum UiContainerType UiContainerType; + +typedef struct UiContainerPrivate UiContainerPrivate; + +typedef struct UiRect { + int x; + int y; + int width; + int height; +} UiRect; + + +struct UiContainerPrivate { + UiContainerX container; + void (*prepare)(UiContainerPrivate*, UiRect*); + void (*add)(UiContainerPrivate*, UiRect*, W32Widget*); + UiContainerType type; + UiLayout layout; +}; + +#endif //CONTAINER_H
--- a/ui/win32/objs.mk Mon Jul 14 20:09:54 2025 +0200 +++ b/ui/win32/objs.mk Tue Jul 15 12:09:51 2025 +0200 @@ -32,6 +32,8 @@ WIN32OBJ = toolkit.obj WIN32OBJ += window.obj WIN32OBJ += image.obj +WIN32OBJ += container.obj +WIN32OBJ += button.obj TOOLKITOBJS += $(WIN32OBJ:%=$(WIN32_OBJPRE)%) TOOLKITSOURCE += $(WIN32OBJ:%.obj=win32/%.c)