From d25d10bacfe275d3d071e27dc462e6305543bb3e Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sat, 15 Nov 2025 20:57:23 +0000 Subject: [PATCH] things git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@731 b9cfdab3-6d41-4d17-bbe4-086880011989 --- milsko.xml | 4 ++++ src/widget/image.c | 8 +++++++- src/widget/window.c | 12 +++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/milsko.xml b/milsko.xml index 76ad045..01467d3 100644 --- a/milsko.xml +++ b/milsko.xml @@ -462,6 +462,8 @@ + + @@ -585,6 +587,8 @@ + + diff --git a/src/widget/image.c b/src/widget/image.c index 93fe446..6728f73 100644 --- a/src/widget/image.c +++ b/src/widget/image.c @@ -4,6 +4,9 @@ static int create(MwWidget handle) { MwSetDefault(handle); + MwSetInteger(handle, MwNhasBorder, 0); + MwSetInteger(handle, MwNinverted, 1); + return 0; } @@ -16,6 +19,9 @@ static void draw(MwWidget handle) { r.y = 0; r.width = MwGetInteger(handle, MwNwidth); r.height = MwGetInteger(handle, MwNheight); + + if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted)); + MwDrawRect(handle, &r, base); if(px != NULL) { MwLLDrawPixmap(handle->lowlevel, &r, px); @@ -25,7 +31,7 @@ static void draw(MwWidget handle) { } static void prop_change(MwWidget handle, const char* key) { - if(strcmp(key, MwNpixmap) == 0) MwForceRender(handle); + if(strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNhasBorder) == 0 || strcmp(key, MwNinverted) == 0) MwForceRender(handle); } MwClassRec MwImageClassRec = { diff --git a/src/widget/window.c b/src/widget/window.c index b5b594a..5368a44 100644 --- a/src/widget/window.c +++ b/src/widget/window.c @@ -4,6 +4,9 @@ static int create(MwWidget handle) { MwSetDefault(handle); + MwSetInteger(handle, MwNhasBorder, 0); + MwSetInteger(handle, MwNinverted, 1); + return 0; } @@ -16,10 +19,17 @@ static void draw(MwWidget handle) { r.width = MwGetInteger(handle, MwNwidth); r.height = MwGetInteger(handle, MwNheight); + if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted)); + MwDrawRect(handle, &r, c); MwLLFreeColor(c); } + +static void prop_change(MwWidget handle, const char* key) { + if(strcmp(key, MwNhasBorder) == 0 || strcmp(key, MwNinverted) == 0) MwForceRender(handle); +} + static void mwWindowMakeBorderlessImpl(MwWidget handle, int toggle) { MwLLBeginStateChange(handle->lowlevel); MwLLMakeBorderless(handle->lowlevel, toggle); @@ -40,7 +50,7 @@ MwClassRec MwWindowClassRec = { draw, /* draw */ NULL, /* click */ NULL, /* parent_resize */ - NULL, /* prop_change */ + prop_change, /* prop_change */ NULL, /* mouse_move */ NULL, /* mouse_up */ NULL, /* mouse_down */