DALi C# binding - Write pure C# Color & Position classes and use typemaps to do the...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / texteditor-event.i
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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  */
17
18 %define TEXTEDITOR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
20 using System;
21 using System.Runtime.InteropServices;
22
23 %}
24
25 %enddef
26
27 %define TEXTEDITOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
29
30 /**
31   * @brief Event arguments that passed via TextChanged signal
32   *
33   */
34 public class TextChangedEventArgs : EventArgs
35 {
36    private TextEditor _textEditor;
37    /**
38      * @brief TextEditor - is the texteditor control which has the text contents changed.
39      *
40      */
41    public TextEditor TextEditor
42    {
43       get
44       {
45          return _textEditor;
46       }
47       set
48       {
49          _textEditor = value;
50       }
51    }
52 }
53
54   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
55   private delegate void TextChangedCallbackDelegate(IntPtr textEditor);
56   private DaliEventHandler<object,TextChangedEventArgs> _textEditorTextChangedEventHandler;
57   private TextChangedCallbackDelegate _textEditorTextChangedCallbackDelegate;
58
59   /**
60     * @brief Event for TextChanged signal which can be used to subscribe/unsubscribe the event handler
61     * (in the type of TextChangedEventHandler-DaliEventHandler<object,TextChangedEventArgs>)
62     * provided by the user. TextChanged signal is emitted when the text changes.
63     */
64   public event DaliEventHandler<object,TextChangedEventArgs> TextChanged
65   {
66      add
67      {
68         lock(this)
69         {
70            // Restricted to only one listener
71            if (_textEditorTextChangedEventHandler == null)
72            {
73               _textEditorTextChangedEventHandler += value;
74
75               _textEditorTextChangedCallbackDelegate = new TextChangedCallbackDelegate(OnTextChanged);
76               this.TextChangedSignal().Connect(_textEditorTextChangedCallbackDelegate);
77            }
78         }
79      }
80
81      remove
82      {
83         lock(this)
84         {
85            if (_textEditorTextChangedEventHandler != null)
86            {
87               this.TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate);
88            }
89
90            _textEditorTextChangedEventHandler -= value;
91         }
92      }
93   }
94
95  private void OnTextChanged(IntPtr textEditor)
96   {
97    TextChangedEventArgs e = new TextChangedEventArgs();
98
99    // Populate all members of "e" (TextChangedEventArgs) with real data
100    e.TextEditor = Dali.TextEditor.GetTextEditorFromPtr(textEditor);
101
102    if (_textEditorTextChangedEventHandler != null)
103    {
104       //here we send all data to user event handlers
105       _textEditorTextChangedEventHandler(this, e);
106    }
107
108   }
109
110  public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
111     ClassName ret = new ClassName(cPtr, false);
112    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113     return ret;
114   }
115
116 /* Properties earlier added by Ruby Script */
117
118   public int RenderingBackend
119   {
120     get
121     {
122       int temp = 0;
123       GetProperty( TextEditor.Property.RENDERING_BACKEND).Get( ref temp );
124       return temp;
125     }
126     set
127     {
128       SetProperty( TextEditor.Property.RENDERING_BACKEND, new Dali.Property.Value( value ) );
129     }
130   }
131   public string Text
132   {
133     get
134     {
135       string temp;
136       GetProperty( TextEditor.Property.TEXT).Get( out temp );
137       return temp;
138     }
139     set
140     {
141       SetProperty( TextEditor.Property.TEXT, new Dali.Property.Value( value ) );
142     }
143   }
144   public Dali.CSharp.Color TextColor
145   {
146     get
147     {
148       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
149       GetProperty( TextEditor.Property.TEXT_COLOR).Get(  temp );
150       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
151       return ret;
152     }
153     set
154     {
155       SetProperty( TextEditor.Property.TEXT_COLOR, new Dali.Property.Value( value ) );
156     }
157   }
158   public string FontFamily
159   {
160     get
161     {
162       string temp;
163       GetProperty( TextEditor.Property.FONT_FAMILY).Get( out temp );
164       return temp;
165     }
166     set
167     {
168       SetProperty( TextEditor.Property.FONT_FAMILY, new Dali.Property.Value( value ) );
169     }
170   }
171   public Dali.Property.Map FontStyle
172   {
173     get
174     {
175       Dali.Property.Map temp = new Dali.Property.Map();
176       GetProperty( TextEditor.Property.FONT_STYLE).Get(  temp );
177       return temp;
178     }
179     set
180     {
181       SetProperty( TextEditor.Property.FONT_STYLE, new Dali.Property.Value( value ) );
182     }
183   }
184   public float PointSize
185   {
186     get
187     {
188       float temp = 0.0f;
189       GetProperty( TextEditor.Property.POINT_SIZE).Get( ref temp );
190       return temp;
191     }
192     set
193     {
194       SetProperty( TextEditor.Property.POINT_SIZE, new Dali.Property.Value( value ) );
195     }
196   }
197   public string HorizontalAlignment
198   {
199     get
200     {
201       string temp;
202       GetProperty( TextEditor.Property.HORIZONTAL_ALIGNMENT).Get( out temp );
203       return temp;
204     }
205     set
206     {
207       SetProperty( TextEditor.Property.HORIZONTAL_ALIGNMENT, new Dali.Property.Value( value ) );
208     }
209   }
210   public float ScrollThreshold
211   {
212     get
213     {
214       float temp = 0.0f;
215       GetProperty( TextEditor.Property.SCROLL_THRESHOLD).Get( ref temp );
216       return temp;
217     }
218     set
219     {
220       SetProperty( TextEditor.Property.SCROLL_THRESHOLD, new Dali.Property.Value( value ) );
221     }
222   }
223   public float ScrollSpeed
224   {
225     get
226     {
227       float temp = 0.0f;
228       GetProperty( TextEditor.Property.SCROLL_SPEED).Get( ref temp );
229       return temp;
230     }
231     set
232     {
233       SetProperty( TextEditor.Property.SCROLL_SPEED, new Dali.Property.Value( value ) );
234     }
235   }
236   public Dali.CSharp.Color PrimaryCursorColor
237   {
238     get
239     {
240       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
241       GetProperty( TextEditor.Property.PRIMARY_CURSOR_COLOR).Get(  temp );
242       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
243       return ret;
244     }
245     set
246     {
247       SetProperty( TextEditor.Property.PRIMARY_CURSOR_COLOR, new Dali.Property.Value( value ) );
248     }
249   }
250   public Dali.CSharp.Color SecondaryCursorColor
251   {
252     get
253     {
254       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
255       GetProperty( TextEditor.Property.SECONDARY_CURSOR_COLOR).Get(  temp );
256       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
257       return ret;
258     }
259     set
260     {
261       SetProperty( TextEditor.Property.SECONDARY_CURSOR_COLOR, new Dali.Property.Value( value ) );
262     }
263   }
264   public bool EnableCursorBlink
265   {
266     get
267     {
268       bool temp = false;
269       GetProperty( TextEditor.Property.ENABLE_CURSOR_BLINK).Get( ref temp );
270       return temp;
271     }
272     set
273     {
274       SetProperty( TextEditor.Property.ENABLE_CURSOR_BLINK, new Dali.Property.Value( value ) );
275     }
276   }
277   public float CursorBlinkInterval
278   {
279     get
280     {
281       float temp = 0.0f;
282       GetProperty( TextEditor.Property.CURSOR_BLINK_INTERVAL).Get( ref temp );
283       return temp;
284     }
285     set
286     {
287       SetProperty( TextEditor.Property.CURSOR_BLINK_INTERVAL, new Dali.Property.Value( value ) );
288     }
289   }
290   public float CursorBlinkDuration
291   {
292     get
293     {
294       float temp = 0.0f;
295       GetProperty( TextEditor.Property.CURSOR_BLINK_DURATION).Get( ref temp );
296       return temp;
297     }
298     set
299     {
300       SetProperty( TextEditor.Property.CURSOR_BLINK_DURATION, new Dali.Property.Value( value ) );
301     }
302   }
303   public int CursorWidth
304   {
305     get
306     {
307       int temp = 0;
308       GetProperty( TextEditor.Property.CURSOR_WIDTH).Get( ref temp );
309       return temp;
310     }
311     set
312     {
313       SetProperty( TextEditor.Property.CURSOR_WIDTH, new Dali.Property.Value( value ) );
314     }
315   }
316   public string GrabHandleImage
317   {
318     get
319     {
320       string temp;
321       GetProperty( TextEditor.Property.GRAB_HANDLE_IMAGE).Get( out temp );
322       return temp;
323     }
324     set
325     {
326       SetProperty( TextEditor.Property.GRAB_HANDLE_IMAGE, new Dali.Property.Value( value ) );
327     }
328   }
329   public string GrabHandlePressedImage
330   {
331     get
332     {
333       string temp;
334       GetProperty( TextEditor.Property.GRAB_HANDLE_PRESSED_IMAGE).Get( out temp );
335       return temp;
336     }
337     set
338     {
339       SetProperty( TextEditor.Property.GRAB_HANDLE_PRESSED_IMAGE, new Dali.Property.Value( value ) );
340     }
341   }
342   public Dali.Property.Map SelectionHandleImageLeft
343   {
344     get
345     {
346       Dali.Property.Map temp = new Dali.Property.Map();
347       GetProperty( TextEditor.Property.SELECTION_HANDLE_IMAGE_LEFT).Get(  temp );
348       return temp;
349     }
350     set
351     {
352       SetProperty( TextEditor.Property.SELECTION_HANDLE_IMAGE_LEFT, new Dali.Property.Value( value ) );
353     }
354   }
355   public Dali.Property.Map SelectionHandleImageRight
356   {
357     get
358     {
359       Dali.Property.Map temp = new Dali.Property.Map();
360       GetProperty( TextEditor.Property.SELECTION_HANDLE_IMAGE_RIGHT).Get(  temp );
361       return temp;
362     }
363     set
364     {
365       SetProperty( TextEditor.Property.SELECTION_HANDLE_IMAGE_RIGHT, new Dali.Property.Value( value ) );
366     }
367   }
368   public Dali.Property.Map SelectionHandlePressedImageLeft
369   {
370     get
371     {
372       Dali.Property.Map temp = new Dali.Property.Map();
373       GetProperty( TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT).Get(  temp );
374       return temp;
375     }
376     set
377     {
378       SetProperty( TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT, new Dali.Property.Value( value ) );
379     }
380   }
381   public Dali.Property.Map SelectionHandlePressedImageRight
382   {
383     get
384     {
385       Dali.Property.Map temp = new Dali.Property.Map();
386       GetProperty( TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT).Get(  temp );
387       return temp;
388     }
389     set
390     {
391       SetProperty( TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, new Dali.Property.Value( value ) );
392     }
393   }
394   public Dali.Property.Map SelectionHandleMarkerImageLeft
395   {
396     get
397     {
398       Dali.Property.Map temp = new Dali.Property.Map();
399       GetProperty( TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT).Get(  temp );
400       return temp;
401     }
402     set
403     {
404       SetProperty( TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT, new Dali.Property.Value( value ) );
405     }
406   }
407   public Dali.Property.Map SelectionHandleMarkerImageRight
408   {
409     get
410     {
411       Dali.Property.Map temp = new Dali.Property.Map();
412       GetProperty( TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT).Get(  temp );
413       return temp;
414     }
415     set
416     {
417       SetProperty( TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT, new Dali.Property.Value( value ) );
418     }
419   }
420   public Dali.CSharp.Color SelectionHighlightColor
421   {
422     get
423     {
424       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
425       GetProperty( TextEditor.Property.SELECTION_HIGHLIGHT_COLOR).Get(  temp );
426       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
427       return ret;
428     }
429     set
430     {
431       SetProperty( TextEditor.Property.SELECTION_HIGHLIGHT_COLOR, new Dali.Property.Value( value ) );
432     }
433   }
434   public RectInteger DecorationBoundingBox
435   {
436     get
437     {
438       RectInteger temp = new RectInteger(0,0,0,0);
439       GetProperty( TextEditor.Property.DECORATION_BOUNDING_BOX).Get(  temp );
440       return temp;
441     }
442     set
443     {
444       SetProperty( TextEditor.Property.DECORATION_BOUNDING_BOX, new Dali.Property.Value( value ) );
445     }
446   }
447   public bool EnableMarkup
448   {
449     get
450     {
451       bool temp = false;
452       GetProperty( TextEditor.Property.ENABLE_MARKUP).Get( ref temp );
453       return temp;
454     }
455     set
456     {
457       SetProperty( TextEditor.Property.ENABLE_MARKUP, new Dali.Property.Value( value ) );
458     }
459   }
460   public Dali.CSharp.Color InputColor
461   {
462     get
463     {
464       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
465       GetProperty( TextEditor.Property.INPUT_COLOR).Get(  temp );
466       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
467       return ret;
468     }
469     set
470     {
471       SetProperty( TextEditor.Property.INPUT_COLOR, new Dali.Property.Value( value ) );
472     }
473   }
474   public string InputFontFamily
475   {
476     get
477     {
478       string temp;
479       GetProperty( TextEditor.Property.INPUT_FONT_FAMILY).Get( out temp );
480       return temp;
481     }
482     set
483     {
484       SetProperty( TextEditor.Property.INPUT_FONT_FAMILY, new Dali.Property.Value( value ) );
485     }
486   }
487   public Dali.Property.Map InputFontStyle
488   {
489     get
490     {
491       Dali.Property.Map temp = new Dali.Property.Map();
492       GetProperty( TextEditor.Property.INPUT_FONT_STYLE).Get(  temp );
493       return temp;
494     }
495     set
496     {
497       SetProperty( TextEditor.Property.INPUT_FONT_STYLE, new Dali.Property.Value( value ) );
498     }
499   }
500   public float InputPointSize
501   {
502     get
503     {
504       float temp = 0.0f;
505       GetProperty( TextEditor.Property.INPUT_POINT_SIZE).Get( ref temp );
506       return temp;
507     }
508     set
509     {
510       SetProperty( TextEditor.Property.INPUT_POINT_SIZE, new Dali.Property.Value( value ) );
511     }
512   }
513   public float LineSpacing
514   {
515     get
516     {
517       float temp = 0.0f;
518       GetProperty( TextEditor.Property.LINE_SPACING).Get( ref temp );
519       return temp;
520     }
521     set
522     {
523       SetProperty( TextEditor.Property.LINE_SPACING, new Dali.Property.Value( value ) );
524     }
525   }
526   public float InputLineSpacing
527   {
528     get
529     {
530       float temp = 0.0f;
531       GetProperty( TextEditor.Property.INPUT_LINE_SPACING).Get( ref temp );
532       return temp;
533     }
534     set
535     {
536       SetProperty( TextEditor.Property.INPUT_LINE_SPACING, new Dali.Property.Value( value ) );
537     }
538   }
539   public Dali.Property.Map Underline
540   {
541     get
542     {
543       Dali.Property.Map temp = new Dali.Property.Map();
544       GetProperty( TextEditor.Property.UNDERLINE).Get(  temp );
545       return temp;
546     }
547     set
548     {
549       SetProperty( TextEditor.Property.UNDERLINE, new Dali.Property.Value( value ) );
550     }
551   }
552   public Dali.Property.Map InputUnderline
553   {
554     get
555     {
556       Dali.Property.Map temp = new Dali.Property.Map();
557       GetProperty( TextEditor.Property.INPUT_UNDERLINE).Get(  temp );
558       return temp;
559     }
560     set
561     {
562       SetProperty( TextEditor.Property.INPUT_UNDERLINE, new Dali.Property.Value( value ) );
563     }
564   }
565   public Dali.Property.Map Shadow
566   {
567     get
568     {
569       Dali.Property.Map temp = new Dali.Property.Map();
570       GetProperty( TextEditor.Property.SHADOW).Get(  temp );
571       return temp;
572     }
573     set
574     {
575       SetProperty( TextEditor.Property.SHADOW, new Dali.Property.Value( value ) );
576     }
577   }
578   public Dali.Property.Map InputShadow
579   {
580     get
581     {
582       Dali.Property.Map temp = new Dali.Property.Map();
583       GetProperty( TextEditor.Property.INPUT_SHADOW).Get(  temp );
584       return temp;
585     }
586     set
587     {
588       SetProperty( TextEditor.Property.INPUT_SHADOW, new Dali.Property.Value( value ) );
589     }
590   }
591   public Dali.Property.Map Emboss
592   {
593     get
594     {
595       Dali.Property.Map temp = new Dali.Property.Map();
596       GetProperty( TextEditor.Property.EMBOSS).Get(  temp );
597       return temp;
598     }
599     set
600     {
601       SetProperty( TextEditor.Property.EMBOSS, new Dali.Property.Value( value ) );
602     }
603   }
604   public Dali.Property.Map InputEmboss
605   {
606     get
607     {
608       Dali.Property.Map temp = new Dali.Property.Map();
609       GetProperty( TextEditor.Property.INPUT_EMBOSS).Get(  temp );
610       return temp;
611     }
612     set
613     {
614       SetProperty( TextEditor.Property.INPUT_EMBOSS, new Dali.Property.Value( value ) );
615     }
616   }
617   public Dali.Property.Map Outline
618   {
619     get
620     {
621       Dali.Property.Map temp = new Dali.Property.Map();
622       GetProperty( TextEditor.Property.OUTLINE).Get(  temp );
623       return temp;
624     }
625     set
626     {
627       SetProperty( TextEditor.Property.OUTLINE, new Dali.Property.Value( value ) );
628     }
629   }
630   public Dali.Property.Map InputOutline
631   {
632     get
633     {
634       Dali.Property.Map temp = new Dali.Property.Map();
635       GetProperty( TextEditor.Property.INPUT_OUTLINE).Get(  temp );
636       return temp;
637     }
638     set
639     {
640       SetProperty( TextEditor.Property.INPUT_OUTLINE, new Dali.Property.Value( value ) );
641     }
642   }
643
644 /* Properties ends */
645
646 %}
647
648 %enddef
649
650 %define DALI_TEXTEDITOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
651
652   TEXTEDITOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
653   TEXTEDITOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
654
655 %enddef
656
657 namespace Dali
658 {
659   DALI_TEXTEDITOR_EVENTHANDLER_PARAM( Dali::Toolkit, TextEditor);
660 }