summaryrefslogtreecommitdiff
path: root/efl/evas/efl.evas.pyx
blob: df557a524ebd00d4b20250a69b7ecb8251ba9ccc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# Copyright (C) 2007-2015 various contributors (see AUTHORS)
#
# This file is part of Python-EFL.
#
# Python-EFL is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Python-EFL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.

"""

Enumerations
============

Size Hints Helper
-----------------

Helper values to be used as :ref:`evas-size-hints` for objects.

.. data:: EVAS_HINT_EXPAND = -1.0

    to be used with **weight** or **expand**

.. data:: EVAS_HINT_FILL = 1.0

    to be used with **align** or **fill**

.. data:: EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND

    Expand in both direction

    .. versionadded:: 1.13

.. data:: EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0

    Expand horizontally

    .. versionadded:: 1.13

.. data:: EXPAND_VERT = 0.0, EVAS_HINT_EXPAND

    Expand vertically

    .. versionadded:: 1.13

.. data:: FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL

    Fill both direction

    .. versionadded:: 1.13

.. data:: FILL_HORIZ = EVAS_HINT_FILL, 0.5

    Fill horizontally

    .. versionadded:: 1.13

.. data:: FILL_VERT = 0.5, EVAS_HINT_FILL

    Fill vertically

    .. versionadded:: 1.13


.. _Evas_Button_Flags:

Evas_Button_Flags
-----------------

Flags for Mouse Button events.

.. data:: EVAS_BUTTON_NONE

    No extra mouse button data.

.. data:: EVAS_BUTTON_DOUBLE_CLICK

    This mouse button press was the 2nd press of a double click.

.. data:: EVAS_BUTTON_TRIPLE_CLICK

    This mouse button press was the 3rd press of a triple click.


.. _Evas_BiDi_Direction:

Evas_BiDi_Direction
-------------------

.. data:: EVAS_BIDI_DIRECTION_NATURAL

    Natural direction.

.. data:: EVAS_BIDI_DIRECTION_NEUTRAL

    Neutral direction.

.. data:: EVAS_BIDI_DIRECTION_LTR

    Left to right direction.

.. data:: EVAS_BIDI_DIRECTION_RTL

    Right to left direction.


.. _Evas_Callback_Type:

Evas_Callback_Type
-------------------------------------

.. data:: EVAS_CALLBACK_MOUSE_IN

    Mouse In Event.

.. data:: EVAS_CALLBACK_MOUSE_OUT

    Mouse Out Event.

.. data:: EVAS_CALLBACK_MOUSE_DOWN

    Mouse Button Down Event.

.. data:: EVAS_CALLBACK_MOUSE_UP

    Mouse Button Up Event.

.. data:: EVAS_CALLBACK_MOUSE_MOVE

    Mouse Move Event.

.. data:: EVAS_CALLBACK_MOUSE_WHEEL

    Mouse Wheel Event.

.. data:: EVAS_CALLBACK_MULTI_DOWN

    Multi-touch Down Event.

.. data:: EVAS_CALLBACK_MULTI_UP

    Multi-touch Up Event.

.. data:: EVAS_CALLBACK_MULTI_MOVE

    Multi-touch Move Event.

.. data:: EVAS_CALLBACK_FREE

    Object Being Freed (Called after Del).

.. data:: EVAS_CALLBACK_KEY_DOWN

    Key Press Event.

.. data:: EVAS_CALLBACK_KEY_UP

    Key Release Event.

.. data:: EVAS_CALLBACK_FOCUS_IN

    Focus In Event.

.. data:: EVAS_CALLBACK_FOCUS_OUT

    Focus Out Event.

.. data:: EVAS_CALLBACK_SHOW

    Show Event.

.. data:: EVAS_CALLBACK_HIDE

    Hide Event.

.. data:: EVAS_CALLBACK_MOVE

    Move Event.

.. data:: EVAS_CALLBACK_RESIZE

    Resize Event.

.. data:: EVAS_CALLBACK_RESTACK

    Restack Event.

.. data:: EVAS_CALLBACK_DEL

    Object Being Deleted (called before Free).

.. data:: EVAS_CALLBACK_HOLD

    Events go on/off hold.

.. data:: EVAS_CALLBACK_CHANGED_SIZE_HINTS

    Size hints changed event.

.. data:: EVAS_CALLBACK_IMAGE_PRELOADED

    Image has been preloaded.

.. data:: EVAS_CALLBACK_CANVAS_FOCUS_IN

    Canvas got focus as a whole.

.. data:: EVAS_CALLBACK_CANVAS_FOCUS_OUT

    Canvas lost focus as a whole.

.. data:: EVAS_CALLBACK_RENDER_FLUSH_PRE

    Called just before rendering is updated on the canvas target.

.. data:: EVAS_CALLBACK_RENDER_FLUSH_POST

    Called just after rendering is updated on the canvas target.

.. data:: EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN

    Canvas object got focus.

.. data:: EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT

    Canvas object lost focus.

.. data:: EVAS_CALLBACK_IMAGE_UNLOADED

    Image data has been unloaded.

.. data:: EVAS_CALLBACK_RENDER_PRE

    Called just before rendering starts on the canvas target.

.. data:: EVAS_CALLBACK_RENDER_POST

    Called just after rendering stops on the canvas target.

.. data:: EVAS_CALLBACK_IMAGE_RESIZE

    Image size is changed.

.. data:: EVAS_CALLBACK_DEVICE_CHANGED

    Devices added, removed or changed on canvas.

.. data:: EVAS_CALLBACK_AXIS_UPDATE

    Input device changed value on some axis. (since 1.13)

.. data:: EVAS_CALLBACK_LAST

    kept as last element/sentinel – not really an event.


.. _Evas_Event_Flags:

Evas_Event_Flags
-------------------------------------

.. data:: EVAS_EVENT_FLAG_NONE

    No fancy flags set.

.. data:: EVAS_EVENT_FLAG_ON_HOLD

    This event is being delivered but should be put "on hold" until the on
    hold flag is unset. The event should be used for informational purposes
    and maybe some indications visually, but not actually perform anything

.. data:: EVAS_EVENT_FLAG_ON_SCROLL

    This event flag indicates the event occurs while scrolling; for example,
    DOWN event occurs during scrolling; the event should be used for
    informational purposes and maybe some indications visually, but not
    actually perform anything


.. _Evas_Touch_Point_State:

Evas_Touch_Point_State
-------------------------------------

.. data:: EVAS_TOUCH_POINT_DOWN

    Touch point is pressed down

.. data:: EVAS_TOUCH_POINT_UP

    Touch point is released

.. data:: EVAS_TOUCH_POINT_MOVE

    Touch point is moved

.. data:: EVAS_TOUCH_POINT_STILL

    Touch point is not moved after pressed

.. data:: EVAS_TOUCH_POINT_CANCEL

    Touch point is cancelled


.. _Evas_Font_Hinting_Flags:

Evas_Font_Hinting_Flags
-------------------------------------

.. data:: EVAS_FONT_HINTING_NONE

    No font hinting

.. data:: EVAS_FONT_HINTING_AUTO

    Automatic font hinting

.. data:: EVAS_FONT_HINTING_BYTECODE

    Bytecode font hinting


.. _Evas_Colorspace:

Evas_Colorspace
-------------------------------------

.. data:: EVAS_COLORSPACE_ARGB8888

    ARGB8888

.. data:: EVAS_COLORSPACE_YCBCR422P601_PL

    YCBCR422P601_PL

.. data:: EVAS_COLORSPACE_YCBCR422P709_PL

    YCBCR422P709_PL

.. data:: EVAS_COLORSPACE_RGB565_A5P

    RGB565_A5P

.. data:: EVAS_COLORSPACE_GRY8

    GRY8

.. data:: EVAS_COLORSPACE_YCBCR422601_PL

    YCBCR422601_PL

.. data:: EVAS_COLORSPACE_YCBCR420NV12601_PL

    YCBCR420NV12601_PL

.. data:: EVAS_COLORSPACE_YCBCR420TM12601_PL

    YCBCR420TM12601_PL


.. _Evas_Object_Table_Homogeneous_Mode:

Evas_Object_Table_Homogeneous_Mode
-------------------------------------

How to pack items into cells in a table

.. data:: EVAS_OBJECT_TABLE_HOMOGENEOUS_NONE

    None

.. data:: EVAS_OBJECT_TABLE_HOMOGENEOUS_TABLE

    Table

.. data:: EVAS_OBJECT_TABLE_HOMOGENEOUS_ITEM

    Item


.. _Evas_Aspect_Control:

Evas_Aspect_Control
-------------------------------------

.. data:: EVAS_ASPECT_CONTROL_NONE

    Preference on scaling unset

.. data:: EVAS_ASPECT_CONTROL_NEITHER

    Same effect as unset preference on scaling

.. data:: EVAS_ASPECT_CONTROL_HORIZONTAL

    Use all horizontal container space to place an object, using the given
    aspect

.. data:: EVAS_ASPECT_CONTROL_VERTICAL

    Use all vertical container space to place an object, using the given aspect

.. data:: EVAS_ASPECT_CONTROL_BOTH

    Use all horizontal and vertical container spaces to place an object
    (never growing it out of those bounds), using the given aspect


.. _Evas_Display_Mode:

Evas_Display_Mode
-------------------------------------

.. data:: EVAS_DISPLAY_MODE_NONE

    Default mode.

.. data:: EVAS_DISPLAY_MODE_COMPRESS

    Use this mode when you want to give compress display mode hint to an object.

.. data:: EVAS_DISPLAY_MODE_EXPAND

    Use this mode when you want to give expand display mode hint to an object.

.. data:: EVAS_DISPLAY_MODE_DONT_CHANGE

    Use this mode when an object should not change its display mode.


.. _Evas_Load_Error:

Evas_Load_Error
-------------------------------------

.. data:: EVAS_LOAD_ERROR_NONE

    None.

.. data:: EVAS_LOAD_ERROR_GENERIC

    Generic.

.. data:: EVAS_LOAD_ERROR_DOES_NOT_EXIST

    Not exists.

.. data:: EVAS_LOAD_ERROR_PERMISSION_DENIED

    Permission danied.

.. data:: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED

    Allocation failure.

.. data:: EVAS_LOAD_ERROR_CORRUPT_FILE

    Corrupted file.

.. data:: EVAS_LOAD_ERROR_UNKNOWN_FORMAT

    Unknown format.


.. _Evas_Alloc_Error:

Evas_Alloc_Error
-------------------------------------

.. data:: EVAS_ALLOC_ERROR_NONE

    No allocation error.

.. data:: EVAS_ALLOC_ERROR_FATAL

    Allocation failed despite attempts to free up memory.

.. data:: EVAS_ALLOC_ERROR_RECOVERED

    Allocation succeeded, but extra memory had to be found by freeing up speculative resources.


.. _Evas_Fill_Spread:

XXX
-------------------------------------

.. data:: EVAS_TEXTURE_REFLECT

    Image fill tiling mode - tiling reflects

.. data:: EVAS_TEXTURE_REPEAT

    Image fill tiling mode - tiling reflects

.. data:: EVAS_TEXTURE_RESTRICT

    Tiling clamps - range offset ignored

.. data:: EVAS_TEXTURE_RESTRICT_REFLECT

    Tiling clamps and any range offset reflects

.. data:: EVAS_TEXTURE_RESTRICT_REPEAT

    Tiling clamps and any range offset repeats

.. data:: EVAS_TEXTURE_PAD

    Tiling extends with end values


.. _Evas_Pixel_Import_Pixel_Format:

Evas_Pixel_Import_Pixel_Format
-------------------------------------

.. data:: EVAS_PIXEL_FORMAT_NONE

    No pixel format.

.. data:: EVAS_PIXEL_FORMAT_ARGB32

    ARGB 32bit pixel format with A in the high byte per 32bit pixel word.

.. data:: EVAS_PIXEL_FORMAT_YUV420P_601

    YUV 420 Planar format with CCIR 601 color encoding with contiguous
    planes in the order Y, U and V.


.. _Evas_Native_Surface_Type:

_Evas_Native_Surface_Type
-------------------------------------

.. data:: EVAS_NATIVE_SURFACE_NONE

    No surface type.

.. data:: EVAS_NATIVE_SURFACE_X11

    X Window system based type.

.. data:: EVAS_NATIVE_SURFACE_OPENGL

    OpenGL system based type.

.. data:: EVAS_NATIVE_SURFACE_WL

    Wayland system based type.


.. _Evas_Render_Op:

Evas_Render_Op
-------------------------------------

.. data:: EVAS_RENDER_BLEND

    default op: d = d*(1-sa) + s

.. data:: EVAS_RENDER_BLEND_REL

    d = d*(1 - sa) + s*da

.. data:: EVAS_RENDER_COPY

    d = s

.. data:: EVAS_RENDER_COPY_REL

    d = s*da

.. data:: EVAS_RENDER_ADD

    Unknown

.. data:: EVAS_RENDER_ADD_REL

    d = d + s*da

.. data:: EVAS_RENDER_SUB

    d = d - s

.. data:: EVAS_RENDER_SUB_REL

    Unknown

.. data:: EVAS_RENDER_TINT

    d = d*s + d*(1 - sa) + s*(1 - da)

.. data:: EVAS_RENDER_TINT_REL

    d = d*(1 - sa + s)

.. data:: EVAS_RENDER_MASK

    d = d*sa

.. data:: EVAS_RENDER_MUL

    d = d*s


.. _Evas_Border_Fill_Mode:

Evas_Border_Fill_Mode
-------------------------------------

.. data:: EVAS_BORDER_FILL_NONE

    None

.. data:: EVAS_BORDER_FILL_DEFAULT

    Default

.. data:: EVAS_BORDER_FILL_SOLID

    Solid


.. _Evas_Image_Scale_Hint:

Evas_Image_Scale_Hint
-------------------------------------

.. data:: EVAS_IMAGE_SCALE_HINT_NONE

    None

.. data:: EVAS_IMAGE_SCALE_HINT_DYNAMIC

    Dynamic

.. data:: EVAS_IMAGE_SCALE_HINT_STATIC

    Static


.. _Evas_Image_Animated_Loop_Hint:

Evas_Image_Animated_Loop_Hint
-------------------------------------

.. data:: EVAS_IMAGE_ANIMATED_HINT_NONE

    None

.. data:: EVAS_IMAGE_ANIMATED_HINT_LOOP

    Loop

.. data:: EVAS_IMAGE_ANIMATED_HINT_PINGPONG

    Pingpong


.. _Evas_Image_Orient:

Evas_Image_Orient
-------------------------------------

.. versionadded:: 1.14

.. data:: EVAS_IMAGE_ORIENT_NONE

    No orientation change

.. data:: EVAS_IMAGE_ORIENT_0

    No orientation change

.. data:: EVAS_IMAGE_ORIENT_90

    Orient 90 degrees clockwise

.. data:: EVAS_IMAGE_ORIENT_180

    Orient 180 degrees clockwise

.. data:: EVAS_IMAGE_ORIENT_270

    Rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise)

.. data:: EVAS_IMAGE_FLIP_HORIZONTAL

    Flip image horizontally

.. data:: EVAS_IMAGE_FLIP_VERTICAL

    Flip image vertically

.. data:: EVAS_IMAGE_FLIP_TRANSPOSE

    Flip image along the y = (width - x) line (bottom-left to top-right)

.. data:: EVAS_IMAGE_FLIP_TRANSVERSE

    Flip image along the y = x line (top-left to bottom-right)


.. _Evas_Engine_Render_Mode:

Evas_Engine_Render_Mode
-------------------------------------

.. data:: EVAS_RENDER_MODE_BLOCKING

    The rendering is blocking mode.

.. data:: EVAS_RENDER_MODE_NONBLOCKING

    The rendering is non blocking mode.


.. _Evas_Image_Content_Hint:

Evas_Image_Content_Hint
-------------------------------------

.. data:: EVAS_IMAGE_CONTENT_HINT_NONE

    No hint at all.

.. data:: EVAS_IMAGE_CONTENT_HINT_DYNAMIC

    The contents will change over time.

.. data:: EVAS_IMAGE_CONTENT_HINT_STATIC

    The contents won't change over time.


.. _Evas_Device_Class:

Evas_Device_Class
-------------------------------------

.. data:: EVAS_DEVICE_CLASS_NONE

    Not a device.

.. data:: EVAS_DEVICE_CLASS_SEAT

    The user/seat (the user themselves)

.. data:: EVAS_DEVICE_CLASS_KEYBOARD

    A regular keyboard, numberpad or attached buttons.

.. data:: EVAS_DEVICE_CLASS_MOUSE

    A mouse, trackball or touchpad relative motion device.

.. data:: EVAS_DEVICE_CLASS_TOUCH

    A touchscreen with fingers or stylus.

.. data:: EVAS_DEVICE_CLASS_PEN

    A special pen device.

.. data:: EVAS_DEVICE_CLASS_POINTER

    A laser pointer, wii-style or "minority report" pointing device.

.. data:: EVAS_DEVICE_CLASS_GAMEPAD

    A gamepad controller or joystick.


.. _Evas_Object_Pointer_Mode:

Evas_Object_Pointer_Mode
-------------------------------------

.. data:: EVAS_OBJECT_POINTER_MODE_AUTOGRAB

    default, X11-like

.. data:: EVAS_OBJECT_POINTER_MODE_NOGRAB

    pointer always bound to the object right below it

.. data:: EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN

    useful on object with "repeat events" enabled, where mouse/touch up and
    down events WONT be repeated to objects and these objects wont be
    auto-grabbed.


.. _Evas_Text_Style_Type:

Evas_Text_Style_Type
-------------------------------------

.. data:: EVAS_TEXT_STYLE_PLAIN

    plain

.. data:: EVAS_TEXT_STYLE_SHADOW

    shadow

.. data:: EVAS_TEXT_STYLE_OUTLINE

    outline

.. data:: EVAS_TEXT_STYLE_SOFT_OUTLINE

    soft outline

.. data:: EVAS_TEXT_STYLE_GLOW

    glow

.. data:: EVAS_TEXT_STYLE_OUTLINE_SHADOW

    outline shadow

.. data:: EVAS_TEXT_STYLE_FAR_SHADOW

    far shadow

.. data:: EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW

    outline soft shadow

.. data:: EVAS_TEXT_STYLE_SOFT_SHADOW

    soft shadow

.. data:: EVAS_TEXT_STYLE_FAR_SOFT_SHADOW

    far soft shadow

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT

    shadow direction bottom right

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM

    shadow direction bottom

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT

    shadow direction bottom left

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT

    shadow direction left

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT

    shadow direction top left

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP

    shadow direction top

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT

    shadow direction top right

.. data:: EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT

    shadow direction right


.. _Evas_Textblock_Text_Type:

Evas_Textblock_Text_Type
-------------------------------------

.. data:: EVAS_TEXTBLOCK_TEXT_RAW

    Textblock text of type raw.

.. data:: EVAS_TEXTBLOCK_TEXT_PLAIN

    Textblock text of type plain.

.. data:: EVAS_TEXTBLOCK_TEXT_MARKUP

    Textblock text of type markup.


.. _Evas_Textblock_Cursor_Type:

Evas_Textblock_Cursor_Type
-------------------------------------

.. data:: EVAS_TEXTBLOCK_CURSOR_UNDER

    Cursor type is under.

.. data:: EVAS_TEXTBLOCK_CURSOR_BEFORE

    Cursor type is before.


.. _Evas_Textgrid_Palette:

Textgrid Palette
----------------

The palette to use for the foreground and background colors.

.. data:: EVAS_TEXTGRID_PALETTE_NONE

    No palette is used.

.. data:: EVAS_TEXTGRID_PALETTE_STANDARD

    Standard palette (around 16 colors).

.. data:: EVAS_TEXTGRID_PALETTE_EXTENDED

    Extended palette (at max 256 colors).

.. data:: EVAS_TEXTGRID_PALETTE_LAST

    Ignore it.


.. _Evas_Textgrid_Font_Style:

Textgrid Font Style
-------------------

The style to give to each character of the grid.

.. data:: EVAS_TEXTGRID_FONT_STYLE_NORMAL

    Normal style.

.. data:: EVAS_TEXTGRID_FONT_STYLE_BOLD

    Bold style.

.. data:: EVAS_TEXTGRID_FONT_STYLE_ITALIC

    Oblique style.


Module level functions
======================

"""


