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

@@ -85,10 +85,11 @@ MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int i
* @param color Color * @param color Color
* @param invert Invert the 3D border color or not * @param invert Invert the 3D border color or not
* @param border Border width * @param border Border width
* @param diff Difference * @param diff Difference (set this to 0 if you don't know what this does)
* @param same Same as dark color
* @warning `rect` gets changed to the area of rectangle inside * @warning `rect` gets changed to the area of rectangle inside
*/ */
MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff); MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same);
/*! /*!
* @brief Creates a pixmap from image * @brief Creates a pixmap from image

View File

@@ -607,6 +607,9 @@
</properties> </properties>
</widget> </widget>
<widget name="ComboBox"> <widget name="ComboBox">
<properties>
<property name="areaShown" />
</properties>
<functions> <functions>
<function name="Add"> <function name="Add">
<integer name="index" /> <integer name="index" />

View File

@@ -128,12 +128,12 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) { void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
if(MwGetInteger(handle, MwNmodernLook)) { if(MwGetInteger(handle, MwNmodernLook)) {
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0); MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0, 0);
} else { } else {
int diff = get_color_diff(handle) / 3 * 2; int diff = get_color_diff(handle) / 3 * 2;
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, -diff); MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, -diff, handle->widget_class == MwWindowClass ? 1 : 0);
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, diff); MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, diff, 0);
} }
} }
@@ -219,11 +219,11 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
MwLLFreeColor(darker); MwLLFreeColor(darker);
} }
void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff) { void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same) {
MwPoint p[6]; MwPoint p[6];
int ColorDiff = get_color_diff(handle); int ColorDiff = get_color_diff(handle);
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff); MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff); MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff);
p[0].x = rect->x; p[0].x = rect->x;
p[0].y = rect->y; p[0].y = rect->y;

View File

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

View File

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

View File

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