void Browser::lastPage() { unsigned long offset; if(this->page_size > this->file_size) offset = 0; else offset = this->file_size - this->page_size; this->loadBuffer(offset); // // Put the slider at the end. // int max; int value; int slider_size; int inc; int page_inc; XtVaGetValues(this->vsb, XmNmaximum, &max, NULL); XmScrollBarGetValues(this->vsb, &value, &slider_size, &inc, &page_inc); XmScrollBarSetValues(this->vsb, max-slider_size, slider_size, inc, page_inc, True); this->updateOffsets(0); }
void Browser::adjustScrollBar(Boolean top) { int min; int max; int value; int slider_size; int inc; int page_inc; // // The idea is to place the slide bar 1/2 a "slider_size" away from the end. // XtVaGetValues(this->vsb, XmNminimum, &min, XmNmaximum, &max, NULL); XmScrollBarGetValues(this->vsb, &value, &slider_size, &inc, &page_inc); if(top) { value = min + slider_size/2; if(this->page_start == 0) value = min; if(value > max - slider_size) value = max - slider_size; } else { value = max - slider_size/2 - slider_size; if(value > max - slider_size) value = max - slider_size; if(this->page_start == this->file_size - this->page_size) value = max - slider_size; if(value < min) value = min; } XmScrollBarSetValues(this->vsb, value, slider_size, inc, page_inc, True); }
static void _UI2DViewVerScrollBarValueChangedCBK(Widget widget, UI2DView *view, XmScrollBarCallbackStruct *callData) { int value, slider, incr, pgIncr; double deltaY, freeLength; DBRegion dataEXT = (UIDataset())->Extent(), viewEXT = view->Extent(); XmScrollBarGetValues(widget, &value, &slider, &incr, &pgIncr); freeLength = (dataEXT.UpperRight.Y - dataEXT.LowerLeft.Y) - (viewEXT.UpperRight.Y - viewEXT.LowerLeft.Y); deltaY = slider == 100 ? 0 : freeLength * value / (100.0 - slider); deltaY -= dataEXT.UpperRight.Y - viewEXT.UpperRight.Y; viewEXT.LowerLeft.Y = viewEXT.LowerLeft.Y - deltaY; viewEXT.UpperRight.Y = viewEXT.UpperRight.Y - deltaY; view->Set(viewEXT); }