introduce MwNflat

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@723 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-14 18:42:31 +00:00
parent b5180b2081
commit d5890ee67e
5 changed files with 25 additions and 16 deletions

View File

@@ -4,6 +4,8 @@
static int create(MwWidget handle) {
MwSetDefault(handle);
MwSetInteger(handle, MwNflat, 0);
return 0;
}
@@ -22,7 +24,13 @@ static void draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
MwDrawWidgetBack(handle, &r, base, handle->pressed, MwTRUE);
MwDrawWidgetBack(handle, &r, base, handle->pressed, MwGetInteger(handle, MwNflat) ? handle->pressed : 1);
if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle);
r.width -= MwDefaultBorderWidth(handle) * 2;
r.height -= MwDefaultBorderWidth(handle) * 2;
}
if(px != NULL) {
int ow = r.width;
@@ -61,7 +69,7 @@ static void click(MwWidget handle) {
}
static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0) MwForceRender(handle);
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0) MwForceRender(handle);
}
MwClassRec MwButtonClassRec = {