Tabbing bugs fixed.
This commit is contained in:
parent
f6354bef6f
commit
0ceae99da3
6 changed files with 58 additions and 9 deletions
|
|
@ -4361,6 +4361,15 @@ static void pollKeyboard(AppContextT *ctx) {
|
||||||
win->hScroll->value = clampInt(win->hScroll->value, win->hScroll->min, win->hScroll->max);
|
win->hScroll->value = clampInt(win->hScroll->value, win->hScroll->min, win->hScroll->max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll into view inside any scroll container ancestor
|
||||||
|
for (WidgetT *p = next->parent; p; p = p->parent) {
|
||||||
|
if (p->wclass && (p->wclass->flags & WCLASS_SCROLL_CONTAINER) &&
|
||||||
|
p->wclass->scrollChildIntoView) {
|
||||||
|
p->wclass->scrollChildIntoView(p, next);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wgtInvalidate(win->widgetRoot);
|
wgtInvalidate(win->widgetRoot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,9 @@ typedef struct WidgetClassT {
|
||||||
// Text field width (for scroll calculations; 0 = use widget width)
|
// Text field width (for scroll calculations; 0 = use widget width)
|
||||||
int32_t (*getTextFieldWidth)(const struct WidgetT *w);
|
int32_t (*getTextFieldWidth)(const struct WidgetT *w);
|
||||||
|
|
||||||
|
// Scroll a child widget into the visible area (ScrollPane, etc.)
|
||||||
|
void (*scrollChildIntoView)(struct WidgetT *parent, const struct WidgetT *child);
|
||||||
|
|
||||||
// Scrollbar drag update (orient: 0=vert, 1=horiz)
|
// Scrollbar drag update (orient: 0=vert, 1=horiz)
|
||||||
void (*scrollDragUpdate)(struct WidgetT *w, int32_t orient, int32_t dragOff, int32_t mouseX, int32_t mouseY);
|
void (*scrollDragUpdate)(struct WidgetT *w, int32_t orient, int32_t dragOff, int32_t mouseX, int32_t mouseY);
|
||||||
} WidgetClassT;
|
} WidgetClassT;
|
||||||
|
|
|
||||||
|
|
@ -1884,9 +1884,6 @@ int32_t platformVideoInit(DisplayT *d, int32_t requestedW, int32_t requestedH, i
|
||||||
d->clipW = d->width;
|
d->clipW = d->width;
|
||||||
d->clipH = d->height;
|
d->clipH = d->height;
|
||||||
|
|
||||||
fprintf(stderr, "VBE: Mode 0x%04X set: %ldx%ldx%ld, pitch=%ld\n",
|
|
||||||
bestMode, (long)d->width, (long)d->height, (long)d->format.bitsPerPixel, (long)d->pitch);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,11 @@ $(WPAPERDIR)/%.jpg: ../config/wpaper/%.jpg | $(WPAPERDIR)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
$(OBJDIR)/shellMain.o: shellMain.c shellApp.h
|
SHELL_DEPS = shellApp.h ../core/dvxWidget.h ../core/dvxApp.h ../core/dvxTypes.h ../core/platform/dvxPlatform.h
|
||||||
$(OBJDIR)/shellApp.o: shellApp.c shellApp.h
|
$(OBJDIR)/shellMain.o: shellMain.c $(SHELL_DEPS)
|
||||||
$(OBJDIR)/shellInfo.o: shellInfo.c shellInfo.h shellApp.h
|
$(OBJDIR)/shellApp.o: shellApp.c $(SHELL_DEPS)
|
||||||
$(OBJDIR)/shellTaskMgr.o: shellTaskMgr.c shellTaskMgr.h shellApp.h
|
$(OBJDIR)/shellInfo.o: shellInfo.c shellInfo.h $(SHELL_DEPS)
|
||||||
|
$(OBJDIR)/shellTaskMgr.o: shellTaskMgr.c shellTaskMgr.h $(SHELL_DEPS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(TARGET) $(LIBSDIR)/dvxshell.dep
|
rm -f $(OBJS) $(TARGET) $(LIBSDIR)/dvxshell.dep
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ static void drawSPVScrollbar(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const
|
||||||
static void spCalcNeeds(WidgetT *w, const BitmapFontT *font, int32_t *contentMinW, int32_t *contentMinH, int32_t *innerW, int32_t *innerH, bool *needVSb, bool *needHSb);
|
static void spCalcNeeds(WidgetT *w, const BitmapFontT *font, int32_t *contentMinW, int32_t *contentMinH, int32_t *innerW, int32_t *innerH, bool *needVSb, bool *needHSb);
|
||||||
static void widgetScrollPaneDestroy(WidgetT *w);
|
static void widgetScrollPaneDestroy(WidgetT *w);
|
||||||
static void widgetScrollPaneScrollDragUpdate(WidgetT *w, int32_t orient, int32_t dragOff, int32_t mouseX, int32_t mouseY);
|
static void widgetScrollPaneScrollDragUpdate(WidgetT *w, int32_t orient, int32_t dragOff, int32_t mouseX, int32_t mouseY);
|
||||||
|
void wgtScrollPaneScrollToChild(WidgetT *w, const WidgetT *child);
|
||||||
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -780,6 +781,7 @@ static const WidgetClassT sClassScrollPane = {
|
||||||
.destroy = widgetScrollPaneDestroy,
|
.destroy = widgetScrollPaneDestroy,
|
||||||
.getText = NULL,
|
.getText = NULL,
|
||||||
.setText = NULL,
|
.setText = NULL,
|
||||||
|
.scrollChildIntoView = wgtScrollPaneScrollToChild,
|
||||||
.scrollDragUpdate = widgetScrollPaneScrollDragUpdate
|
.scrollDragUpdate = widgetScrollPaneScrollDragUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -806,6 +808,39 @@ WidgetT *wgtScrollPane(WidgetT *parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wgtScrollPaneScrollToChild(WidgetT *w, const WidgetT *child) {
|
||||||
|
VALIDATE_WIDGET_VOID(w, sTypeId);
|
||||||
|
ScrollPaneDataT *sp = (ScrollPaneDataT *)w->data;
|
||||||
|
AppContextT *ctx = wgtGetContext(w);
|
||||||
|
const BitmapFontT *font = &ctx->font;
|
||||||
|
|
||||||
|
int32_t contentMinW;
|
||||||
|
int32_t contentMinH;
|
||||||
|
int32_t innerW;
|
||||||
|
int32_t innerH;
|
||||||
|
bool needVSb;
|
||||||
|
bool needHSb;
|
||||||
|
|
||||||
|
spCalcNeeds(w, font, &contentMinW, &contentMinH, &innerW, &innerH, &needVSb, &needHSb);
|
||||||
|
|
||||||
|
// Child's virtual offset within the scrollable content
|
||||||
|
int32_t childOffY = child->y - w->y - SP_BORDER + sp->scrollPosV;
|
||||||
|
int32_t maxScrollV = contentMinH - innerH;
|
||||||
|
|
||||||
|
if (maxScrollV < 0) {
|
||||||
|
maxScrollV = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (childOffY < sp->scrollPosV) {
|
||||||
|
sp->scrollPosV = childOffY;
|
||||||
|
} else if (childOffY + child->h > sp->scrollPosV + innerH) {
|
||||||
|
sp->scrollPosV = childOffY + child->h - innerH;
|
||||||
|
}
|
||||||
|
|
||||||
|
sp->scrollPosV = clampInt(sp->scrollPosV, 0, maxScrollV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// DXE registration
|
// DXE registration
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
@ -813,8 +848,10 @@ WidgetT *wgtScrollPane(WidgetT *parent) {
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
WidgetT *(*create)(WidgetT *parent);
|
WidgetT *(*create)(WidgetT *parent);
|
||||||
|
void (*scrollToChild)(WidgetT *sp, const WidgetT *child);
|
||||||
} sApi = {
|
} sApi = {
|
||||||
.create = wgtScrollPane
|
.create = wgtScrollPane,
|
||||||
|
.scrollToChild = wgtScrollPaneScrollToChild
|
||||||
};
|
};
|
||||||
|
|
||||||
void wgtRegister(void) {
|
void wgtRegister(void) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WidgetT *(*create)(WidgetT *parent);
|
WidgetT *(*create)(WidgetT *parent);
|
||||||
|
void (*scrollToChild)(WidgetT *sp, const WidgetT *child);
|
||||||
} ScrollPaneApiT;
|
} ScrollPaneApiT;
|
||||||
|
|
||||||
static inline const ScrollPaneApiT *dvxScrollPaneApi(void) {
|
static inline const ScrollPaneApiT *dvxScrollPaneApi(void) {
|
||||||
|
|
@ -15,5 +16,6 @@ static inline const ScrollPaneApiT *dvxScrollPaneApi(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define wgtScrollPane(parent) dvxScrollPaneApi()->create(parent)
|
#define wgtScrollPane(parent) dvxScrollPaneApi()->create(parent)
|
||||||
|
#define wgtScrollPaneScrollToChild(sp, child) dvxScrollPaneApi()->scrollToChild((sp), (child))
|
||||||
|
|
||||||
#endif // WIDGET_SCROLLPANE_H
|
#endif // WIDGET_SCROLLPANE_H
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue