2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 %define TEXTFIELD_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
27 %define TEXTFIELD_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
30 public class TextChangedEventArgs : EventArgs
32 private TextField _textField;
34 public TextField TextField
47 public class MaxLengthReachedEventArgs : EventArgs
49 private TextField _textField;
51 public TextField TextField
65 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
66 private delegate void TextChangedCallbackDelegate(IntPtr textField);
67 private DaliEventHandler<object,TextChangedEventArgs> _textFieldTextChangedEventHandler;
68 private TextChangedCallbackDelegate _textFieldTextChangedCallbackDelegate;
70 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
71 private delegate void MaxLengthReachedCallbackDelegate(IntPtr textField);
72 private DaliEventHandler<object,MaxLengthReachedEventArgs> _textFieldMaxLengthReachedEventHandler;
73 private MaxLengthReachedCallbackDelegate _textFieldMaxLengthReachedCallbackDelegate;
75 public event DaliEventHandler<object,TextChangedEventArgs> TextChanged
81 // Restricted to only one listener
82 if (_textFieldTextChangedEventHandler == null)
84 _textFieldTextChangedEventHandler += value;
86 _textFieldTextChangedCallbackDelegate = new TextChangedCallbackDelegate(OnTextChanged);
87 this.TextChangedSignal().Connect(_textFieldTextChangedCallbackDelegate);
96 if (_textFieldTextChangedEventHandler != null)
98 this.TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
101 _textFieldTextChangedEventHandler -= value;
106 private void OnTextChanged(IntPtr textField)
108 TextChangedEventArgs e = new TextChangedEventArgs();
110 // Populate all members of "e" (TextChangedEventArgs) with real data
111 e.TextField = Dali.TextField.GetTextFieldFromPtr(textField);
113 if (_textFieldTextChangedEventHandler != null)
115 //here we send all data to user event handlers
116 _textFieldTextChangedEventHandler(this, e);
121 public event DaliEventHandler<object,MaxLengthReachedEventArgs> MaxLengthReached
127 // Restricted to only one listener
128 if (_textFieldMaxLengthReachedEventHandler == null)
130 _textFieldMaxLengthReachedEventHandler += value;
132 _textFieldMaxLengthReachedCallbackDelegate = new MaxLengthReachedCallbackDelegate(OnMaxLengthReached);
133 this.MaxLengthReachedSignal().Connect(_textFieldMaxLengthReachedCallbackDelegate);
142 if (_textFieldMaxLengthReachedEventHandler != null)
144 this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
147 _textFieldMaxLengthReachedEventHandler -= value;
152 private void OnMaxLengthReached(IntPtr textField)
154 MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs();
156 // Populate all members of "e" (MaxLengthReachedEventArgs) with real data
157 e.TextField = Dali.TextField.GetTextFieldFromPtr(textField);
159 if (_textFieldMaxLengthReachedEventHandler != null)
161 //here we send all data to user event handlers
162 _textFieldMaxLengthReachedEventHandler(this, e);
167 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
168 ClassName ret = new ClassName(cPtr, false);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 /* Properties earlier added by Ruby Script */
175 public int RenderingBackend
180 GetProperty( TextField.Property.RENDERING_BACKEND).Get( ref temp );
185 SetProperty( TextField.Property.RENDERING_BACKEND, new Dali.Property.Value( value ) );
193 GetProperty( TextField.Property.TEXT).Get( out temp );
198 SetProperty( TextField.Property.TEXT, new Dali.Property.Value( value ) );
201 public string PlaceholderText
206 GetProperty( TextField.Property.PLACEHOLDER_TEXT).Get( out temp );
211 SetProperty( TextField.Property.PLACEHOLDER_TEXT, new Dali.Property.Value( value ) );
214 public string PlaceholderTextFocused
219 GetProperty( TextField.Property.PLACEHOLDER_TEXT_FOCUSED).Get( out temp );
224 SetProperty( TextField.Property.PLACEHOLDER_TEXT_FOCUSED, new Dali.Property.Value( value ) );
227 public string FontFamily
232 GetProperty( TextField.Property.FONT_FAMILY).Get( out temp );
237 SetProperty( TextField.Property.FONT_FAMILY, new Dali.Property.Value( value ) );
240 public Dali.Property.Map FontStyle
244 Dali.Property.Map temp = new Dali.Property.Map();
245 GetProperty( TextField.Property.FONT_STYLE).Get( temp );
250 SetProperty( TextField.Property.FONT_STYLE, new Dali.Property.Value( value ) );
253 public float PointSize
258 GetProperty( TextField.Property.POINT_SIZE).Get( ref temp );
263 SetProperty( TextField.Property.POINT_SIZE, new Dali.Property.Value( value ) );
271 GetProperty( TextField.Property.MAX_LENGTH).Get( ref temp );
276 SetProperty( TextField.Property.MAX_LENGTH, new Dali.Property.Value( value ) );
279 public int ExceedPolicy
284 GetProperty( TextField.Property.EXCEED_POLICY).Get( ref temp );
289 SetProperty( TextField.Property.EXCEED_POLICY, new Dali.Property.Value( value ) );
292 public string HorizontalAlignment
297 GetProperty( TextField.Property.HORIZONTAL_ALIGNMENT).Get( out temp );
302 SetProperty( TextField.Property.HORIZONTAL_ALIGNMENT, new Dali.Property.Value( value ) );
305 public string VerticalAlignment
310 GetProperty( TextField.Property.VERTICAL_ALIGNMENT).Get( out temp );
315 SetProperty( TextField.Property.VERTICAL_ALIGNMENT, new Dali.Property.Value( value ) );
318 public Dali.CSharp.Color TextColor
322 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
323 GetProperty( TextField.Property.TEXT_COLOR).Get( temp );
324 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
329 SetProperty( TextField.Property.TEXT_COLOR, new Dali.Property.Value( value ) );
332 public Dali.CSharp.Color PlaceholderTextColor
336 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
337 GetProperty( TextField.Property.PLACEHOLDER_TEXT_COLOR).Get( temp );
338 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
343 SetProperty( TextField.Property.PLACEHOLDER_TEXT_COLOR, new Dali.Property.Value( value ) );
346 public Dali.CSharp.Size ShadowOffset
350 Vector2 temp = new Vector2(0.0f,0.0f);
351 GetProperty( TextField.Property.SHADOW_OFFSET).Get( temp );
352 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
357 SetProperty( TextField.Property.SHADOW_OFFSET, new Dali.Property.Value( value ) );
360 public Dali.CSharp.Color ShadowColor
364 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
365 GetProperty( TextField.Property.SHADOW_COLOR).Get( temp );
366 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
371 SetProperty( TextField.Property.SHADOW_COLOR, new Dali.Property.Value( value ) );
374 public Dali.CSharp.Color PrimaryCursorColor
378 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
379 GetProperty( TextField.Property.PRIMARY_CURSOR_COLOR).Get( temp );
380 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
385 SetProperty( TextField.Property.PRIMARY_CURSOR_COLOR, new Dali.Property.Value( value ) );
388 public Dali.CSharp.Color SecondaryCursorColor
392 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
393 GetProperty( TextField.Property.SECONDARY_CURSOR_COLOR).Get( temp );
394 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
399 SetProperty( TextField.Property.SECONDARY_CURSOR_COLOR, new Dali.Property.Value( value ) );
402 public bool EnableCursorBlink
407 GetProperty( TextField.Property.ENABLE_CURSOR_BLINK).Get( ref temp );
412 SetProperty( TextField.Property.ENABLE_CURSOR_BLINK, new Dali.Property.Value( value ) );
415 public float CursorBlinkInterval
420 GetProperty( TextField.Property.CURSOR_BLINK_INTERVAL).Get( ref temp );
425 SetProperty( TextField.Property.CURSOR_BLINK_INTERVAL, new Dali.Property.Value( value ) );
428 public float CursorBlinkDuration
433 GetProperty( TextField.Property.CURSOR_BLINK_DURATION).Get( ref temp );
438 SetProperty( TextField.Property.CURSOR_BLINK_DURATION, new Dali.Property.Value( value ) );
441 public int CursorWidth
446 GetProperty( TextField.Property.CURSOR_WIDTH).Get( ref temp );
451 SetProperty( TextField.Property.CURSOR_WIDTH, new Dali.Property.Value( value ) );
454 public string GrabHandleImage
459 GetProperty( TextField.Property.GRAB_HANDLE_IMAGE).Get( out temp );
464 SetProperty( TextField.Property.GRAB_HANDLE_IMAGE, new Dali.Property.Value( value ) );
467 public string GrabHandlePressedImage
472 GetProperty( TextField.Property.GRAB_HANDLE_PRESSED_IMAGE).Get( out temp );
477 SetProperty( TextField.Property.GRAB_HANDLE_PRESSED_IMAGE, new Dali.Property.Value( value ) );
480 public float ScrollThreshold
485 GetProperty( TextField.Property.SCROLL_THRESHOLD).Get( ref temp );
490 SetProperty( TextField.Property.SCROLL_THRESHOLD, new Dali.Property.Value( value ) );
493 public float ScrollSpeed
498 GetProperty( TextField.Property.SCROLL_SPEED).Get( ref temp );
503 SetProperty( TextField.Property.SCROLL_SPEED, new Dali.Property.Value( value ) );
506 public Dali.Property.Map SelectionHandleImageLeft
510 Dali.Property.Map temp = new Dali.Property.Map();
511 GetProperty( TextField.Property.SELECTION_HANDLE_IMAGE_LEFT).Get( temp );
516 SetProperty( TextField.Property.SELECTION_HANDLE_IMAGE_LEFT, new Dali.Property.Value( value ) );
519 public Dali.Property.Map SelectionHandleImageRight
523 Dali.Property.Map temp = new Dali.Property.Map();
524 GetProperty( TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT).Get( temp );
529 SetProperty( TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT, new Dali.Property.Value( value ) );
532 public Dali.Property.Map SelectionHandlePressedImageLeft
536 Dali.Property.Map temp = new Dali.Property.Map();
537 GetProperty( TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT).Get( temp );
542 SetProperty( TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT, new Dali.Property.Value( value ) );
545 public Dali.Property.Map SelectionHandlePressedImageRight
549 Dali.Property.Map temp = new Dali.Property.Map();
550 GetProperty( TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT).Get( temp );
555 SetProperty( TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, new Dali.Property.Value( value ) );
558 public Dali.Property.Map SelectionHandleMarkerImageLeft
562 Dali.Property.Map temp = new Dali.Property.Map();
563 GetProperty( TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT).Get( temp );
568 SetProperty( TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT, new Dali.Property.Value( value ) );
571 public Dali.Property.Map SelectionHandleMarkerImageRight
575 Dali.Property.Map temp = new Dali.Property.Map();
576 GetProperty( TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT).Get( temp );
581 SetProperty( TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT, new Dali.Property.Value( value ) );
584 public Dali.CSharp.Color SelectionHighlightColor
588 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
589 GetProperty( TextField.Property.SELECTION_HIGHLIGHT_COLOR).Get( temp );
590 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
595 SetProperty( TextField.Property.SELECTION_HIGHLIGHT_COLOR, new Dali.Property.Value( value ) );
598 public RectInteger DecorationBoundingBox
602 RectInteger temp = new RectInteger(0,0,0,0);
603 GetProperty( TextField.Property.DECORATION_BOUNDING_BOX).Get( temp );
608 SetProperty( TextField.Property.DECORATION_BOUNDING_BOX, new Dali.Property.Value( value ) );
611 public Dali.Property.Map InputMethodSettings
615 Dali.Property.Map temp = new Dali.Property.Map();
616 GetProperty( TextField.Property.INPUT_METHOD_SETTINGS).Get( temp );
621 SetProperty( TextField.Property.INPUT_METHOD_SETTINGS, new Dali.Property.Value( value ) );
624 public Dali.CSharp.Color InputColor
628 Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
629 GetProperty( TextField.Property.INPUT_COLOR).Get( temp );
630 Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
635 SetProperty( TextField.Property.INPUT_COLOR, new Dali.Property.Value( value ) );
638 public bool EnableMarkup
643 GetProperty( TextField.Property.ENABLE_MARKUP).Get( ref temp );
648 SetProperty( TextField.Property.ENABLE_MARKUP, new Dali.Property.Value( value ) );
651 public string InputFontFamily
656 GetProperty( TextField.Property.INPUT_FONT_FAMILY).Get( out temp );
661 SetProperty( TextField.Property.INPUT_FONT_FAMILY, new Dali.Property.Value( value ) );
664 public Dali.Property.Map InputFontStyle
668 Dali.Property.Map temp = new Dali.Property.Map();
669 GetProperty( TextField.Property.INPUT_FONT_STYLE).Get( temp );
674 SetProperty( TextField.Property.INPUT_FONT_STYLE, new Dali.Property.Value( value ) );
677 public float InputPointSize
682 GetProperty( TextField.Property.INPUT_POINT_SIZE).Get( ref temp );
687 SetProperty( TextField.Property.INPUT_POINT_SIZE, new Dali.Property.Value( value ) );
690 public Dali.Property.Map Underline
694 Dali.Property.Map temp = new Dali.Property.Map();
695 GetProperty( TextField.Property.UNDERLINE).Get( temp );
700 SetProperty( TextField.Property.UNDERLINE, new Dali.Property.Value( value ) );
703 public Dali.Property.Map InputUnderline
707 Dali.Property.Map temp = new Dali.Property.Map();
708 GetProperty( TextField.Property.INPUT_UNDERLINE).Get( temp );
713 SetProperty( TextField.Property.INPUT_UNDERLINE, new Dali.Property.Value( value ) );
716 public Dali.Property.Map Shadow
720 Dali.Property.Map temp = new Dali.Property.Map();
721 GetProperty( TextField.Property.SHADOW).Get( temp );
726 SetProperty( TextField.Property.SHADOW, new Dali.Property.Value( value ) );
729 public Dali.Property.Map InputShadow
733 Dali.Property.Map temp = new Dali.Property.Map();
734 GetProperty( TextField.Property.INPUT_SHADOW).Get( temp );
739 SetProperty( TextField.Property.INPUT_SHADOW, new Dali.Property.Value( value ) );
742 public Dali.Property.Map Emboss
746 Dali.Property.Map temp = new Dali.Property.Map();
747 GetProperty( TextField.Property.EMBOSS).Get( temp );
752 SetProperty( TextField.Property.EMBOSS, new Dali.Property.Value( value ) );
755 public Dali.Property.Map InputEmboss
759 Dali.Property.Map temp = new Dali.Property.Map();
760 GetProperty( TextField.Property.INPUT_EMBOSS).Get( temp );
765 SetProperty( TextField.Property.INPUT_EMBOSS, new Dali.Property.Value( value ) );
768 public Dali.Property.Map Outline
772 Dali.Property.Map temp = new Dali.Property.Map();
773 GetProperty( TextField.Property.OUTLINE).Get( temp );
778 SetProperty( TextField.Property.OUTLINE, new Dali.Property.Value( value ) );
781 public Dali.Property.Map InputOutline
785 Dali.Property.Map temp = new Dali.Property.Map();
786 GetProperty( TextField.Property.INPUT_OUTLINE).Get( temp );
791 SetProperty( TextField.Property.INPUT_OUTLINE, new Dali.Property.Value( value ) );
795 /* Properties ends */
801 %define DALI_TEXTFIELD_EVENTHANDLER_PARAM( NameSpace, ClassName)
803 TEXTFIELD_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
804 TEXTFIELD_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
810 DALI_TEXTFIELD_EVENTHANDLER_PARAM( Dali::Toolkit, TextField);