file chooser

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@408 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-18 14:17:26 +00:00
parent eff6ef3fa0
commit 266c2f5a16
3 changed files with 112 additions and 1 deletions

View File

@@ -75,7 +75,27 @@ static void files_activate(MwWidget handle, void* user, void* call) {
(void)user;
scan(handle->parent, fc->sorted_entries[index - 1]->name);
if(fc->sorted_entries[index - 1]->type == MwDIRECTORY_DIRECTORY) {
char* p = MwDirectoryJoin(fc->path, fc->sorted_entries[index - 1]->name);
scan(handle->parent, p);
free(p);
} else {
okay(fc->okay, NULL, NULL);
}
}
static void addr_up_activate(MwWidget handle, void* user, void* call) {
filechooser_t* fc = handle->parent->opaque;
char* p = MwDirectoryJoin(fc->path, "..");
(void)user;
(void)call;
scan(handle->parent, p);
free(p);
}
static void layout(MwWidget handle) {
@@ -178,6 +198,7 @@ static void layout(MwWidget handle) {
fc->addr_up = MwVaCreateWidget(MwButtonClass, "addr_up", handle, wx, wy, ww, wh,
MwNpixmap, fc->up,
NULL);
MwAddUserHandler(fc->addr_up, MwNactivateHandler, addr_up_activate, NULL);
} else {
MwVaApply(fc->addr_up,
MwNx, wx,