finalize tab fix a bit more

This commit is contained in:
IoIxD 2026-05-21 18:21:50 -07:00
commit e7506922d2

View file

@ -2,8 +2,6 @@
#include "../../external/stb_ds.h" #include "../../external/stb_ds.h"
#define SOME_FIX
static void resize(MwWidget handle); static void resize(MwWidget handle);
static int wcreate(MwWidget handle) { static int wcreate(MwWidget handle) {
@ -192,11 +190,7 @@ 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;
#ifdef SOME_FIX
MwWidget f = MwCreateWidget(MwFrameClass, "tabframe", handle, MwDefaultBorderWidth(handle), tab_height(handle) + MwDefaultBorderWidth(handle), MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) * 2, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2); MwWidget f = MwCreateWidget(MwFrameClass, "tabframe", handle, MwDefaultBorderWidth(handle), tab_height(handle) + MwDefaultBorderWidth(handle), MwGetInteger(handle, MwNwidth) - MwDefaultBorderWidth(handle) * 2, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2);
#else
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);
#endif
char* n = MwStringDuplicate(name); char* n = MwStringDuplicate(name);
arrput(t->frames, f); arrput(t->frames, f);
@ -207,12 +201,9 @@ static MwWidget mwTabAddImpl(MwWidget handle, const char* name) {
if(MwGetInteger(handle, MwNvalue) == -1) { if(MwGetInteger(handle, MwNvalue) == -1) {
MwSetInteger(handle, MwNvalue, arrlen(t->frames) - 1); MwSetInteger(handle, MwNvalue, arrlen(t->frames) - 1);
show_frame(handle); show_frame(handle);
} } else {
#ifdef SOME_FIX
else{
MwLLShow(f->lowlevel, 0); MwLLShow(f->lowlevel, 0);
} }
#endif
return f; return f;
} }
@ -248,9 +239,7 @@ static void resize(MwWidget handle) {
for(i = 0; i < arrlen(t->frames); i++) { for(i = 0; i < arrlen(t->frames); i++) {
int y = MwGetInteger(handle, MwNheight); int y = MwGetInteger(handle, MwNheight);
#ifdef SOME_FIX
MwLLShow(t->frames[i]->lowlevel, i == v); MwLLShow(t->frames[i]->lowlevel, i == v);
#else
if(i == v) y = tab_height(handle) + MwDefaultBorderWidth(handle); if(i == v) y = tab_height(handle) + MwDefaultBorderWidth(handle);
MwVaApply(t->frames[i], MwVaApply(t->frames[i],
@ -260,10 +249,8 @@ static void resize(MwWidget handle) {
MwNheight, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2, MwNheight, MwGetInteger(handle, MwNheight) - tab_height(handle) - MwDefaultBorderWidth(handle) * 2,
NULL); NULL);
if(i == v){ if(i == v) {
} }
#endif
} }
} }