from efl.utils.conversions cimport eina_list_strings_to_python_list
from efl.eina cimport EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO, EINA_LOG_DOM_WARN, \
    EINA_LOG_DOM_ERR, EINA_LOG_DOM_CRIT
from efl.utils.logger cimport add_logger

cdef int PY_EFL_EVAS_LOG_DOMAIN = add_logger(__name__).eina_log_domain

import atexit


# TODO doc
EVAS_HINT_FILL = -1.0
EVAS_HINT_EXPAND = 1.0

EXPAND_BOTH  = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
EXPAND_VERT  = 0.0, EVAS_HINT_EXPAND
FILL_BOTH  = EVAS_HINT_FILL, EVAS_HINT_FILL
FILL_HORIZ = EVAS_HINT_FILL, 0.5
FILL_VERT  = 0.5, EVAS_HINT_FILL


def init():
    EINA_LOG_DOM_INFO(PY_EFL_EVAS_LOG_DOMAIN, "Initializing efl.evas", NULL)
    # when changing these, also change __init__.py!
#     if evas_object_event_callbacks_len != EVAS_CALLBACK_LAST:
#         raise SystemError("Number of object callbacks changed from %d to %d." %
#                           (evas_object_event_callbacks_len, EVAS_CALLBACK_LAST))
#     if evas_canvas_event_callbacks_len != EVAS_CALLBACK_LAST:
#         raise SystemError("Number of canvas callbacks changed from %d to %d." %
#                           (evas_canvas_event_callbacks_len, EVAS_CALLBACK_LAST))
    return evas_init()


