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 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;

View File

@@ -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);