bool GlueMapWindow::OnTimer(WindowTimer &timer) { if (timer == map_item_timer) { map_item_timer.Cancel(); if (!InputEvents::IsDefault() && !IsPanning()) { InputEvents::HideMenu(); return true; } ShowMapItems(drag_start_geopoint, false); return true; #ifdef ENABLE_OPENGL } else if (timer == kinetic_timer) { if (kinetic_x.IsSteady() && kinetic_y.IsSteady()) { kinetic_timer.Cancel(); } else { auto location = drag_projection.ScreenToGeo(kinetic_x.GetPosition(), kinetic_y.GetPosition()); location = drag_projection.GetGeoLocation() + drag_start_geopoint - location; visible_projection.SetGeoLocation(location); QuickRedraw(); } return true; #endif } else return MapWindow::OnTimer(timer); }
void FolderView::AfterWindowIsPlaced(const NervWindowPlacementEvent* in_event){ NervWindow::AfterWindowIsPlaced(in_event); if (in_event->flags&SWP_NOSIZE) return; mem_dc.Resize(size.x, size.y); scrollbar.Update(files.size()*line_height, size.y, size.x); if (scrollbar.NeedsRedraw()){ QuickRedraw(); } }
void FolderView::OnMouseMove(NervMouseEvent* in_event){ scrollbar.OnMouseMove(in_event->pt); if (scrollbar.ContainsMouse()){ if (scrollbar.NeedsRedraw()){ QuickRedraw(); } } else{ int item_index = ElementInPoint(in_event->pt.y); PerformCallback(NervEvent::MouseMoved, (void*)item_index); } }
bool GlueMapWindow::OnMouseMove(PixelScalar x, PixelScalar y, unsigned keys) { /* allow a bigger threshold on touch screens */ const unsigned threshold = Layout::Scale(IsEmbedded() ? 50 : 10); if (drag_mode != DRAG_NONE && arm_mapitem_list && (manhattan_distance(drag_start, RasterPoint{x, y}) > threshold || mouse_down_clock.Elapsed() > 200)) arm_mapitem_list = false; switch (drag_mode) { case DRAG_NONE: break; #ifdef HAVE_MULTI_TOUCH case DRAG_MULTI_TOUCH_PAN: #endif case DRAG_PAN: visible_projection.SetGeoLocation(drag_projection.GetGeoLocation() + drag_start_geopoint - drag_projection.ScreenToGeo(x, y)); QuickRedraw(); #ifdef ENABLE_OPENGL kinetic_x.MouseMove(x); kinetic_y.MouseMove(y); #endif return true; case DRAG_GESTURE: gestures.Update(x, y); /* invoke PaintWindow's Invalidate() implementation instead of DoubleBufferWindow's in order to reuse the buffered map */ PaintWindow::Invalidate(); return true; case DRAG_SIMULATOR: return true; } return MapWindow::OnMouseMove(x, y, keys); }
void FolderView::OnMouseScroll(NervMouseScrollEvent* in_event){ if (!scrollbar.IsActive()) return; scrollbar.SetScrollPosition(scrollbar.GetScrollPos() + in_event->delta*-0.0001f); QuickRedraw(); }
void FolderView::UpdateScrollbar(){ scrollbar.Update(files.size()*line_height, size.y, size.x); QuickRedraw(); }