void GlyphViewer::grab_scroll () { Window* w = canvas()->window(); WidgetKit* kit = WidgetKit::instance(); Coord dx = _lx - _x; Coord dy = _ly - _y; if (dx != 0.0 || dy != 0.0) { Coord l, b, r, t; w->cursor(kit->hand_cursor()); _root->getbounds(l, b, r, t); canvas()->damage(l, b, r, t); _root->translate(dx, dy); _root->getbounds(l, b, r, t); canvas()->damage(l, b, r, t); _x += dx; _y += dy; } }
void FieldStringEditor::do_grab_scroll(Event& e) { Window* w = canvas->window(); Cursor* c = w->cursor(); w->cursor(kit_->hand_cursor()); int origin = display->Left(0, 0); int width = display->Width(); Poll(e); int x = e.x; do { origin += e.x - x; origin = Math::min( 0, Math::max(Math::min(0, xmax - width), origin) ); display->Scroll(0, origin, ymax); x = e.x; Poll(e); } while (e.middlemouse); w->cursor(c); }