git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@718 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-14 17:11:16 +00:00
parent 9cf85f3956
commit 4fe99a5601
3 changed files with 29 additions and 13 deletions

View File

@@ -345,14 +345,19 @@ MwWidget MwColorPicker(MwWidget handle, const char* title) {
MwSizeHints sh; MwSizeHints sh;
int ww = MwGetInteger(handle, MwNwidth); int ww = MwGetInteger(handle, MwNwidth);
int wh = MwGetInteger(handle, MwNheight); int wh = MwGetInteger(handle, MwNheight);
int wx;
int wy;
p.x = (ww - WIN_SIZE) / 2; p.x = (ww - WIN_SIZE) / 2;
p.y = (wh - WIN_SIZE) / 2; p.y = (wh - WIN_SIZE) / 2;
wx = wy = 0;
if(handle == NULL) wx = wy = MwDEFAULT;
sh.min_width = sh.max_width = WIN_SIZE; sh.min_width = sh.max_width = WIN_SIZE;
sh.min_height = sh.max_height = WIN_SIZE; sh.min_height = sh.max_height = WIN_SIZE;
window = MwVaCreateWidget(MwWindowClass, "main", handle, 0, 0, window = MwVaCreateWidget(MwWindowClass, "main", handle, wx, wy,
WIN_SIZE, WIN_SIZE, WIN_SIZE, WIN_SIZE,
MwNtitle, title, MwNtitle, title,
MwNsizeHints, &sh, MwNsizeHints, &sh,
@@ -365,7 +370,7 @@ MwWidget MwColorPicker(MwWidget handle, const char* title) {
MwAddTickList(window); MwAddTickList(window);
MwLLBeginStateChange(window->lowlevel); MwLLBeginStateChange(window->lowlevel);
MwLLDetach(window->lowlevel, &p); if(handle != NULL) MwLLDetach(window->lowlevel, &p);
MwLLMakePopup(window->lowlevel, handle->lowlevel); MwLLMakePopup(window->lowlevel, handle->lowlevel);
MwLLEndStateChange(window->lowlevel); MwLLEndStateChange(window->lowlevel);

View File

@@ -465,18 +465,24 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) {
filechooser_t* fc = malloc(sizeof(*fc)); filechooser_t* fc = malloc(sizeof(*fc));
char* path; char* path;
MwLLPixmap icon; MwLLPixmap icon;
int wx;
int wy;
memset(fc, 0, sizeof(*fc)); memset(fc, 0, sizeof(*fc));
w = 700; w = 700;
h = w * 2 / 3; h = w * 2 / 3;
window = MwVaCreateWidget(MwWindowClass, "filechooser", handle, 0, 0, w, h,
MwNtitle, title,
NULL);
p.x = (ww - w) / 2; p.x = (ww - w) / 2;
p.y = (wh - h) / 2; p.y = (wh - h) / 2;
wx = wy = 0;
if(handle == NULL) wx = wy = MwDEFAULT;
window = MwVaCreateWidget(MwWindowClass, "filechooser", handle, wx, wy, w, h,
MwNtitle, title,
NULL);
fc->history_seek = 0; fc->history_seek = 0;
fc->dir = MwLoadIcon(window, MwIconDirectory); fc->dir = MwLoadIcon(window, MwIconDirectory);
@@ -502,7 +508,7 @@ MwWidget MwFileChooser(MwWidget handle, const char* title) {
free(path); free(path);
MwLLBeginStateChange(window->lowlevel); MwLLBeginStateChange(window->lowlevel);
MwLLDetach(window->lowlevel, &p); if(handle != NULL) MwLLDetach(window->lowlevel, &p);
MwLLMakePopup(window->lowlevel, handle->lowlevel); MwLLMakePopup(window->lowlevel, handle->lowlevel);
MwLLEndStateChange(window->lowlevel); MwLLEndStateChange(window->lowlevel);

View File

@@ -31,16 +31,21 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
int w, h; int w, h;
int left = 8; int left = 8;
int th; int th;
int x = 0; int x = 0;
int ww = MwGetInteger(handle, MwNwidth); int wx;
int wh = MwGetInteger(handle, MwNheight); int wy;
int ww = handle == NULL ? 0 : MwGetInteger(handle, MwNwidth);
int wh = handle == NULL ? 0 : MwGetInteger(handle, MwNheight);
w = 512; w = 512;
h = 32 * 4; h = 32 * 4;
wx = wy = 0;
if(handle == NULL) wx = wy = MwDEFAULT;
p.x = (ww - w) / 2; p.x = (ww - w) / 2;
p.y = (wh - h) / 2; p.y = (wh - h) / 2;
window = MwVaCreateWidget(MwWindowClass, "messagebox", handle, 0, 0, w, h, window = MwVaCreateWidget(MwWindowClass, "messagebox", handle, wx, wy, w, h,
MwNtitle, title, MwNtitle, title,
NULL); NULL);
@@ -100,7 +105,7 @@ MwWidget MwMessageBox(MwWidget handle, const char* text, const char* title, unsi
NULL); NULL);
MwLLBeginStateChange(window->lowlevel); MwLLBeginStateChange(window->lowlevel);
MwLLDetach(window->lowlevel, &p); if(handle != NULL) MwLLDetach(window->lowlevel, &p);
MwLLSetSizeHints(window->lowlevel, w, h, w, h); MwLLSetSizeHints(window->lowlevel, w, h, w, h);
MwLLMakePopup(window->lowlevel, handle->lowlevel); MwLLMakePopup(window->lowlevel, handle->lowlevel);
MwLLEndStateChange(window->lowlevel); MwLLEndStateChange(window->lowlevel);