git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@277 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
Nishi 2025-10-11 16:07:18 +00:00
commit d7a4c7866e
3 changed files with 7 additions and 13 deletions

View file

@ -135,7 +135,7 @@ else
L_CFLAGS += -DUSE_STB_IMAGE L_CFLAGS += -DUSE_STB_IMAGE
endif endif
EXAMPLES = examples/example$(EXEC) examples/rotate$(EXEC) examples/image$(EXEC) examples/scrollbar$(EXEC) examples/checkbox$(EXEC) examples/messagebox$(EXEC) EXAMPLES = examples/example$(EXEC) examples/rotate$(EXEC) examples/image$(EXEC) examples/scrollbar$(EXEC) examples/checkbox$(EXEC) examples/messagebox$(EXEC) examples/viewport$(EXEC)
ifeq ($(OPENGL),1) ifeq ($(OPENGL),1)
L_OBJS += src/widget/opengl.o L_OBJS += src/widget/opengl.o

View file

@ -187,7 +187,10 @@ static void mouse_down(MwWidget handle, void* ptr) {
} }
static void prop_change(MwWidget handle, const char* key) { static void prop_change(MwWidget handle, const char* key) {
if(strcmp(key, MwNminValue) == 0 || strcmp(key, MwNvalue) == 0 || strcmp(key, MwNmaxValue) == 0 || strcmp(key, MwNareaShown) == 0) MwForceRender(handle); if(strcmp(key, MwNminValue) == 0 || strcmp(key, MwNvalue) == 0 || strcmp(key, MwNmaxValue) == 0 || strcmp(key, MwNareaShown) == 0) {
if(handle->prop_event) MwDispatchUserHandler(handle, MwNchangedHandler, NULL);
MwForceRender(handle);
}
} }
MwClassRec MwScrollBarClassRec = { MwClassRec MwScrollBarClassRec = {

View file

@ -36,8 +36,8 @@ static void resize(MwWidget handle) {
viewport_t* vp = handle->internal; viewport_t* vp = handle->internal;
int w = MwGetInteger(handle, MwNwidth); int w = MwGetInteger(handle, MwNwidth);
int h = MwGetInteger(handle, MwNheight); int h = MwGetInteger(handle, MwNheight);
int iw, ix; int iw;
int ih, iy; int ih;
if(vp->vscroll == NULL) { if(vp->vscroll == NULL) {
vp->vscroll = MwVaCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h - 16, NULL); vp->vscroll = MwVaCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h - 16, NULL);
MwAddUserHandler(vp->vscroll, MwNchangedHandler, vscroll_changed, vp); MwAddUserHandler(vp->vscroll, MwNchangedHandler, vscroll_changed, vp);
@ -77,24 +77,15 @@ static void resize(MwWidget handle) {
iw = MwGetInteger(vp->inframe, MwNwidth); iw = MwGetInteger(vp->inframe, MwNwidth);
ih = MwGetInteger(vp->inframe, MwNheight); ih = MwGetInteger(vp->inframe, MwNheight);
iy = MwGetInteger(vp->vscroll, MwNvalue);
if(iy > ih) iy = ih;
MwVaApply(vp->vscroll, MwVaApply(vp->vscroll,
MwNareaShown, h - 16, MwNareaShown, h - 16,
MwNmaxValue, ih, MwNmaxValue, ih,
MwNvalue, iy,
NULL); NULL);
ix = MwGetInteger(vp->hscroll, MwNvalue);
if(ix > iw) ix = iw;
MwVaApply(vp->hscroll, MwVaApply(vp->hscroll,
MwNareaShown, w - 16, MwNareaShown, w - 16,
MwNmaxValue, iw, MwNmaxValue, iw,
MwNvalue, ix,
NULL); NULL);
vscroll_changed(vp->vscroll, vp, NULL);
hscroll_changed(vp->hscroll, vp, NULL);
} }
static int create(MwWidget handle) { static int create(MwWidget handle) {