mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 16:10:50 +00:00
better
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@763 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -6,23 +6,14 @@
|
||||
|
||||
static void set_xywh(MwWidget handle) {
|
||||
int height = 0;
|
||||
int i;
|
||||
MwMenu m = handle->internal;
|
||||
|
||||
for(i = 0; i < arrlen(m->sub); i++) {
|
||||
int h = MwTextHeight(handle, m->sub[i]->name);
|
||||
if(height < h) {
|
||||
height = h;
|
||||
}
|
||||
}
|
||||
|
||||
height += 20;
|
||||
height = MwTextHeight(handle, "M") + 10;
|
||||
|
||||
MwVaApply(handle,
|
||||
MwNx, 0,
|
||||
MwNy, 0,
|
||||
MwNwidth, MwGetInteger(handle->parent, MwNwidth),
|
||||
MwNheight, height,
|
||||
MwNx, -MwDefaultBorderWidth(handle),
|
||||
MwNy, -MwDefaultBorderWidth(handle),
|
||||
MwNwidth, MwGetInteger(handle->parent, MwNwidth) + MwDefaultBorderWidth(handle),
|
||||
MwNheight, height + MwDefaultBorderWidth(handle),
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -66,15 +57,15 @@ static void destroy(MwWidget handle) {
|
||||
MwRect r; \
|
||||
int rx; \
|
||||
\
|
||||
p.x = 10; \
|
||||
p.y = MwGetInteger(handle, MwNheight) / 2; \
|
||||
p.x = 5; \
|
||||
p.y = (MwGetInteger(handle, MwNheight) - MwDefaultBorderWidth(handle)) / 2 + MwDefaultBorderWidth(handle); \
|
||||
\
|
||||
r.x = 0; \
|
||||
r.y = 0; \
|
||||
r.width = MwGetInteger(handle, MwNwidth); \
|
||||
r.height = MwGetInteger(handle, MwNheight); \
|
||||
\
|
||||
rx = r.width - 10;
|
||||
rx = r.width - 5;
|
||||
|
||||
#define BEGIN_MENU_LOOP \
|
||||
for(i = 0; i < arrlen(m->sub); i++) { \
|
||||
@@ -85,7 +76,7 @@ static void destroy(MwWidget handle) {
|
||||
\
|
||||
if(incr) { \
|
||||
p.x = rx -= tw; \
|
||||
rx -= 20; \
|
||||
rx -= 10; \
|
||||
} \
|
||||
\
|
||||
r.x = p.x - 5; \
|
||||
@@ -115,7 +106,7 @@ static void draw(MwWidget handle) {
|
||||
MwDrawWidgetBack(handle, &r, base, 0, MwFALSE);
|
||||
}
|
||||
|
||||
MwDrawText(handle, &p, m->sub[i]->name + incr, 1, MwALIGNMENT_BEGINNING, text);
|
||||
MwDrawText(handle, &p, m->sub[i]->name + incr, m->sub[i]->wsub != NULL || (in_area && handle->pressed) ? 1 : 0, MwALIGNMENT_BEGINNING, text);
|
||||
END_MENU_LOOP;
|
||||
|
||||
MwLLFreeColor(text);
|
||||
|
||||
@@ -75,7 +75,7 @@ static void draw(MwWidget handle) {
|
||||
p.x = 5 + tw / 2;
|
||||
|
||||
p.y += th / 2;
|
||||
MwDrawText(handle, &p, menu->sub[i]->name, 1, MwALIGNMENT_CENTER, text);
|
||||
MwDrawText(handle, &p, menu->sub[i]->name, menu->sub[i]->wsub != NULL ? 1 : 0, MwALIGNMENT_CENTER, text);
|
||||
|
||||
if(arrlen(menu->sub[i]->sub) > 0) {
|
||||
MwRect tr;
|
||||
|
||||
Reference in New Issue
Block a user