ContainerMouseAdapter.java
01 /*
02  * Copyright 2008-2016 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package griffon.pivot.support.adapters;
17 
18 import griffon.core.CallableWithArgs;
19 
20 /**
21  @author Andres Almiray
22  @since 2.0.0
23  */
24 public class ContainerMouseAdapter implements GriffonPivotAdapter, org.apache.pivot.wtk.ContainerMouseListener {
25     private CallableWithArgs<Boolean> mouseWheel;
26     private CallableWithArgs<Boolean> mouseDown;
27     private CallableWithArgs<Boolean> mouseUp;
28     private CallableWithArgs<Boolean> mouseMove;
29 
30     public CallableWithArgs<Boolean> getMouseWheel() {
31         return this.mouseWheel;
32     }
33 
34     public CallableWithArgs<Boolean> getMouseDown() {
35         return this.mouseDown;
36     }
37 
38     public CallableWithArgs<Boolean> getMouseUp() {
39         return this.mouseUp;
40     }
41 
42     public CallableWithArgs<Boolean> getMouseMove() {
43         return this.mouseMove;
44     }
45 
46 
47     public void setMouseWheel(CallableWithArgs<Boolean> mouseWheel) {
48         this.mouseWheel = mouseWheel;
49     }
50 
51     public void setMouseDown(CallableWithArgs<Boolean> mouseDown) {
52         this.mouseDown = mouseDown;
53     }
54 
55     public void setMouseUp(CallableWithArgs<Boolean> mouseUp) {
56         this.mouseUp = mouseUp;
57     }
58 
59     public void setMouseMove(CallableWithArgs<Boolean> mouseMove) {
60         this.mouseMove = mouseMove;
61     }
62 
63 
64     public boolean mouseWheel(org.apache.pivot.wtk.Container arg0, org.apache.pivot.wtk.Mouse.ScrollType arg1, int arg2, int arg3, int arg4, int arg5) {
65         return mouseWheel != null && mouseWheel.call(arg0, arg1, arg2, arg3, arg4, arg5);
66     }
67 
68     public boolean mouseDown(org.apache.pivot.wtk.Container arg0, org.apache.pivot.wtk.Mouse.Button arg1, int arg2, int arg3) {
69         return mouseDown != null && mouseDown.call(arg0, arg1, arg2, arg3);
70     }
71 
72     public boolean mouseUp(org.apache.pivot.wtk.Container arg0, org.apache.pivot.wtk.Mouse.Button arg1, int arg2, int arg3) {
73         return mouseUp != null && mouseUp.call(arg0, arg1, arg2, arg3);
74     }
75 
76     public boolean mouseMove(org.apache.pivot.wtk.Container arg0, int arg1, int arg2) {
77         return mouseMove != null && mouseMove.call(arg0, arg1, arg2);
78     }
79 
80 }