mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-30 22:20:50 +00:00
add MwNleftPadding to SubMenu
This commit is contained in:
@@ -640,6 +640,9 @@
|
||||
</functions>
|
||||
</widget>
|
||||
<widget name="SubMenu">
|
||||
<properties>
|
||||
<property name="leftPadding" />
|
||||
</properties>
|
||||
<functions>
|
||||
<function name="Appear">
|
||||
<arguments>
|
||||
|
||||
@@ -6,6 +6,7 @@ static int create(MwWidget handle) {
|
||||
MwLLBeginStateChange(handle->lowlevel);
|
||||
|
||||
MwSetDefault(handle);
|
||||
MwSetInteger(handle, MwNleftPadding, 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -53,9 +54,11 @@ static void draw(MwWidget handle) {
|
||||
|
||||
rc.x = MwDefaultBorderWidth(handle) * 2;
|
||||
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.x += MwGetInteger(handle, MwNleftPadding);
|
||||
|
||||
MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0);
|
||||
|
||||
p.y += 2 + 1;
|
||||
@@ -71,7 +74,7 @@ static void draw(MwWidget handle) {
|
||||
MwDrawWidgetBack(handle, &r, base, 0, MwTRUE);
|
||||
}
|
||||
|
||||
p.x = 5 + tw / 2;
|
||||
p.x = 5 + tw / 2 + MwGetInteger(handle, MwNleftPadding);
|
||||
|
||||
p.y += th / 2;
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
MwPoint p;
|
||||
int j;
|
||||
@@ -184,6 +187,8 @@ static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point, in
|
||||
}
|
||||
}
|
||||
|
||||
w += MwGetInteger(handle, MwNleftPadding);
|
||||
|
||||
w += 10 + 15;
|
||||
h += 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user