git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@379 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-16 18:59:58 +00:00
parent a9e8b84fc0
commit 1b8f877b87
2 changed files with 18 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ typedef struct filechooser {
MwLLPixmap back; MwLLPixmap back;
MwLLPixmap forward; MwLLPixmap forward;
MwLLPixmap up; MwLLPixmap up;
MwLLPixmap computer;
} filechooser_t; } filechooser_t;
static void destroy(MwWidget handle) { static void destroy(MwWidget handle) {
@@ -25,6 +26,10 @@ static void destroy(MwWidget handle) {
MwLLDestroyPixmap(fc->dir); MwLLDestroyPixmap(fc->dir);
MwLLDestroyPixmap(fc->file); MwLLDestroyPixmap(fc->file);
MwLLDestroyPixmap(fc->back);
MwLLDestroyPixmap(fc->forward);
MwLLDestroyPixmap(fc->up);
MwLLDestroyPixmap(fc->computer);
free(handle->opaque); free(handle->opaque);
MwDestroyWidget(handle); MwDestroyWidget(handle);
} }
@@ -54,7 +59,10 @@ static void layout(MwWidget handle) {
ww = 160; ww = 160;
wh = h - 10 - 24 - 5 - 24 - 5 - 24 - 5; wh = h - 10 - 24 - 5 - 24 - 5 - 24 - 5;
if(fc->nav == NULL) { 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 { } else {
MwVaApply(fc->nav, MwVaApply(fc->nav,
MwNx, wx, MwNx, wx,
@@ -71,6 +79,7 @@ static void layout(MwWidget handle) {
if(fc->files == NULL) { if(fc->files == NULL) {
fc->files = MwVaCreateWidget(MwListBoxClass, "files", handle, wx, wy, ww, wh, fc->files = MwVaCreateWidget(MwListBoxClass, "files", handle, wx, wy, ww, wh,
MwNhasHeading, 1, MwNhasHeading, 1,
MwNleftPadding, 16,
NULL); NULL);
} else { } else {
MwVaApply(fc->files, MwVaApply(fc->files,
@@ -254,11 +263,12 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) {
MwNtitle, title, MwNtitle, title,
NULL); NULL);
fc->dir = MwLoadXPM(window, MwIconDirectory); fc->dir = MwLoadXPM(window, MwIconDirectory);
fc->file = MwLoadXPM(window, MwIconFile); fc->file = MwLoadXPM(window, MwIconFile);
fc->back = MwLoadXPM(window, MwIconBack); fc->back = MwLoadXPM(window, MwIconBack);
fc->forward = MwLoadXPM(window, MwIconForward); fc->forward = MwLoadXPM(window, MwIconForward);
fc->up = MwLoadXPM(window, MwIconUp); fc->up = MwLoadXPM(window, MwIconUp);
fc->computer = MwLoadXPM(window, MwIconComputer);
window->opaque = fc; window->opaque = fc;

View File

@@ -139,7 +139,7 @@ static void frame_draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth); r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
p.x = MwDefaultBorderWidth + MwGetInteger(handle->parent, MwNleftPadding); p.x = MwDefaultBorderWidth;
p.y = MwDefaultBorderWidth; p.y = MwDefaultBorderWidth;
st = get_first_entry(handle->parent, lb); 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); MwLLDrawPixmap(handle->lowlevel, &r2, lb->list[i].pixmap);
} }
p.y += MwTextHeight(handle, "M") / 2; 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++) { for(j = 0; j < arrlen(lb->list[i].name); j++) {
p.x += MwDefaultBorderWidth; p.x += MwDefaultBorderWidth;
MwDrawText(handle, &p, lb->list[i].name[j], 0, MwALIGNMENT_BEGINNING, selected ? base : text); MwDrawText(handle, &p, lb->list[i].name[j], 0, MwALIGNMENT_BEGINNING, selected ? base : text);