def shutdown():
    EINA_LOG_DOM_INFO(PY_EFL_EVAS_LOG_DOMAIN, "Shutting down efl.evas", NULL)
    return evas_shutdown()


def render_method_lookup(name):
    """Lookup render method and return its id (> 0 if found).

    :param name: Render method
    :type name: string
    :return: ID
    :rtype: int

    """
    if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
    return evas_render_method_lookup(
        <const char *>name if name is not None else NULL)


def render_method_list():
    """Returns a list of render method names.

    :rtype: list of str

    """
    cdef Eina_List *lst

    ret = []
    lst = evas_render_method_list()
    while lst != NULL:
        ret.append(<char*> lst.data)
        lst = lst.next

    evas_render_method_list_free(lst)
    return ret


def color_parse(desc, is_premul=None):
    cdef unsigned long c, desc_len
    cdef int r, g, b, a

    r = 0
    g = 0
    b = 0
    a = 0

    # TODO: Unicode/py3
    if isinstance(desc, str):
        if not desc or desc[0] != "#":
            raise ValueError("Invalid color description")
        desc_len = len(desc)
        c = int(desc[1:], 16)
        r = (c >> 16) & 0xff
        g = (c >> 8) & 0xff
        b = c & 0xff

        if is_premul is None:
            is_premul = False

        if desc_len == 9:
            a = (c >> 24) & 0xff
        elif desc_len == 7:
            a = 255
        else:
            raise ValueError("Invalid color description")

    elif isinstance(desc, (int, long)):
        c = desc
        a = (c >> 24) & 0xff
        r = (c >> 16) & 0xff
        g = (c >> 8) & 0xff
        b = c & 0xff

        if is_premul is None:
            is_premul = False

    elif isinstance(desc, (list, tuple)):
        if is_premul is None:
            is_premul = True

        if len(desc) == 3:
            a = 255
            r, g, b = desc
        else:
            r, g, b, a = desc
    else:
        raise TypeError("Unsupported type %s for color description." %
                        type(desc))

    if is_premul is False:
        evas_color_argb_premul(a, &r, &g, &b)

    return (r, g, b, a)


