Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Navigation/MouseNavigationBase.cs @ 12747

Last change on this file since 12747 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Input;
6using System.Windows;
7
8namespace Microsoft.Research.DynamicDataDisplay.Navigation
9{
10  // todo проверить, как происходит работа когда мышь не над плоттером, а над его ребенком
11  // todo если все ОК, то перевести все маус навигейшн контролы на этот класс как базовый
12  public abstract class MouseNavigationBase : NavigationBase
13  {
14    protected override void OnPlotterAttached(Plotter plotter)
15    {
16      base.OnPlotterAttached(plotter);
17
18      Mouse.AddMouseDownHandler(Parent, OnMouseDown);
19      Mouse.AddMouseMoveHandler(Parent, OnMouseMove);
20      Mouse.AddMouseUpHandler(Parent, OnMouseUp);
21      Mouse.AddMouseWheelHandler(Parent, OnMouseWheel);
22    }
23
24    protected override void OnPlotterDetaching(Plotter plotter)
25    {
26      Mouse.RemoveMouseDownHandler(Parent, OnMouseDown);
27      Mouse.RemoveMouseMoveHandler(Parent, OnMouseMove);
28      Mouse.RemoveMouseUpHandler(Parent, OnMouseUp);
29      Mouse.RemoveMouseWheelHandler(Parent, OnMouseWheel);
30
31      base.OnPlotterDetaching(plotter);
32    }
33
34    private void OnMouseWheel(object sender, MouseWheelEventArgs e)
35    {
36      OnPlotterMouseWheel(e);
37    }
38
39    protected virtual void OnPlotterMouseWheel(MouseWheelEventArgs e) { }
40
41    private void OnMouseUp(object sender, MouseButtonEventArgs e)
42    {
43      OnPlotterMouseUp(e);
44    }
45
46    protected virtual void OnPlotterMouseUp(MouseButtonEventArgs e) { }
47
48    private void OnMouseDown(object sender, MouseButtonEventArgs e)
49    {
50      OnPlotterMouseDown(e);
51    }
52
53    protected virtual void OnPlotterMouseDown(MouseButtonEventArgs e) { }
54
55    private void OnMouseMove(object sender, MouseEventArgs e)
56    {
57      OnPlotterMouseMove(e);
58    }
59
60    protected virtual void OnPlotterMouseMove(MouseEventArgs e) { }
61
62  }
63}
Note: See TracBrowser for help on using the repository browser.