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

View File

@@ -135,7 +135,7 @@ else
L_CFLAGS += -DUSE_STB_IMAGE
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)
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) {
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 = {

View File

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