From 1b8f877b874debb7c63ebfda6a2bf5972afae8bc Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Thu, 16 Oct 2025 18:59:58 +0000 Subject: [PATCH] home git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@379 b9cfdab3-6d41-4d17-bbe4-086880011989 --- src/filechooser.c | 22 ++++++++++++++++------ src/widget/listbox.c | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/filechooser.c b/src/filechooser.c index b143b80..868676a 100644 --- a/src/filechooser.c +++ b/src/filechooser.c @@ -18,6 +18,7 @@ typedef struct filechooser { MwLLPixmap back; MwLLPixmap forward; MwLLPixmap up; + MwLLPixmap computer; } filechooser_t; static void destroy(MwWidget handle) { @@ -25,6 +26,10 @@ static void destroy(MwWidget handle) { MwLLDestroyPixmap(fc->dir); MwLLDestroyPixmap(fc->file); + MwLLDestroyPixmap(fc->back); + MwLLDestroyPixmap(fc->forward); + MwLLDestroyPixmap(fc->up); + MwLLDestroyPixmap(fc->computer); free(handle->opaque); MwDestroyWidget(handle); } @@ -54,7 +59,10 @@ static void layout(MwWidget handle) { ww = 160; wh = h - 10 - 24 - 5 - 24 - 5 - 24 - 5; if(fc->nav == NULL) { - fc->nav = MwCreateWidget(MwListBoxClass, "nav", handle, wx, wy, ww, wh); + fc->nav = MwVaCreateWidget(MwListBoxClass, "nav", handle, wx, wy, ww, wh, + MwNleftPadding, 16, + NULL); + MwListBoxInsert(fc->nav, -1, fc->computer, "Home", NULL); } else { MwVaApply(fc->nav, MwNx, wx, @@ -71,6 +79,7 @@ static void layout(MwWidget handle) { if(fc->files == NULL) { fc->files = MwVaCreateWidget(MwListBoxClass, "files", handle, wx, wy, ww, wh, MwNhasHeading, 1, + MwNleftPadding, 16, NULL); } else { MwVaApply(fc->files, @@ -254,11 +263,12 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) { MwNtitle, title, NULL); - fc->dir = MwLoadXPM(window, MwIconDirectory); - fc->file = MwLoadXPM(window, MwIconFile); - fc->back = MwLoadXPM(window, MwIconBack); - fc->forward = MwLoadXPM(window, MwIconForward); - fc->up = MwLoadXPM(window, MwIconUp); + fc->dir = MwLoadXPM(window, MwIconDirectory); + fc->file = MwLoadXPM(window, MwIconFile); + fc->back = MwLoadXPM(window, MwIconBack); + fc->forward = MwLoadXPM(window, MwIconForward); + fc->up = MwLoadXPM(window, MwIconUp); + fc->computer = MwLoadXPM(window, MwIconComputer); window->opaque = fc; diff --git a/src/widget/listbox.c b/src/widget/listbox.c index e6d1b82..9ad96fc 100644 --- a/src/widget/listbox.c +++ b/src/widget/listbox.c @@ -139,7 +139,7 @@ static void frame_draw(MwWidget handle) { r.width = MwGetInteger(handle, MwNwidth); r.height = MwGetInteger(handle, MwNheight); - p.x = MwDefaultBorderWidth + MwGetInteger(handle->parent, MwNleftPadding); + p.x = MwDefaultBorderWidth; p.y = MwDefaultBorderWidth; st = get_first_entry(handle->parent, lb); @@ -166,7 +166,7 @@ static void frame_draw(MwWidget handle) { MwLLDrawPixmap(handle->lowlevel, &r2, lb->list[i].pixmap); } p.y += MwTextHeight(handle, "M") / 2; - p.x = 0; + p.x = MwGetInteger(handle->parent, MwNleftPadding); for(j = 0; j < arrlen(lb->list[i].name); j++) { p.x += MwDefaultBorderWidth; MwDrawText(handle, &p, lb->list[i].name[j], 0, MwALIGNMENT_BEGINNING, selected ? base : text);