def color_argb_premul(int r, int g, int b, int a):
    evas_color_argb_premul(a, &r, &g, &b)
    return (r, g, b, a)


def color_argb_unpremul(int r, int g, int b, int a):
    evas_color_argb_unpremul(a, &r, &g, &b)
    return (r, g, b, a)


def color_hsv_to_rgb(float h, float s, float v):
    cdef int r, g, b
    evas_color_hsv_to_rgb(h, s, v, &r, &g, &b)
    return (r, g, b)


def color_rgb_to_hsv(int r, int g, int b):
    cdef float h, s, v
    evas_color_rgb_to_hsv(r, g, b, &h, &s, &v)
    return (h, s, v)

def font_path_global_clear():
    """Removes all font paths loaded

    .. versionadded: 1.10

    """
    evas_font_path_global_clear()

def font_path_global_append(path):
    """Appends a font path to the list of font paths used by the application

    .. versionadded: 1.10

    """
    if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
    evas_font_path_global_append(
        <const char *>path if path is not None else NULL)

def font_path_global_prepend(path):
    """Prepends a font path to the list of font paths used by the application

    .. versionadded: 1.10

    """
    if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
    evas_font_path_global_prepend(
        <const char *>path if path is not None else NULL)

def font_path_global_list():
    """Retrieves the list of font paths used by the application

    .. versionadded: 1.10

    """
    return eina_list_strings_to_python_list(evas_font_path_global_list())



