git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@109 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-01 16:58:52 +00:00
parent 4dc4093119
commit 5f5bb524ac
2 changed files with 11 additions and 4 deletions

View File

@@ -76,7 +76,8 @@ int main() {
MwMenuAdd(menu, NULL, "test 2");
MwMenuAdd(menu, NULL, "test 3");
MwMenuAdd(menu, NULL, "test 4");
MwMenuAdd(menu, NULL, "test 5");
MwMenuAdd(menu, NULL, "?test 5");
MwMenuAdd(menu, NULL, "test 6");
MwLoop(window);
}

View File

@@ -81,9 +81,14 @@ static void draw(MwWidget handle) {
MwDrawFrame(handle, &r, base, 0);
MwDrawRect(handle, &r, base);
for(i = 0; i < arrlen(m->sub); i++) {
int tw = MwTextWidth(handle, m->sub[i]->name);
int th = MwTextHeight(handle, m->sub[i]->name);
int incr = m->sub[i]->name[0] == '?' ? 1 : 0;
int tw = MwTextWidth(handle, m->sub[i]->name + incr);
int th = MwTextHeight(handle, m->sub[i]->name + incr);
int oldx = p.x;
if(incr) {
p.x = MwGetInteger(handle, MwNwidth) - tw - 10;
}
p.x += tw / 2;
r.x = p.x - tw / 2 - 5;
@@ -95,9 +100,10 @@ static void draw(MwWidget handle) {
MwDrawFrame(handle, &r, base, 0);
}
MwDrawText(handle, &p, m->sub[i]->name, 1, text);
MwDrawText(handle, &p, m->sub[i]->name + incr, 1, text);
p.x += tw / 2 + 20;
if(incr) p.x = oldx;
}
MwLLFreeColor(text);