mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
add MwNouterPadding
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#define MwNfillArea "IfillArea"
|
#define MwNfillArea "IfillArea"
|
||||||
#define MwNratio "Iratio"
|
#define MwNratio "Iratio"
|
||||||
#define MwNfixedSize "IfixedSize"
|
#define MwNfixedSize "IfixedSize"
|
||||||
|
#define MwNouterPadding "IouterPadding"
|
||||||
|
|
||||||
#define MwNtitle "Stitle"
|
#define MwNtitle "Stitle"
|
||||||
#define MwNtext "Stext"
|
#define MwNtext "Stext"
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
<integer name="borderWidth" />
|
<integer name="borderWidth" />
|
||||||
<integer name="ratio" />
|
<integer name="ratio" />
|
||||||
<integer name="fixedSize" />
|
<integer name="fixedSize" />
|
||||||
|
<integer name="outerPadding" />
|
||||||
|
|
||||||
<string name="title" />
|
<string name="title" />
|
||||||
<string name="text" />
|
<string name="text" />
|
||||||
@@ -491,6 +492,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="orientation" />
|
<property name="orientation" />
|
||||||
<property name="padding" />
|
<property name="padding" />
|
||||||
|
<property name="outerPadding" />
|
||||||
</properties>
|
</properties>
|
||||||
</widget>
|
</widget>
|
||||||
<widget name="Button">
|
<widget name="Button">
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ static int create(MwWidget handle) {
|
|||||||
|
|
||||||
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
|
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
|
||||||
MwSetInteger(handle, MwNpadding, 0);
|
MwSetInteger(handle, MwNpadding, 0);
|
||||||
|
MwSetInteger(handle, MwNouterPadding, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -28,9 +29,9 @@ static void layout(MwWidget handle) {
|
|||||||
int i;
|
int i;
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
int horiz = MwGetInteger(handle, MwNorientation) == MwHORIZONTAL ? 1 : 0;
|
int horiz = MwGetInteger(handle, MwNorientation) == MwHORIZONTAL ? 1 : 0;
|
||||||
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - MwGetInteger(handle, MwNpadding);
|
int sz = MwGetInteger(handle, horiz ? MwNwidth : MwNheight) - MwGetInteger(handle, MwNouterPadding) * 2;
|
||||||
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - MwGetInteger(handle, MwNpadding) * 2;
|
int fsz = MwGetInteger(handle, horiz ? MwNheight : MwNwidth) - MwGetInteger(handle, MwNouterPadding) * 2;
|
||||||
int sk = 0;
|
int sk = MwGetInteger(handle, MwNouterPadding);
|
||||||
|
|
||||||
for(i = 0; i < arrlen(handle->children); i++) {
|
for(i = 0; i < arrlen(handle->children); i++) {
|
||||||
int n = MwGetInteger(handle->children[i], MwNratio);
|
int n = MwGetInteger(handle->children[i], MwNratio);
|
||||||
@@ -38,7 +39,7 @@ static void layout(MwWidget handle) {
|
|||||||
if(n == MwDEFAULT) n = 1;
|
if(n == MwDEFAULT) n = 1;
|
||||||
|
|
||||||
if(s != MwDEFAULT) {
|
if(s != MwDEFAULT) {
|
||||||
sz -= s + MwGetInteger(handle, MwNpadding);
|
sz -= s + ((i != (arrlen(handle->children) - 1)) ? MwGetInteger(handle, MwNpadding) : 0);
|
||||||
} else {
|
} else {
|
||||||
sum += n;
|
sum += n;
|
||||||
}
|
}
|
||||||
@@ -53,17 +54,17 @@ static void layout(MwWidget handle) {
|
|||||||
if(s != MwDEFAULT) {
|
if(s != MwDEFAULT) {
|
||||||
wsz = s;
|
wsz = s;
|
||||||
} else {
|
} else {
|
||||||
wsz = sz * n / sum - MwGetInteger(handle, MwNpadding);
|
wsz = sz * n / sum;
|
||||||
}
|
}
|
||||||
|
wsz -= ((i != (arrlen(handle->children) - 1)) ? MwGetInteger(handle, MwNpadding) : 0);
|
||||||
|
|
||||||
sk += MwGetInteger(handle, MwNpadding);
|
|
||||||
MwVaApply(handle->children[i],
|
MwVaApply(handle->children[i],
|
||||||
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
|
horiz ? MwNx : MwNy, sk, /* this is what gets changed */
|
||||||
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNpadding), /* fixed between widgets */
|
horiz ? MwNy : MwNx, MwGetInteger(handle, MwNouterPadding), /* fixed between widgets */
|
||||||
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
|
horiz ? MwNwidth : MwNheight, wsz, /* this is what gets changed */
|
||||||
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
|
horiz ? MwNheight : MwNwidth, fsz, /* fixed between widgets */
|
||||||
NULL);
|
NULL);
|
||||||
sk += wsz;
|
sk += wsz + ((i != (arrlen(handle->children) - 1)) ? MwGetInteger(handle, MwNpadding) : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user