Coherent UI for Unreal Engine 4  2.5.5.0
A modern user interface library for games
 All Classes Functions Variables Pages
CoherentUIInputActor.h
1 /*
2 This file is part of Coherent UI, modern user interface library for
3 games.
4 
5 Copyright (c) 2012-2014 Coherent Labs AD and/or its licensors. All
6 rights reserved in all media.
7 
8 The coded instructions, statements, computer programs, and/or related
9 material (collectively the "Data") in these files contain confidential
10 and unpublished information proprietary Coherent Labs and/or its
11 licensors, which is protected by United States of America federal
12 copyright law and by international treaties.
13 
14 This software or source code is supplied under the terms of a license
15 agreement and nondisclosure agreement with Coherent Labs Limited and may
16 not be copied, disclosed, or exploited except in accordance with the
17 terms of that agreement. The Data may not be disclosed or distributed to
18 third parties, in whole or in part, without the prior written consent of
19 Coherent Labs Limited.
20 
21 COHERENT LABS MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS
22 SOURCE CODE FOR ANY PURPOSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23 HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER, ITS AFFILIATES,
27 PARENT COMPANIES, LICENSORS, SUPPLIERS, OR CONTRIBUTORS BE LIABLE FOR
28 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 ANY WAY OUT OF THE USE OR PERFORMANCE OF THIS SOFTWARE OR SOURCE CODE,
34 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 #pragma once
37 
38 #include "SCoherentInputForward.h"
39 
40 UENUM(BlueprintType)
41 namespace ECoherentUIKeys
42 {
43 enum Type
44 {
45  // Using macro's in UENUMs doesn't seem to work so we need to duplicate the key declaration.
46  // These are copied from the EKeys structure in InputCoreTypes.h
47  LeftMouseButton,
48  RightMouseButton,
49  MiddleMouseButton,
50  ThumbMouseButton,
51  ThumbMouseButton2,
52 
53  BackSpace,
54  Tab,
55  Enter,
56  Pause,
57 
58  CapsLock,
59  Escape,
60  SpaceBar,
61  PageUp,
62  PageDown,
63  End,
64  Home,
65 
66  Left,
67  Up,
68  Right,
69  Down,
70 
71  Insert,
72  Delete,
73 
74  Zero,
75  One,
76  Two,
77  Three,
78  Four,
79  Five,
80  Six,
81  Seven,
82  Eight,
83  Nine,
84 
85  A,
86  B,
87  C,
88  D,
89  E,
90  F,
91  G,
92  H,
93  I,
94  J,
95  K,
96  L,
97  M,
98  N,
99  O,
100  P,
101  Q,
102  R,
103  S,
104  T,
105  U,
106  V,
107  W,
108  X,
109  Y,
110  Z,
111 
112  NumPadZero,
113  NumPadOne,
114  NumPadTwo,
115  NumPadThree,
116  NumPadFour,
117  NumPadFive,
118  NumPadSix,
119  NumPadSeven,
120  NumPadEight,
121  NumPadNine,
122 
123  Multiply,
124  Add,
125  Subtract,
126  Decimal,
127  Divide,
128 
129  F1,
130  F2,
131  F3,
132  F4,
133  F5,
134  F6,
135  F7,
136  F8,
137  F9,
138  F10,
139  F11,
140  F12,
141 
142  NumLock,
143 
144  ScrollLock,
145 
146  LeftShift,
147  RightShift,
148  LeftControl,
149  RightControl,
150  LeftAlt,
151  RightAlt,
152  LeftCommand,
153  RightCommand,
154 
155  Semicolon,
156  Equals,
157  Comma,
158  Underscore,
159  Period,
160  Slash,
161  Tilde,
162  LeftBracket,
163  Backslash,
164  RightBracket,
165  Quote,
166 
167  Unknown UMETA(DisplayName="Unknown"),
168 };
169 }
170 
171 UENUM(BlueprintType)
172 namespace ECoherentUIInputPropagationBehaviour
173 {
174 enum Type
175 {
176  None,
177  Keyboard,
178  Joystick,
179  KeyboardAndJoystick
180 };
181 }
182 
183 #include "CoherentUIInputActor.generated.h"
184 
185 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCoherentInputActorMouseButtonDown, ECoherentUIKeys::Type, Button);
186 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCoherentInputActorMouseButtonUp, ECoherentUIKeys::Type, Button);
187 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCoherentInputActorKeyDown, ECoherentUIKeys::Type, Key);
188 DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCoherentInputActorKeyUp, ECoherentUIKeys::Type, Key);
189 
190 UCLASS(BlueprintType)
191 class COHERENTUIPLUGIN_API ACoherentUIInputActor : public AActor
192 {
193  GENERATED_UCLASS_BODY()
194 
195 public:
196  UFUNCTION(BlueprintCallable, Category = CoherentUI)
197  void Initialize(ECollisionChannel CollisionChannel = ECC_WorldDynamic, TextureAddress AddressMode = TA_Wrap, EInputWidgetRaycastQuality RaycastQuality = RQ_Accurate, int32 UVChannel = 0);
198 
199  UFUNCTION(BlueprintCallable, Category = CoherentUI)
200  void SetCoherentUIInputFocus(bool FocusUI);
201 
202  UFUNCTION(BlueprintCallable, Category = CoherentUI)
203  bool IsCoherentUIFocused() const;
204 
205  UFUNCTION(BlueprintCallable, Category = CoherentUI)
206  void ToggleCoherentUIInputFocus();
207 
208  UFUNCTION(BlueprintCallable, Category = CoherentUI)
209  void SetCoherentUIViewFocus(UCoherentBaseComponent* NewFocusedView);
210 
211  // AllowJoystickInputWhileUIIsFocused_DEPRECATED is deprecated. Use SetInputPropagationBehaviour instead.
212  UFUNCTION(BlueprintCallable, Category = CoherentUI)
213  void AllowJoystickInputWhileUIIsFocused_DEPRECATED(bool bAllow);
214 
215  // IsJoystickInputWhileUIIsFocusedAllowed is deprecated. Use GetInputPropagationBehaviour instead.
216  UFUNCTION(BlueprintCallable, Category = CoherentUI)
217  bool IsJoystickInputWhileUIIsFocusedAllowed_DEPRECATED() const;
218 
219  UFUNCTION(BlueprintCallable, Category = CoherentUI)
220  void AlwaysAcceptMouseInput(bool bForce);
221 
222  UFUNCTION(BlueprintCallable, Category = CoherentUI)
223  void SetInputPropagationBehaviour(ECoherentUIInputPropagationBehaviour::Type Propagation);
224 
225  UFUNCTION(BlueprintCallable, Category = CoherentUI)
226  ECoherentUIInputPropagationBehaviour::Type GetInputPropagationBehaviour() const;
227 
228  UFUNCTION(BlueprintCallable, Category = CoherentUI)
229  void SetLineTraceMode(EInputWidgetLineTraceMode Mode);
230 
231  UPROPERTY(BlueprintAssignable, Category = CoherentUI)
232  FCoherentInputActorMouseButtonDown OnCoherentInputActorMouseButtonDown;
233 
234  UPROPERTY(BlueprintAssignable, Category = CoherentUI)
235  FCoherentInputActorMouseButtonUp OnCoherentInputActorMouseButtonUp;
236 
237  UPROPERTY(BlueprintAssignable, Category = CoherentUI)
238  FCoherentInputActorKeyDown OnCoherentInputActorKeyDown;
239 
240  UPROPERTY(BlueprintAssignable, Category = CoherentUI)
241  FCoherentInputActorKeyUp OnCoherentInputActorKeyUp;
242 
243  TSharedPtr<class SCoherentInputForward> GetWidget();
244 
245 private:
246  void OnCoherentInputWidgetMouseButtonDown(const FKey& Button);
247  void OnCoherentInputWidgetMouseButtonUp(const FKey& Button);
248  void OnCoherentInputWidgetKeyDown(const FKey& Key);
249  void OnCoherentInputWidgetKeyUp(const FKey& Key);
250 
251 private:
252  TSharedPtr<class SCoherentInputForward> CoherentInputForwardWidget;
253  ECoherentUIInputPropagationBehaviour::Type InputPropagationBehaviour;
254 };
Definition: CoherentBaseComponent.h:76