class EvasLoadError(Exception):
    def __init__(self, int code, filename, key):
        if code == EVAS_LOAD_ERROR_NONE:
            msg = "No error on load"
        elif code == EVAS_LOAD_ERROR_GENERIC:
            msg = "A non-specific error occurred"
        elif code == EVAS_LOAD_ERROR_DOES_NOT_EXIST:
            msg = "File (or file path) does not exist"
        elif code == EVAS_LOAD_ERROR_PERMISSION_DENIED:
            msg = "Permission denied to an existing file (or path)"
        elif code == EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
            msg = "Allocation of resources failure prevented load"
        elif code == EVAS_LOAD_ERROR_CORRUPT_FILE:
            msg = "File corrupt (but was detected as a known format)"
        elif code == EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
            msg = "File is not in a known format"
        self.code = code
        self.file = filename
        self.key = key
        Exception.__init__(self, "%s (file=%s, key=%s)" % (msg, filename, key))


include "efl.evas_rect.pxi"
include "efl.evas_map.pxi"
include "efl.evas_canvas_callbacks.pxi"
include "efl.evas_canvas.pxi"
include "efl.evas_object_events.pxi"
include "efl.evas_object_callbacks.pxi"
include "efl.evas_object.pxi"
# Disable evas smart object for the moment, because PyMethod_New is broken
# in recent Cython versions, at least in Cython 0.21.1/2 using py3.
include "efl.evas_object_smart.pxi"
include "efl.evas_object_image.pxi"
include "efl.evas_object_line.pxi"
include "efl.evas_object_rectangle.pxi"
include "efl.evas_object_polygon.pxi"
include "efl.evas_object_text.pxi"
include "efl.evas_object_textblock.pxi"
include "efl.evas_object_box.pxi"
include "efl.evas_object_textgrid.pxi"
include "efl.evas_object_table.pxi"
include "efl.evas_object_grid.pxi"


init()
atexit.register(shutdown)