mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-07 18:09:44 +00:00
add MwNleftPadding to SubMenu
This commit is contained in:
@@ -640,6 +640,9 @@
|
|||||||
</functions>
|
</functions>
|
||||||
</widget>
|
</widget>
|
||||||
<widget name="SubMenu">
|
<widget name="SubMenu">
|
||||||
|
<properties>
|
||||||
|
<property name="leftPadding" />
|
||||||
|
</properties>
|
||||||
<functions>
|
<functions>
|
||||||
<function name="Appear">
|
<function name="Appear">
|
||||||
<arguments>
|
<arguments>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ static int create(MwWidget handle) {
|
|||||||
MwLLBeginStateChange(handle->lowlevel);
|
MwLLBeginStateChange(handle->lowlevel);
|
||||||
|
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
MwSetInteger(handle, MwNleftPadding, 16);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -53,9 +54,11 @@ static void draw(MwWidget handle) {
|
|||||||
|
|
||||||
rc.x = MwDefaultBorderWidth(handle) * 2;
|
rc.x = MwDefaultBorderWidth(handle) * 2;
|
||||||
rc.y = p.y;
|
rc.y = p.y;
|
||||||
rc.width = r.width - (rc.x * 2);
|
rc.width = r.width - (rc.x * 2) - MwGetInteger(handle, MwNleftPadding);
|
||||||
rc.height = 2;
|
rc.height = 2;
|
||||||
|
|
||||||
|
rc.x += MwGetInteger(handle, MwNleftPadding);
|
||||||
|
|
||||||
MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0);
|
MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0);
|
||||||
|
|
||||||
p.y += 2 + 1;
|
p.y += 2 + 1;
|
||||||
@@ -71,7 +74,7 @@ static void draw(MwWidget handle) {
|
|||||||
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
|
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.x = 5 + tw / 2;
|
p.x = 5 + tw / 2 + MwGetInteger(handle, MwNleftPadding);
|
||||||
|
|
||||||
p.y += th / 2;
|
p.y += th / 2;
|
||||||
MwDrawText(handle, &p, menu->sub[i]->name, menu->sub[i]->wsub != NULL ? 1 : 0, MwALIGNMENT_CENTER, text);
|
MwDrawText(handle, &p, menu->sub[i]->name, menu->sub[i]->wsub != NULL ? 1 : 0, MwALIGNMENT_CENTER, text);
|
||||||
@@ -120,7 +123,7 @@ static void click(MwWidget handle) {
|
|||||||
rc.height = 2 - 1;
|
rc.height = 2 - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rc.y <= handle->mouse_point.y && handle->mouse_point.y <= (int)(rc.y + rc.height)) {
|
if(MwGetInteger(handle, MwNleftPadding) <= handle->mouse_point.x && rc.y <= handle->mouse_point.y && handle->mouse_point.y <= (int)(rc.y + rc.height)) {
|
||||||
if(menu->sub[i]->wsub == NULL && arrlen(menu->sub[i]->sub) > 0) {
|
if(menu->sub[i]->wsub == NULL && arrlen(menu->sub[i]->sub) > 0) {
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
int j;
|
int j;
|
||||||
@@ -184,6 +187,8 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w += MwGetInteger(handle, MwNleftPadding);
|
||||||
|
|
||||||
w += 10 + 15;
|
w += 10 + 15;
|
||||||
h += 3;
|
h += 3;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user