mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-19 23:54:12 +00:00
fancier
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@744 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user