smoother tab
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-05-07 22:59:54 +09:00
commit d1143a68ac
Signed by: nishi
GPG key ID: 27EF69B208EB9343

View file

@ -152,14 +152,8 @@ static void show_frame(MwWidget handle) {
int n = MwGetInteger(handle, MwNvalue); int n = MwGetInteger(handle, MwNvalue);
int i; int i;
for(i = 0; i < arrlen(t->frames); i++) {
if(i != n) MwLLShow(t->frames[i]->lowlevel, 0);
}
resize(handle); resize(handle);
MwLLShow(t->frames[n]->lowlevel, 1);
MwForceRender(handle); MwForceRender(handle);
MwDispatchUserHandler(handle, MwNchangedHandler, NULL); MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
@ -185,14 +179,12 @@ static void click(MwWidget handle) {
static MwWidget mwTabAddImpl(MwWidget handle, const char* name) { static MwWidget mwTabAddImpl(MwWidget handle, const char* name) {
MwTab t = handle->internal; MwTab t = handle->internal;
MwWidget f = MwCreateWidget(MwFrameClass, "tabframe", handle, 0, MwGetInteger(handle, MwNheight), 0, 0); MwWidget f = MwCreateWidget(MwFrameClass, "tabframe", handle, 0, MwGetInteger(handle, MwNheight), MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) * 2, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2);
char* n = MwStringDuplicate(name); char* n = MwStringDuplicate(name);
arrput(t->frames, f); arrput(t->frames, f);
arrput(t->names, n); arrput(t->names, n);
MwLLShow(f->lowlevel, 0);
MwForceRender(handle); MwForceRender(handle);
if(MwGetInteger(handle, MwNvalue) == -1) { if(MwGetInteger(handle, MwNvalue) == -1) {
@ -229,15 +221,20 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
static void resize(MwWidget handle) { static void resize(MwWidget handle) {
MwTab t = handle->internal; MwTab t = handle->internal;
int v = MwGetInteger(handle, MwNvalue); int v = MwGetInteger(handle, MwNvalue);
int i;
if(v == -1) return; for(i = 0; i < arrlen(t->frames); i++) {
int y = MwGetInteger(handle, MwNheight);
MwVaApply(t->frames[v], if(i == v) tab_height(handle) + MwDefaultBorderWidth(handle);
MwNx, MwDefaultBorderWidth(handle),
MwNy, tab_height(handle) + MwDefaultBorderWidth(handle), MwVaApply(t->frames[i],
MwNwidth, MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) * 2, MwNx, MwDefaultBorderWidth(handle),
MwNheight, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2, MwNy, y,
NULL); MwNwidth, MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) * 2,
MwNheight, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2,
NULL);
}
} }
MwClassRec MwTabClassRec = { MwClassRec MwTabClassRec = {