diff --git a/include/Mw/StringDefs.h b/include/Mw/StringDefs.h index 02cf80d..f928e09 100644 --- a/include/Mw/StringDefs.h +++ b/include/Mw/StringDefs.h @@ -30,6 +30,7 @@ #define MwNsingleClickSelectable "IsingleClickSelectable" #define MwNflat "Iflat" #define MwNshowArrows "IshowArrows" +#define MwNpadding "Ipadding" #define MwNtitle "Stitle" #define MwNtext "Stext" diff --git a/milsko.xml b/milsko.xml index 2ab9d4f..13b0dda 100644 --- a/milsko.xml +++ b/milsko.xml @@ -72,6 +72,8 @@ + + @@ -449,6 +451,7 @@ + @@ -557,6 +560,7 @@ + diff --git a/src/core.c b/src/core.c index dd3fb4e..e0d1c34 100644 --- a/src/core.c +++ b/src/core.c @@ -490,7 +490,7 @@ void MwVaListApply(MwWidget handle, va_list va) { } if(x != MwDEFAULT && y != MwDEFAULT) { MwLLSetXY(handle->lowlevel, x, y); - if(handle->prop_event){ + if(handle->prop_event) { MwDispatch3(handle, prop_change, MwNx); MwDispatch3(handle, prop_change, MwNy); } @@ -503,7 +503,7 @@ void MwVaListApply(MwWidget handle, va_list va) { } if(w != MwDEFAULT && h != MwDEFAULT) { MwLLSetWH(handle->lowlevel, w, h); - if(handle->prop_event){ + if(handle->prop_event) { MwDispatch3(handle, prop_change, MwNwidth); MwDispatch3(handle, prop_change, MwNheight); } diff --git a/src/widget/button.c b/src/widget/button.c index d8c0f22..9a73871 100644 --- a/src/widget/button.c +++ b/src/widget/button.c @@ -5,6 +5,7 @@ static int create(MwWidget handle) { MwSetDefault(handle); MwSetInteger(handle, MwNflat, 0); + MwSetInteger(handle, MwNpadding, 0); return 0; } @@ -54,6 +55,8 @@ static void draw(MwWidget handle) { r.width = px->common.width * sh; r.height = px->common.height * sh; } + r.width -= MwGetInteger(handle, MwNpadding) * 2; + r.height -= MwGetInteger(handle, MwNpadding) * 2; r.x += (double)(ow - r.width) / 2; r.y += (double)(oh - r.height) / 2; @@ -75,7 +78,7 @@ static void click(MwWidget handle) { } static void prop_change(MwWidget handle, const char* key) { - if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0) MwForceRender(handle); + if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0 || strcmp(key, MwNpadding) == 0) MwForceRender(handle); } MwClassRec MwButtonClassRec = {