add widgets to periodic table

This commit is contained in:
Nishi 2026-04-24 02:23:25 +09:00
commit d225f7cb72
Signed by: nishi
GPG key ID: 27EF69B208EB9343
9 changed files with 158 additions and 160 deletions

View file

@ -145,11 +145,12 @@ static void MWAPI menu_handler(MwWidget handle, void* user, void* call) {
}
int main() {
int i, j;
MwWidget f, w, b;
int index;
MwMenu m, m2;
void* v;
int i, j;
MwWidget f, w, b;
MwLLPixmap px;
int index;
MwMenu m, m2;
void* v;
MwLibraryInit();
@ -157,6 +158,8 @@ int main() {
MwNtitle, "Milsko Periodic Table",
NULL);
px = MwLoadIcon(window, MwIconError);
menu = MwCreateWidget(MwMenuClass, "menu", window, 0, 0, 0, 0);
m = MwMenuAdd(menu, NULL, "File");
@ -256,6 +259,12 @@ int main() {
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
add(f);
f = frame("Image", -PaddingContent, -PaddingContent, MwImageClass,
MwNpixmap, px,
NULL);
w = child(f);
add(f);
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
MwNtext, "Epic text",
NULL);
@ -292,6 +301,14 @@ int main() {
v = MwTreeViewAdd(w, v, NULL, "ghi");
add(f);
f = frame("Viewport", -PaddingContent, -PaddingContent, MwViewportClass, NULL);
w = child(f);
MwViewportSetSize(w, 256, 256);
MwVaCreateWidget(MwButtonClass, "btn", MwViewportGetViewport(w), 64, 64, 128, 128,
MwNtext, "Thing",
NULL);
add(f);
if(n != 0) newrow();
if(n == 0) MwDestroyWidget(boxes[row]);
@ -300,4 +317,6 @@ int main() {
resize(window, NULL, NULL);
MwLoop(window);
MwLLDestroyPixmap(px);
}

View file

@ -31,12 +31,12 @@ int main() {
if(px == NULL) px = MwLoadImage(vp, "picture.png");
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
// MwNpixmap, px,
// NULL);
// MwVaCreateWidget(MwImageClass, "image", MwViewportGetViewport(vp), 0, 0, 1024, 1024,
// MwNpixmap, px,
// NULL);
MwViewportSetSize(vp, 1024, 1024);
MwWidget f = MwCreateWidget(MwFrameClass, "fr", MwViewportGetViewport(vp), 256, 256, 128, 128);
f = MwCreateWidget(MwFrameClass, "fr", f, 0, 0, 128, 128);
f = MwCreateWidget(MwFrameClass, "fr", f, 0, 0, 128, 128);
MwCreateWidget(MwButtonClass, "btn", f, 64, 64, 128, 128);
MwAddUserHandler(w, MwNresizeHandler, resize, NULL);