001/*
002 * Copyright 2014 Cristian Rinaldi & Andres Testi.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package gwt.material.design.jquery.client.api;
017
018/*
019 * #%L
020 * GwtMaterial
021 * %%
022 * Copyright (C) 2015 - 2017 GwtMaterialDesign
023 * %%
024 * Licensed under the Apache License, Version 2.0 (the "License");
025 * you may not use this file except in compliance with the License.
026 * You may obtain a copy of the License at
027 * 
028 *      http://www.apache.org/licenses/LICENSE-2.0
029 * 
030 * Unless required by applicable law or agreed to in writing, software
031 * distributed under the License is distributed on an "AS IS" BASIS,
032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033 * See the License for the specific language governing permissions and
034 * limitations under the License.
035 * #L%
036 */
037
038
039import jsinterop.annotations.JsFunction;
040
041/**
042 * Represent a Function in JS Environment.
043 *
044 * @author Ben Dol
045 */
046public interface Functions {
047
048    // No Return Type
049
050    @FunctionalInterface
051    @JsFunction
052    interface Func {
053        void call();
054    }
055
056    @FunctionalInterface
057    @JsFunction
058    interface Func1<A> {
059        void call(A param1);
060    }
061
062    @FunctionalInterface
063    @JsFunction
064    interface Func2<A, B> {
065        void call(A param1, B param2);
066    }
067
068    @FunctionalInterface
069    @JsFunction
070    interface Func3<A, B, C> {
071        void call(A param1, B param2, C param3);
072    }
073
074    // With Object Return Type
075
076    @FunctionalInterface
077    @JsFunction
078    interface FuncRet {
079        Object call();
080    }
081
082    @FunctionalInterface
083    @JsFunction
084    interface FuncRet1<A> {
085        Object call(A param1);
086    }
087
088    @FunctionalInterface
089    @JsFunction
090    interface FuncRet2<A, B> {
091        Object call(A param1, B param2);
092    }
093
094    @FunctionalInterface
095    @JsFunction
096    interface FuncRet3<A, B, C> {
097        Object call(A param1, B param2, C param3);
098    }
099
100    // Event Functions
101
102    @FunctionalInterface
103    @JsFunction
104    interface EventFunc {
105        Object call(Event e);
106    }
107
108    @FunctionalInterface
109    @JsFunction
110    interface EventFunc1<A> {
111        Object call(Event e, A param1);
112    }
113
114    @FunctionalInterface
115    @JsFunction
116    interface EventFunc2<A, B> {
117        Object call(Event e, A param1, B param2);
118    }
119
120    @FunctionalInterface
121    @JsFunction
122    interface EventFunc3<A, B, C> {
123        Object call(Event e, A param1, B param2, C param3);
124    }
125
126    @FunctionalInterface
127    @JsFunction
128    interface KeyEventFunc {
129        Object call(KeyEvent e);
130    }
131
132    @FunctionalInterface
133    @JsFunction
134    interface MouseEventFunc {
135        Object call(MouseEvent e);
136    }
137}