some fix
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-05-02 02:00:51 +09:00
commit 9bfa4f4092
Signed by: nishi
GPG key ID: 27EF69B208EB9343
6 changed files with 189 additions and 29 deletions

View file

@ -317,7 +317,7 @@ int main() {
NULL);
add(f);
MwVaCreateWidget(MwSubWindowClass, "swnd", MwViewportGetViewport(w), 64, 64, 256, 128,
MwNtitle, "Sub window",
MwNtitle, "Sub window 2",
NULL);
add(f);
#endif

View file

@ -0,0 +1,49 @@
#include <Mw/Milsko.h>
static void resize(MwWidget handle, void* user, void* client) {
MwWidget f = MwSubWindowGetFrame(handle);
MwVaApply(user,
MwNwidth, MwGetInteger(f, MwNwidth),
MwNheight, MwGetInteger(f, MwNheight),
NULL);
}
int main() {
MwWidget w;
int i;
MwLLPixmap px[6];
MwLibraryInit();
w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 800, 600,
MwNtitle, "subwindow",
NULL);
px[0] = MwLoadIcon(w, MwIconClock);
px[1] = MwLoadIcon(w, MwIconError);
px[2] = MwLoadIcon(w, MwIconInfo);
px[3] = MwLoadIcon(w, MwIconNews);
px[4] = MwLoadIcon(w, MwIconNote);
px[5] = MwLoadIcon(w, MwIconWarning);
for(i = 0; i < 16; i++) {
char buf[32];
MwWidget sw, f, img;
sprintf(buf, "Sub window %d", i);
sw = MwVaCreateWidget(MwSubWindowClass, "swnd", w, i * 32, i * 32, 128, 128,
MwNtitle, buf,
NULL);
f = MwSubWindowGetFrame(sw);
img = MwVaCreateWidget(MwImageClass, "img", f, 0, 0, MwGetInteger(f, MwNwidth), MwGetInteger(f, MwNheight),
MwNpixmap, px[rand() % 6],
NULL);
MwAddUserHandler(sw, MwNresizeHandler, resize, img);
}
MwLoop(w);
}