git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@757 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-19 10:33:46 +00:00
parent 77e41ee367
commit d24a255297
2 changed files with 7 additions and 8 deletions

View File

@@ -128,7 +128,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
int h = MwGetInteger(handle, MwNheight);
st = get_first_entry(handle->parent, lb);
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M") + 2; i++) {
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, "M"))) {
unsigned long t;
int old = lb->selected;
@@ -173,7 +173,7 @@ static void frame_mouse_move(MwWidget handle, void* user, void* call) {
int h = MwGetInteger(handle, MwNheight);
st = get_first_entry(handle->parent, lb);
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M") + 2; i++) {
if(y <= p->y && p->y <= (y + MwTextHeight(handle, "M"))) {
lb->selected = st + i;
}
@@ -206,7 +206,7 @@ static void frame_draw(MwWidget handle) {
st = get_first_entry(handle->parent, lb);
area = r.height - MwDefaultBorderWidth(handle) * 2;
ent = area / MwTextHeight(handle, "M");
ent = area / MwTextHeight(handle, "M") + 2;
for(i = st; i < arrlen(lb->list) && i < st + ent; i++) {
int selected = lb->selected == i ? 1 : 0;

View File

@@ -4,7 +4,7 @@
#include "../../external/stb_ds.h"
#define OpenerSize 10
#define LineSpace 24
#define LineSpace 16
static void vscroll_changed(MwWidget handle, void* user, void* call) {
MwTreeView tv = handle->parent->internal;
@@ -22,7 +22,8 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwLLColor base, Mw
if((*skip) > 0){
(*skip)--;
skipped = 1;
}else if((*shared) < (MwGetInteger(handle, MwNheight) / MwTextHeight(handle, "M"))){
if(p->y == MwDefaultBorderWidth(handle)) p->y -= MwTextHeight(handle, "M");
}else if((*shared) < (MwGetInteger(handle, MwNheight) / MwTextHeight(handle, "M") + 2)){
MwRect r;
p->x += shift;
p->y += MwTextHeight(handle, "M") / 2;
@@ -42,7 +43,6 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwLLColor base, Mw
}
MwLLLine(handle->lowlevel, &l[0], text);
}
if(tree->tree != NULL){
r.width = OpenerSize;
r.height = OpenerSize;
@@ -50,7 +50,6 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwLLColor base, Mw
r.y = p->y - MwTextHeight(handle, "M") / 2 + (MwTextHeight(handle, "M") - r.height) / 2;
MwDrawWidgetBack(handle, &r, base, tree->opened, 1);
}
if(tree->pixmap != NULL){
r.height = MwTextHeight(handle, "M");
@@ -81,10 +80,10 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwLLColor base, Mw
l[1].x += shift + LineSpace / 2;
if(skipped && p->y > l[0].y){
l[0].y -= MwTextHeight(handle, "M");
skipped = 0;
}
if(!skipped && i != (arrlen(tree->tree) - 1)) MwLLLine(handle->lowlevel, &l[0], text);
}
}