git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@744 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-16 08:59:09 +00:00
parent 9a0734a78f
commit 3e40b9ab16
7 changed files with 37 additions and 12 deletions

View File

@@ -14,6 +14,8 @@ static int create(MwWidget handle) {
MwSetDefault(handle);
MwSetInteger(handle, MwNareaShown, 6);
return 0;
}
@@ -102,6 +104,14 @@ static void click(MwWidget handle) {
int i;
void* packet;
int width = MwGetInteger(handle, MwNwidth);
int ent = MwGetInteger(handle, MwNareaShown);
if(arrlen(cb->list) == 0) {
cb->opened = 0;
return;
}
if(ent > arrlen(cb->list)) ent = arrlen(cb->list);
MwLLSetCursor(handle->lowlevel, &MwCursorArrow, &MwCursorArrowMask);
@@ -110,10 +120,11 @@ static void click(MwWidget handle) {
if(l > width) width = l;
}
cb->listbox = MwVaCreateWidget(MwListBoxClass, "listbox", handle, 0, MwGetInteger(handle, MwNheight), width, MwTextHeight(handle, "M") * 6 + MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M") / 4,
cb->listbox = MwVaCreateWidget(MwListBoxClass, "listbox", handle, 0, MwGetInteger(handle, MwNheight), width, MwTextHeight(handle, "M") * ent + MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M") / 4,
MwNsingleClickSelectable, 1,
NULL);
MwLLShow(cb->listbox->lowlevel, 0);
MwLLSetCursor(((MwListBox)cb->listbox->internal)->frame->lowlevel, &MwCursorArrow, &MwCursorArrowMask);
packet = MwListBoxCreatePacket();
for(i = 0; i < arrlen(cb->list); i++) {
@@ -127,9 +138,10 @@ static void click(MwWidget handle) {
p.x = 0;
p.y = MwGetInteger(handle, MwNheight);
MwLLBeginStateChange(cb->listbox->lowlevel);
MwLLDetach(cb->listbox->lowlevel, &p);
MwLLMakeToolWindow(cb->listbox->lowlevel);
MwLLShow(cb->listbox->lowlevel, 1);
MwLLEndStateChange(cb->listbox->lowlevel);
} else {
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);

View File

@@ -259,6 +259,7 @@ static void resize(MwWidget handle) {
int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight);
int ih, y;
int aw;
y = MwGetInteger(handle, MwNhasHeading) ? (MwTextHeight(handle, "M") + MwDefaultBorderWidth(handle) * 2) : 0;
@@ -289,6 +290,7 @@ static void resize(MwWidget handle) {
MwNheight, h,
NULL);
}
aw = w;
h -= MwDefaultBorderWidth(handle) * 2;
ih = arrlen(lb->list);
@@ -298,6 +300,13 @@ static void resize(MwWidget handle) {
MwNareaShown, h / MwTextHeight(handle, "M"),
MwNmaxValue, ih,
NULL);
if(ih <= (h / MwTextHeight(handle, "M"))) {
MwLLShow(lb->vscroll->lowlevel, 0);
MwSetInteger(lb->frame, MwNwidth, aw);
} else {
MwLLShow(lb->vscroll->lowlevel, 1);
}
}
static int create(MwWidget handle) {

View File

@@ -26,7 +26,7 @@ static void draw(MwWidget handle) {
r.y = (r.height - 2) / 2;
r.height = 2;
}
MwDrawFrameEx(handle, &r, base, 1, 1, 0);
MwDrawFrameEx(handle, &r, base, 1, 1, 0, 0);
MwLLFreeColor(base);
}