ffi-efl 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/Changelog +10 -2
  2. data/README.rdoc +41 -30
  3. data/lib/efl.rb +88 -14
  4. data/lib/efl/ecore.rb +1 -0
  5. data/lib/efl/ecore_evas.rb +4 -2
  6. data/lib/efl/ecore_getopt.rb +12 -11
  7. data/lib/efl/ecore_input.rb +1 -0
  8. data/lib/efl/eet.rb +1 -0
  9. data/lib/efl/eina.rb +1 -0
  10. data/lib/efl/eina_hash.rb +1 -0
  11. data/lib/efl/eina_list.rb +1 -0
  12. data/lib/efl/eina_log.rb +4 -0
  13. data/lib/efl/elementary.rb +0 -662
  14. data/lib/efl/elementary_all.rb +82 -0
  15. data/lib/efl/elm/elm_actionslider.rb +22 -0
  16. data/lib/efl/elm/elm_anchorblock.rb +22 -0
  17. data/lib/efl/elm/elm_anchorview.rb +22 -0
  18. data/lib/efl/elm/elm_bg.rb +37 -0
  19. data/lib/efl/elm/elm_box.rb +42 -0
  20. data/lib/efl/elm/elm_bubble.rb +22 -0
  21. data/lib/efl/elm/elm_button.rb +22 -0
  22. data/lib/efl/elm/elm_calendar.rb +22 -0
  23. data/lib/efl/elm/elm_check.rb +22 -0
  24. data/lib/efl/elm/elm_clock.rb +22 -0
  25. data/lib/efl/elm/elm_cnp.rb +30 -0
  26. data/lib/efl/elm/elm_colorselector.rb +22 -0
  27. data/lib/efl/elm/elm_conform.rb +26 -0
  28. data/lib/efl/elm/elm_ctxpopup.rb +27 -0
  29. data/lib/efl/elm/elm_cursor.rb +20 -0
  30. data/lib/efl/elm/elm_debug.rb +25 -0
  31. data/lib/efl/elm/elm_diskselector.rb +51 -0
  32. data/lib/efl/elm/elm_entry.rb +22 -0
  33. data/lib/efl/elm/elm_factory.rb +22 -0
  34. data/lib/efl/elm/elm_fileselector.rb +22 -0
  35. data/lib/efl/elm/elm_fileselector_button.rb +22 -0
  36. data/lib/efl/elm/elm_fileselector_entry.rb +22 -0
  37. data/lib/efl/elm/elm_flip.rb +22 -0
  38. data/lib/efl/elm/elm_flipselector.rb +56 -0
  39. data/lib/efl/elm/elm_focus.rb +74 -0
  40. data/lib/efl/elm/elm_frame.rb +22 -0
  41. data/lib/efl/elm/elm_gengrid.rb +68 -0
  42. data/lib/efl/elm/elm_genlist.rb +79 -0
  43. data/lib/efl/elm/elm_gesture_layer.rb +22 -0
  44. data/lib/efl/elm/elm_glview.rb +22 -0
  45. data/lib/efl/elm/elm_grid.rb +22 -0
  46. data/lib/efl/elm/elm_hover.rb +22 -0
  47. data/lib/efl/elm/elm_hoversel.rb +27 -0
  48. data/lib/efl/elm/elm_icon.rb +26 -0
  49. data/lib/efl/elm/elm_image.rb +22 -0
  50. data/lib/efl/elm/elm_index.rb +31 -0
  51. data/lib/efl/elm/elm_label.rb +22 -0
  52. data/lib/efl/elm/elm_layout.rb +26 -0
  53. data/lib/efl/elm/elm_list.rb +55 -0
  54. data/lib/efl/elm/elm_map.rb +22 -0
  55. data/lib/efl/elm/elm_mapbuf.rb +22 -0
  56. data/lib/efl/elm/elm_menu.rb +55 -0
  57. data/lib/efl/elm/elm_mirroring.rb +36 -0
  58. data/lib/efl/elm/elm_multibuttonentry.rb +58 -0
  59. data/lib/efl/elm/elm_naviframe.rb +42 -0
  60. data/lib/efl/elm/elm_notify.rb +22 -0
  61. data/lib/efl/elm/elm_object.rb +68 -0
  62. data/lib/efl/elm/elm_object_item.rb +20 -0
  63. data/lib/efl/elm/elm_panel.rb +22 -0
  64. data/lib/efl/elm/elm_panes.rb +22 -0
  65. data/lib/efl/elm/elm_photo.rb +22 -0
  66. data/lib/efl/elm/elm_photocam.rb +22 -0
  67. data/lib/efl/elm/elm_plug.rb +22 -0
  68. data/lib/efl/elm/elm_progressbar.rb +22 -0
  69. data/lib/efl/elm/elm_radio.rb +22 -0
  70. data/lib/efl/elm/elm_route.rb +22 -0
  71. data/lib/efl/elm/elm_scale.rb +28 -0
  72. data/lib/efl/elm/elm_scroll.rb +50 -0
  73. data/lib/efl/elm/elm_scroller.rb +22 -0
  74. data/lib/efl/elm/elm_segment_control.rb +39 -0
  75. data/lib/efl/elm/elm_separator.rb +22 -0
  76. data/lib/efl/elm/elm_slider.rb +22 -0
  77. data/lib/efl/elm/elm_slideshow.rb +41 -0
  78. data/lib/efl/elm/elm_spinner.rb +22 -0
  79. data/lib/efl/elm/elm_store.rb +43 -0
  80. data/lib/efl/elm/elm_table.rb +22 -0
  81. data/lib/efl/elm/elm_theme.rb +42 -0
  82. data/lib/efl/elm/elm_thumb.rb +22 -0
  83. data/lib/efl/elm/elm_toolbar.rb +63 -0
  84. data/lib/efl/elm/elm_tooltip.rb +20 -0
  85. data/lib/efl/elm/elm_transit.rb +78 -0
  86. data/lib/efl/elm/elm_video.rb +30 -0
  87. data/lib/efl/elm/elm_web.rb +22 -0
  88. data/lib/efl/elm/elm_win.rb +33 -0
  89. data/lib/efl/evas.rb +8 -7
  90. data/lib/efl/native.rb +45 -11
  91. data/lib/efl/native/ecore.rb +188 -210
  92. data/lib/efl/native/ecore_evas.rb +260 -207
  93. data/lib/efl/native/ecore_getopt.rb +17 -24
  94. data/lib/efl/native/ecore_input.rb +7 -11
  95. data/lib/efl/native/edje.rb +250 -202
  96. data/lib/efl/native/eet.rb +154 -155
  97. data/lib/efl/native/eina.rb +7 -13
  98. data/lib/efl/native/eina_hash.rb +41 -47
  99. data/lib/efl/native/eina_list.rb +39 -48
  100. data/lib/efl/native/eina_log.rb +21 -23
  101. data/lib/efl/native/eina_types.rb +8 -14
  102. data/lib/efl/native/eina_xattr.rb +21 -18
  103. data/lib/efl/native/elementary.rb +9 -3381
  104. data/lib/efl/native/elm/elm_actionslider.rb +54 -0
  105. data/lib/efl/native/elm/elm_anchorblock.rb +55 -0
  106. data/lib/efl/native/elm/elm_anchorview.rb +59 -0
  107. data/lib/efl/native/elm/elm_app.rb +53 -0
  108. data/lib/efl/native/elm/elm_bg.rb +53 -0
  109. data/lib/efl/native/elm/elm_box.rb +81 -0
  110. data/lib/efl/native/elm/elm_bubble.rb +44 -0
  111. data/lib/efl/native/elm/elm_button.rb +47 -0
  112. data/lib/efl/native/elm/elm_cache.rb +59 -0
  113. data/lib/efl/native/elm/elm_calendar.rb +76 -0
  114. data/lib/efl/native/elm/elm_check.rb +41 -0
  115. data/lib/efl/native/elm/elm_clock.rb +64 -0
  116. data/lib/efl/native/elm/elm_cnp.rb +54 -0
  117. data/lib/efl/native/elm/elm_colorselector.rb +39 -0
  118. data/lib/efl/native/elm/elm_config.rb +103 -0
  119. data/lib/efl/native/elm/elm_conform.rb +37 -0
  120. data/lib/efl/native/elm/elm_ctxpopup.rb +59 -0
  121. data/lib/efl/native/elm/elm_cursor.rb +51 -0
  122. data/lib/efl/native/elm/elm_debug.rb +37 -0
  123. data/lib/efl/native/elm/elm_diskselector.rb +76 -0
  124. data/lib/efl/native/elm/elm_engine.rb +41 -0
  125. data/lib/efl/native/elm/elm_entry.rb +242 -0
  126. data/lib/efl/native/elm/elm_factory.rb +41 -0
  127. data/lib/efl/native/elm/elm_fileselector.rb +67 -0
  128. data/lib/efl/native/elm/elm_fileselector_button.rb +63 -0
  129. data/lib/efl/native/elm/elm_fileselector_entry.rb +67 -0
  130. data/lib/efl/native/elm/elm_finger.rb +39 -0
  131. data/lib/efl/native/elm/elm_flip.rb +62 -0
  132. data/lib/efl/native/elm/elm_flipselector.rb +63 -0
  133. data/lib/efl/native/elm/elm_focus.rb +65 -0
  134. data/lib/efl/native/elm/elm_fonts.rb +66 -0
  135. data/lib/efl/native/elm/elm_frame.rb +45 -0
  136. data/lib/efl/native/elm/elm_general.rb +105 -0
  137. data/lib/efl/native/elm/elm_gengrid.rb +184 -0
  138. data/lib/efl/native/elm/elm_genlist.rb +240 -0
  139. data/lib/efl/native/elm/elm_gesture_layer.rb +76 -0
  140. data/lib/efl/native/elm/elm_glview.rb +70 -0
  141. data/lib/efl/native/elm/elm_grid.rb +51 -0
  142. data/lib/efl/native/elm/elm_hover.rb +51 -0
  143. data/lib/efl/native/elm/elm_hoversel.rb +60 -0
  144. data/lib/efl/native/elm/elm_icon.rb +97 -0
  145. data/lib/efl/native/elm/elm_image.rb +80 -0
  146. data/lib/efl/native/elm/elm_index.rb +63 -0
  147. data/lib/efl/native/elm/elm_label.rb +60 -0
  148. data/lib/efl/native/elm/elm_layout.rb +77 -0
  149. data/lib/efl/native/elm/elm_list.rb +105 -0
  150. data/lib/efl/native/elm/elm_map.rb +225 -0
  151. data/lib/efl/native/elm/elm_mapbuf.rb +47 -0
  152. data/lib/efl/native/elm/elm_menu.rb +77 -0
  153. data/lib/efl/native/elm/elm_mirroring.rb +45 -0
  154. data/lib/efl/native/elm/elm_multibuttonentry.rb +81 -0
  155. data/lib/efl/native/elm/elm_naviframe.rb +79 -0
  156. data/lib/efl/native/elm/elm_need.rb +41 -0
  157. data/lib/efl/native/elm/elm_notify.rb +57 -0
  158. data/lib/efl/native/elm/elm_object.rb +74 -0
  159. data/lib/efl/native/elm/elm_object_item.rb +93 -0
  160. data/lib/efl/native/elm/elm_panel.rb +55 -0
  161. data/lib/efl/native/elm/elm_panes.rb +51 -0
  162. data/lib/efl/native/elm/elm_password.rb +41 -0
  163. data/lib/efl/native/elm/elm_photo.rb +49 -0
  164. data/lib/efl/native/elm/elm_photocam.rb +74 -0
  165. data/lib/efl/native/elm/elm_plug.rb +39 -0
  166. data/lib/efl/native/elm/elm_progressbar.rb +61 -0
  167. data/lib/efl/native/elm/elm_radio.rb +49 -0
  168. data/lib/efl/native/elm/elm_route.rb +42 -0
  169. data/lib/efl/native/elm/elm_scale.rb +41 -0
  170. data/lib/efl/native/elm/elm_scroll.rb +49 -0
  171. data/lib/efl/native/elm/elm_scroller.rb +80 -0
  172. data/lib/efl/native/elm/elm_segment_control.rb +57 -0
  173. data/lib/efl/native/elm/elm_separator.rb +39 -0
  174. data/lib/efl/native/elm/elm_slider.rb +71 -0
  175. data/lib/efl/native/elm/elm_slideshow.rb +97 -0
  176. data/lib/efl/native/elm/elm_spinner.rb +73 -0
  177. data/lib/efl/native/elm/elm_store.rb +110 -0
  178. data/lib/efl/native/elm/elm_table.rb +53 -0
  179. data/lib/efl/native/elm/elm_theme.rb +81 -0
  180. data/lib/efl/native/elm/elm_thumb.rb +60 -0
  181. data/lib/efl/native/elm/elm_toolbar.rb +145 -0
  182. data/lib/efl/native/elm/elm_tooltip.rb +59 -0
  183. data/lib/efl/native/elm/elm_transit.rb +135 -0
  184. data/lib/efl/native/elm/elm_video.rb +71 -0
  185. data/lib/efl/native/elm/elm_web.rb +165 -0
  186. data/lib/efl/native/elm/elm_win.rb +221 -0
  187. data/lib/efl/native/emap.rb +28 -34
  188. data/lib/efl/native/evas.rb +640 -618
  189. data/spec/ecore_evas_spec.rb +28 -22
  190. data/spec/ecore_spec.rb +1 -0
  191. data/spec/edje_spec.rb +8 -1
  192. data/spec/eina_hash_spec.rb +0 -1
  193. data/spec/eina_list_spec.rb +0 -1
  194. data/spec/eina_log_spec.rb +10 -8
  195. data/spec/elm_spec.rb +4 -114
  196. data/spec/evas_spec.rb +13 -244
  197. data/spec/helper.rb +16 -15
  198. data/tasks/constants.rb +9 -9
  199. data/test/test_elm_win-native.rb +6 -4
  200. data/test/test_elm_win.rb +20 -19
  201. data/test/test_evas.rb +12 -12
  202. metadata +209 -64
  203. data/lib/efl/ffi.rb +0 -172
  204. data/test/test_elementary.rb +0 -271
  205. data/test/tests/test_actionslider.rb +0 -132
  206. data/test/tests/test_anchorbock.rb +0 -73
  207. data/test/tests/test_bg.rb +0 -151
  208. data/test/tests/test_box.rb +0 -147
  209. data/test/tests/test_buttons.rb +0 -114
data/Changelog CHANGED
@@ -1,3 +1,11 @@
1
+ 2012-02-29 Jérémy Zurcher <jeremy@asynk.ch>
2
+ * remove usage of autoload
3
+ * efl.rb holds objects and method_missing helper code
4
+ * native.rb only helps for ffi mapping
5
+ * follow new elementary header split
6
+ * object constructors use instance_eval instead of yield
7
+ * elm widgets complete but rough
8
+
1
9
  2011-09-02 Jérémy Zurcher <jeremy@asynk.ch>
2
10
  * release 0.0.9
3
11
  * implement test_bg, test_actionslider, test_box
@@ -17,8 +25,8 @@
17
25
  * elementary objects constructor helper
18
26
  * elementary objects may wrap callback pointers
19
27
  * quick add classes : ElmDiskSelectorItem, ElmEntry, ElmFlipSelector, ElmFLipSelectorItem, ElmHoversel, ElmHoverselItem, ElmGenlistItemClassStruct, ElmHover, ElmButton, ElmListItem, ElmGenList,
20
- * auto complete _set and _get function suffixes
21
- * bugfix ecore_getopt
28
+ * auto complete _set and _get function suffixes
29
+ * bugfix ecore_getopt
22
30
  * add REinaList#from_a ptrt
23
31
  * add REinaList#to_a ptrt=nil
24
32
  * rework EcoreGetopt
data/README.rdoc CHANGED
@@ -12,40 +12,51 @@ A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries).
12
12
 
13
13
  == SYNOPSIS:
14
14
 
15
- require 'efl/elementary'
16
-
17
- Efl::Elm.init
18
-
19
- on_exit = Proc.new do |data, evas_object, event_info|
20
- puts "EXIT #{data.read_string}"
21
- Efl::Elm.exit
22
- end
23
-
24
- win = Efl::Elm::ElmWin.new nil, "Window name" do |w|
25
- w.title = "My title"
26
- w.alpha = true
27
- w.move 300, 300
28
- w.resize 200, 100
29
- bg = Efl::Elm::ElmBg.new w do |bg|
30
- bg.size_hint_weight_expand
31
- bg.size_hint_align_fill
32
- bg.evas_object_color_set 200,255,100,150
33
- bg.show
15
+ require 'efl/elm/elm_win'
16
+ require 'efl/elm/elm_bg'
17
+ require 'efl/elm/elm_label'
18
+
19
+ include Efl
20
+
21
+ class MyWin < Elm::ElmWin
22
+ def initialize name, title, &block
23
+ super FFI::MemoryPointer::NULL, name, &block
24
+ title_set title
25
+ feed
26
+ smart_callback_add "delete,request", method(:on_delete), FFI::MemoryPointer.from_string("my data")
34
27
  end
35
- w.resize_object_add bg
36
- lb = Efl::Elm::ElmLabel.new w do |lb|
37
- lb.text = "Hello World!"
38
- lb.size_hint_weight_set 1.0, 1.0
28
+ def feed
29
+ @bg = Elm::ElmBg.new(self) do
30
+ size_hint_weight_expand
31
+ evas_object_color_set 200,255,100,150
32
+ show
33
+ end
34
+ resize_object_add @bg
35
+ @lb = Elm::ElmLabel.new(self) do
36
+ text_set "Hello World!"
37
+ size_hint_align_fill
38
+ size_hint_weight_expand
39
+ show
40
+ end
41
+ resize_object_add @lb
42
+ end
43
+ def on_delete data, evas_object, event_info
44
+ puts "EXIT #{data.read_string}"
45
+ Elm.exit
39
46
  end
40
- lb.show
41
- w.resize_object_add lb
42
- w.smart_callback_add "delete,request", on_exit, FFI::MemoryPointer.from_string("my data")
43
47
  end
44
48
 
45
- win.show
49
+ Elm.init
50
+
51
+ win = MyWin.new "App name", "Window Title" do
52
+ alpha_set true
53
+ resize 200, 100
54
+ center_set 600, 300
55
+ show
56
+ end
46
57
 
47
- Efl::Elm.run
48
- Efl::Elm.shutdown
58
+ Elm.run
59
+ Elm.shutdown
49
60
 
50
61
  For more examples you may look at:
51
62
 
@@ -76,7 +87,6 @@ Online repositories:
76
87
 
77
88
  * https://github.com/jeremyz/ffi-efl
78
89
  * http://cgit.asynk.ch/cgi-bin/cgit/ffi-efl/
79
- * https://gitorious.org/ffi-efl
80
90
 
81
91
  Gem:
82
92
 
@@ -87,6 +97,7 @@ Gem:
87
97
  Special thanks to:
88
98
 
89
99
  * Lionel Orry
100
+ * The enlightenment team
90
101
 
91
102
  == LICENSE:
92
103
 
data/lib/efl.rb CHANGED
@@ -1,23 +1,97 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
- #
5
4
  module Efl
6
5
  #
7
- VERSION = '0.0.10'
6
+ VERSION = '0.0.11'
7
+ #
8
+ module MethodResolver
9
+ def self.resolve mod, meth, prefix
10
+ meth_s = meth.to_s
11
+ if meth_s =~/^(.*)=$/
12
+ meth_s = $1+'_set'
13
+ args_s = '*args[0]'
14
+ elsif meth_s =~/^(.*)\?$/
15
+ meth_s = $1+'_get'
16
+ args_s = '*args'
17
+ else
18
+ args_s = '*args'
19
+ end
20
+ sym = (
21
+ if Efl::Native.respond_to? prefix+meth_s
22
+ prefix+meth_s
23
+ elsif Efl::Native.respond_to? meth_s
24
+ meth_s
25
+ elsif Efl::Native.respond_to? prefix+meth_s+'_get'
26
+ prefix+meth_s+'_get'
27
+ elsif Efl::Native.respond_to? meth_s+'_get'
28
+ meth_s+'_get'
29
+ else
30
+ raise NameError.new "#{mod.name}.#{meth_s} (#{meth})"
31
+ end
32
+ )
33
+ mod.module_eval "def self.#{meth} *args, &block; r=Efl::Native.#{sym}(#{args_s}); yield r if block_given?; r; end"
34
+ sym
35
+ end
36
+ end
37
+ #
38
+ module ClassHelper
39
+ def to_a; [self] end
40
+ def to_ary; [self] end
41
+ def to_s; Object.instance_method(:to_s).bind(self).call+' ['+self.to_ptr.to_s+']' end
42
+ alias :to_str :to_s
43
+ def to_ptr; @ptr; end
44
+ def === o; @ptr === o.to_ptr; end
45
+ def null?; @ptr.null?; end
46
+ def address; @ptr.address; end
47
+ def self.included kls
48
+ # create class instance @search_prefixes
49
+ kls.class_eval "@search_prefixes ||=[]"
50
+ # access and prepend *args to @search_prefixes
51
+ kls.class_eval "def self.search_prefixes *args; @search_prefixes.unshift *args unless args.empty?; @search_prefixes; end"
52
+ # on inheritance, copy ancestor's @search_prefixes
53
+ kls.class_eval <<-EOF
54
+ def self.inherited sub
55
+ sub.class_eval '@search_prefixes = []'
56
+ sub.search_prefixes *self.search_prefixes
57
+ end
58
+ EOF
59
+ end
60
+ def method_missing m, *args, &block
61
+ m_s = m.to_s
62
+ if m_s =~/^(.*)=$/
63
+ m_s = $1+'_set'
64
+ args_s = '*args[0]'
65
+ elsif m_s =~/^(.*)\?$/
66
+ m_s = $1+'_get'
67
+ args_s = '*args'
68
+ else
69
+ args_s = '*args'
70
+ end
71
+ (['']+self.class.search_prefixes).each do |p|
72
+ sym = p+m_s
73
+ meth = (
74
+ if Efl::Native.respond_to? sym
75
+ sym
76
+ elsif Efl::Native.respond_to? m_s
77
+ m_s
78
+ elsif Efl::Native.respond_to? sym+'_get'
79
+ sym+'_get'
80
+ elsif Efl::Native.respond_to? m_s+'_get'
81
+ m_s+'_get'
82
+ else
83
+ nil
84
+ end
85
+ )
86
+ if not meth.nil?
87
+ self.class.class_eval "def #{m} *args, &block; r=Efl::Native.#{meth}(@ptr,#{args_s}); yield r if block_given?; r; end"
88
+ return self.send m, *args, &block
89
+ end
90
+ end
91
+ Kernel.raise NameError.new "#{self.class.name} is unable to resolve #{m} within #{self.class.search_prefixes.inspect}"
92
+ end
93
+ end
8
94
  #
9
- autoload :EcoreEvas, './lib/efl/ecore_evas.rb'
10
- autoload :EcoreGetopt, './lib/efl/ecore_getopt.rb'
11
- autoload :EcoreInput, './lib/efl/ecore_input.rb'
12
- autoload :Ecore, './lib/efl/ecore.rb'
13
- autoload :Edje, './lib/efl/edje.rb'
14
- autoload :Eet, './lib/efl/eet.rb'
15
- autoload :EinaHash, './lib/efl/eina_hash.rb'
16
- autoload :EinaList, './lib/efl/eina_list.rb'
17
- autoload :EinaLog, './lib/efl/eina_log.rb'
18
- autoload :Eina, './lib/efl/eina.rb'
19
- autoload :Elm, './lib/efl/elementary.rb'
20
- autoload :Evas, './lib/efl/evas.rb'
21
95
  end
22
96
  #
23
97
  # EOF
data/lib/efl/ecore.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
4
5
  require 'efl/native/ecore'
5
6
  #
6
7
  module Efl
@@ -1,6 +1,8 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
5
+ require 'efl/evas'
4
6
  require 'efl/native/ecore_evas'
5
7
  #
6
8
  module Efl
@@ -17,7 +19,7 @@ module Efl
17
19
  class REcoreEvas
18
20
  include Efl::ClassHelper
19
21
  search_prefixes 'ecore_evas_'
20
- def initialize o=nil
22
+ def initialize o=nil, &block
21
23
  @ptr = (
22
24
  case o
23
25
  when NilClass
@@ -30,7 +32,7 @@ module Efl
30
32
  raise ArgumentError.new "wrong argument #{o.class.name}"
31
33
  end
32
34
  )
33
- yield self if block_given?
35
+ instance_eval &block if block
34
36
  end
35
37
  def self.release p
36
38
  Native.ecore_evas_free p
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
4
5
  require 'efl/native/ecore_getopt'
5
6
  #
6
7
  module Efl
@@ -9,16 +10,16 @@ module Efl
9
10
  #
10
11
  class EcoreGetoptValue < FFI::Union
11
12
  layout :strp, :pointer,
12
- :boolp, :eina_bool_p,
13
- :shortp, :short_p,
14
- :intp, :int_p,
15
- :longp, :long_p,
16
- :ushortp, :ushort_p,
17
- :uintp, :uint_p,
18
- :ulongp, :ulong_p,
19
- :doublep, :double_p,
20
- :listp, :eina_list_p,
21
- :ptrp, :void_p
13
+ :boolp, :pointer,
14
+ :shortp, :pointer,
15
+ :intp, :pointer,
16
+ :longp, :pointer,
17
+ :ushortp, :pointer,
18
+ :uintp, :pointer,
19
+ :ulongp, :pointer,
20
+ :doublep, :pointer,
21
+ :listp, :pointer,
22
+ :ptrp, :pointer
22
23
 
23
24
  def value_ptr idx
24
25
  Native::EcoreGetoptValue.new to_ptr+(idx*Native::EcoreGetoptValue.size)
@@ -43,7 +44,7 @@ module Efl
43
44
  :def, EcoreGetoptDescStoreDef
44
45
  end
45
46
  #
46
- callback :ecore_getopt_desc_cb, [:ecore_getopt_p, :ecore_getopt_desc_p, :string, :pointer, :ecore_getopt_value_p ], :eina_bool
47
+ callback :ecore_getopt_desc_cb, [:pointer, :pointer, :string, :pointer, :pointer ], :eina_bool
47
48
  #
48
49
  class EcoreGetoptDescCallback < FFI::Struct
49
50
  layout :func, :ecore_getopt_desc_cb,
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
4
5
  require 'efl/native/ecore_input'
5
6
  #
6
7
  module Efl
data/lib/efl/eet.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
4
5
  require 'efl/native/eet'
5
6
  #
6
7
  module Efl
data/lib/efl/eina.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl'
4
5
  require 'efl/native/eina'
5
6
  #
6
7
  module Efl
data/lib/efl/eina_hash.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl/eina'
4
5
  require 'efl/native/eina_hash'
5
6
  #
6
7
  module Efl
data/lib/efl/eina_list.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl/eina'
4
5
  require 'efl/native/eina_list'
5
6
  #
6
7
  module Efl
data/lib/efl/eina_log.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #! /usr/bin/env ruby
2
2
  # -*- coding: UTF-8 -*-
3
3
  #
4
+ require 'efl/eina'
4
5
  require 'efl/native/eina_log'
5
6
  #
6
7
  module Efl
@@ -44,6 +45,9 @@ module Efl
44
45
  file, line, func = caller[1].split ':'
45
46
  Native.eina_log_print Native.EINA_LOG_DOMAIN_GLOBAL, lvl, file, func, line.to_i, msg
46
47
  end
48
+ class << self
49
+ private :_log
50
+ end
47
51
  #
48
52
  def self.log_crit msg
49
53
  self._log :eina_log_level_critical, msg
@@ -5,20 +5,6 @@ require 'efl/evas'
5
5
  require 'efl/native/elementary'
6
6
  #
7
7
  module Efl
8
- #
9
- module Native
10
- #
11
- class ElmGenlistItemClassStruct < FFI::Struct
12
- layout :item_style, :pointer,
13
- :label_get, :pointer,
14
- :icon_get, :pointer,
15
- :state_get, :pointer,
16
- :del, :pointer,
17
- :moved, :pointer,
18
- :mode_item_style, :pointer
19
- end
20
- #
21
- end
22
8
  #
23
9
  module Elm
24
10
  #
@@ -26,22 +12,6 @@ module Efl
26
12
  Native::VersionStruct.new(Native.elm_version)
27
13
  end
28
14
  #
29
- module Helper
30
- def self.included kls
31
- def kls.constructor meth
32
- self.class_eval <<-EOF
33
- def initialize ptr, &block
34
- if ptr.is_a? FFI::Pointer
35
- super ptr, &block
36
- else
37
- super Native.method(:#{meth}), ptr, &block
38
- end
39
- end
40
- EOF
41
- end
42
- end
43
- end
44
- #
45
15
  class << self
46
16
  def init *args
47
17
  a = args.select { |e| e.is_a? String }
@@ -54,638 +24,6 @@ module Efl
54
24
  end
55
25
  end
56
26
  #
57
- class ElmObject < Efl::Evas::REvasObject
58
- #
59
- search_prefixes 'elm_object_'
60
- #
61
- def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
62
- Native.evas_object_smart_callback_add @ptr, event_str, cb, data
63
- end
64
- #
65
- def text_set label
66
- Native.elm_object_text_part_set @ptr, nil, label
67
- end
68
- alias :text= :text_set
69
- #
70
- def text_get
71
- Native.elm_object_text_part_get @ptr, nil
72
- end
73
- alias :text :text_get
74
- #
75
- def content_set content
76
- Native.elm_object_content_part_set @ptr, nil, content
77
- end
78
- alias :content= :content_set
79
- #
80
- def content_get
81
- Native.elm_object_content_part_get @ptr, nil
82
- end
83
- alias :content :content_get
84
- #
85
- def content_unset
86
- Native.elm_object_content_part_unset @ptr, nil
87
- end
88
- #
89
- def parent_widget_get
90
- ElmObject.new Native.elm_object_parent_widget_get @ptr
91
- end
92
- alias :parent_widget :parent_widget_get
93
- end
94
- #
95
- ####################################################################################
96
- #
97
- class ElmActionSlider < ElmObject
98
- #
99
- @as_pos = Native.enum_type :elm_actionslider_pos
100
- class << self
101
- attr_reader :as_pos
102
- end
103
- #
104
- include Helper
105
- constructor :elm_actionslider_add
106
- search_prefixes 'elm_actionslider_'
107
- #
108
- def texts_set l=nil, c=nil, r=nil
109
- l,c,r = *l if l.is_a? Array
110
- Native.elm_object_text_part_set @ptr, "left", l
111
- Native.elm_object_text_part_set @ptr, "center", c
112
- Native.elm_object_text_part_set @ptr, "right", r
113
- end
114
- alias :texts= :texts_set
115
- def indicator_set str
116
- p = self.class.as_pos
117
- v = (
118
- case str
119
- when 'l'
120
- p[:elm_actionslider_left]
121
- when 'c'
122
- p[:elm_actionslider_center]
123
- when 'r'
124
- p[:elm_actionslider_right]
125
- else
126
- p[:elm_actionslider_none]
127
- end
128
- )
129
- Native.elm_actionslider_indicator_pos_set @ptr, v
130
- end
131
- alias :indicator= :indicator_set
132
- def enabled_set str
133
- p = self.class.as_pos
134
- v = p[:elm_actionslider_none]
135
- v |= p[:elm_actionslider_left] if str=~/l/
136
- v |= p[:elm_actionslider_center] if str=~/c/
137
- v |= p[:elm_actionslider_right] if str=~/r/
138
- v |= p[:elm_actionslider_all] if str=~/a/
139
- Native.elm_actionslider_enabled_pos_set @ptr, v
140
- end
141
- alias :enabled= :enabled_set
142
- def magnet_set str
143
- p = self.class.as_pos
144
- v = p[:elm_actionslider_none]
145
- v |= p[:elm_actionslider_left] if str=~/l/
146
- v |= p[:elm_actionslider_center] if str=~/c/
147
- v |= p[:elm_actionslider_right] if str=~/r/
148
- v |= p[:elm_actionslider_all] if str=~/a/
149
- Native.elm_actionslider_magnet_pos_set @ptr, v
150
- end
151
- alias :magnet= :magnet_set
152
- #
153
- def setup t=[], i='l', m='a', e='a'
154
- texts_set *t
155
- indicator_set i
156
- magnet_set m
157
- enabled_set e
158
- end
159
- end
160
- #
161
- class ElmAnchorBlock < ElmObject
162
- #
163
- include Helper
164
- constructor :elm_anchorblock_add
165
- search_prefixes 'elm_anchorblock_'
166
- end
167
- #
168
- class ElmAnchorView < ElmObject
169
- #
170
- include Helper
171
- constructor :elm_anchorview_add
172
- search_prefixes 'elm_anchorview_'
173
- end
174
- #
175
- class ElmBg < ElmObject
176
- #
177
- include Helper
178
- constructor :elm_bg_add
179
- search_prefixes 'elm_bg_'
180
- #
181
- def file_get
182
- f = FFI::MemoryPointer.new :pointer
183
- g = FFI::MemoryPointer.new :pointer
184
- Native.elm_bg_file_get @ptr, f, g
185
- [ f.read_pointer.read_string, g.read_pointer.read_string ]
186
- end
187
- alias :file :file_get
188
- def color_get
189
- r = FFI::MemoryPointer.new :int
190
- g = FFI::MemoryPointer.new :int
191
- b = FFI::MemoryPointer.new :int
192
- Native.elm_bg_color_get @ptr, r, g, b
193
- [ r.read_int, g.read_int, b.read_int ]
194
- end
195
- alias :color :color_get
196
- end
197
- #
198
- class ElmBox < ElmObject
199
- #
200
- include Helper
201
- constructor :elm_box_add
202
- search_prefixes 'elm_box_'
203
- #
204
- def padding_get
205
- x = FFI::MemoryPointer.new :int
206
- y = FFI::MemoryPointer.new :int
207
- Native::elm_box_padding_get @ptr, x, y
208
- [ x.read_int, y.read_int ]
209
- end
210
- alias :padding :padding_get
211
- #
212
- def align_get
213
- x = FFI::MemoryPointer.new :float
214
- y = FFI::MemoryPointer.new :float
215
- Native::elm_box_align_get @ptr, x, y
216
- [ x.read_float, y.read_float ]
217
- end
218
- alias :align :padding_get
219
- #
220
- def children_get
221
- Efl::EinaList::REinaList.new Native.elm_box_children_get @ptr
222
- end
223
- alias :children :children_get
224
- end
225
- #
226
- class ElmBubble < ElmObject
227
- #
228
- include Helper
229
- constructor :elm_bubble_add
230
- search_prefixes 'elm_bubble_'
231
- end
232
- #
233
- class ElmButton < ElmObject
234
- #
235
- include Helper
236
- constructor :elm_button_add
237
- search_prefixes 'elm_button_'
238
- #
239
- end
240
- #
241
- class ElmCalendar < ElmObject
242
- #
243
- include Helper
244
- constructor :elm_calendar_add
245
- search_prefixes 'elm_calendar_'
246
- #
247
- end
248
- #
249
- class ElmCheck < ElmObject
250
- #
251
- include Helper
252
- constructor :elm_check_add
253
- search_prefixes 'elm_check_'
254
- #
255
- end
256
- #
257
- class ElmClock < ElmObject
258
- #
259
- include Helper
260
- constructor :elm_clock_add
261
- search_prefixes 'elm_clock_'
262
- end
263
- #
264
- class ElmColorSelector < ElmObject
265
- #
266
- include Helper
267
- constructor :elm_colorselector_add
268
- search_prefixes 'elm_colorselector_'
269
- #
270
- end
271
- #
272
- class ElmDiskSelector < ElmObject
273
- #
274
- include Helper
275
- constructor :elm_diskselector_add
276
- search_prefixes 'elm_diskselector_'
277
- #
278
- def item_selected_set it, b
279
- Native::elm_diskselector_item_selected_set it, b
280
- end
281
- alias :item_selected= :item_selected_set
282
- end
283
- #
284
- class ElmDiskSelectorItem < ElmObject
285
- #
286
- search_prefixes 'elm_diskselector_item_'
287
- #
288
- def data_get
289
- Native::elm_diskselector_item_data_get @ptr
290
- end
291
- alias :data :data_get
292
- end
293
- #
294
- class ElmEntry < ElmObject
295
- #
296
- include Helper
297
- constructor :elm_entry_add
298
- search_prefixes 'elm_entry_'
299
- #
300
- end
301
- #
302
- class ElmFileSelector < ElmObject
303
- #
304
- include Helper
305
- constructor :elm_fileselector_add
306
- search_prefixes 'elm_fileselector_'
307
- end
308
- #
309
- class ElmFileSelectorButton < ElmObject
310
- #
311
- include Helper
312
- constructor :elm_fileselector_button_add
313
- search_prefixes 'elm_fileselector_button_'
314
- end
315
- #
316
- class ElmFileSelectorENtry < ElmObject
317
- #
318
- include Helper
319
- constructor :elm_fileselector_entry_add
320
- search_prefixes 'elm_fileselector_entry_'
321
- end
322
- #
323
- class ElmFlip < ElmObject
324
- #
325
- include Helper
326
- constructor :elm_flip_add
327
- search_prefixes 'elm_flip_'
328
- end
329
- #
330
- class ElmFlipSelector < ElmObject
331
- #
332
- include Helper
333
- constructor :elm_flipselector_add
334
- search_prefixes 'elm_flipselector_'
335
- #
336
- def item_append label, cb, data
337
- ElmFlipSelectorItem.new Native::elm_flipselector_item_append @ptr, label, cb, data
338
- end
339
- #
340
- def selected_item_get
341
- ElmFlipSelectorItem.new Native::elm_flipselector_selected_item_get @ptr
342
- end
343
- alias :selected_item :selected_item_get
344
- end
345
- #
346
- class ElmFlipSelectorItem < ElmObject
347
- #
348
- search_prefixes 'elm_flipselector_item_'
349
- #
350
- end
351
- #
352
- class ElmFrame < ElmObject
353
- #
354
- include Helper
355
- constructor :elm_frame_add
356
- search_prefixes 'elm_frame_'
357
- end
358
- #
359
- class ElmGenGrid < ElmObject
360
- #
361
- include Helper
362
- constructor :elm_gengrid_add
363
- search_prefixes 'elm_gengrid_'
364
- end
365
- #
366
- class ElmGenList < ElmObject
367
- #
368
- include Helper
369
- constructor :elm_genlist_add
370
- search_prefixes 'elm_genlist_'
371
- #
372
- end
373
- #
374
- class ElmGestureLayer < ElmObject
375
- #
376
- include Helper
377
- constructor :elm_gesture_layer_add
378
- search_prefixes 'elm_gesture_layer_'
379
- end
380
- #
381
- class ElmGlView < ElmObject
382
- #
383
- include Helper
384
- constructor :elm_glview_add
385
- search_prefixes 'elm_glview_'
386
- #
387
- end
388
- #
389
- class ElmGrid < ElmObject
390
- #
391
- include Helper
392
- constructor :elm_grid_add
393
- search_prefixes 'elm_grid_'
394
- #
395
- end
396
- #
397
- class ElmHover < ElmObject
398
- #
399
- include Helper
400
- constructor :elm_hover_add
401
- search_prefixes 'elm_hover_'
402
- #
403
- end
404
- #
405
- class ElmHoverSel < ElmObject
406
- #
407
- include Helper
408
- constructor :elm_hoversel_add
409
- search_prefixes 'elm_hoversel_'
410
- #
411
- def item_add label, icon_file=nil, icon_type=:elm_icon_none, cb=nil, data=nil
412
- ElmHoverselItem.new Native::elm_hoversel_item_add @ptr, label, icon_file, icon_type, cb, data
413
- end
414
- end
415
- #
416
- class ElmHoverSelItem < ElmObject
417
- #
418
- search_prefixes 'elm_hoversel_item_'
419
- #
420
- end
421
- #
422
- class ElmIcon < ElmObject
423
- #
424
- include Helper
425
- constructor :elm_icon_add
426
- search_prefixes 'elm_icon_'
427
- #
428
- def scale_set args
429
- Native.elm_icon_scale_set @ptr, *args
430
- end
431
- alias :scale= :scale_set
432
- end
433
- #
434
- class ElmImage < ElmObject
435
- #
436
- include Helper
437
- constructor :elm_image_add
438
- search_prefixes 'elm_image_'
439
- #
440
- end
441
- #
442
- class ElmIndex < ElmObject
443
- #
444
- include Helper
445
- constructor :elm_index_add
446
- search_prefixes 'elm_index_'
447
- #
448
- end
449
- #
450
- class ElmInWin < ElmObject
451
- #
452
- search_prefixes 'elm_win_inwin_', 'elm_win_'
453
- #
454
- def initialize parent, &block
455
- super Native.method(:elm_win_inwin_add), parent, &block
456
- end
457
- #
458
- end
459
- #
460
- class ElmLabel < ElmObject
461
- #
462
- include Helper
463
- constructor :elm_label_add
464
- search_prefixes 'elm_label_'
465
- #
466
- end
467
- #
468
- class ElmLayout < ElmObject
469
- #
470
- include Helper
471
- constructor :elm_layout_add
472
- search_prefixes 'elm_layout_'
473
- #
474
- def edje_get &block
475
- Efl::Edje::REdje.new Native.method(:elm_layout_edje_get), @ptr, &block
476
- end
477
- alias :edje :edje_get
478
- end
479
- #
480
- class ElmList < ElmObject
481
- #
482
- include Helper
483
- constructor :elm_list_add
484
- search_prefixes 'elm_list_'
485
- #
486
- def item_append label, left_icon=nil, right_icon=nil, cb=nil, data=nil
487
- ElmListItem.new Native::elm_list_item_append @ptr, label, left_icon, right_icon, cb, data
488
- end
489
- end
490
- #
491
- class ElmListItem < ElmObject
492
- #
493
- search_prefixes 'elm_list_item_'
494
- #
495
- def data_get
496
- Native::elm_list_item_data_get @ptr
497
- end
498
- alias :data :data_get
499
- end
500
- #
501
- class ElmMenu < ElmObject
502
- #
503
- include Helper
504
- constructor :elm_menu_add
505
- search_prefixes 'elm_menu_'
506
- #
507
- end
508
- #
509
- class ElmMenuItem < ElmObject
510
- #
511
- include Helper
512
- constructor :elm_menu_item_add
513
- search_prefixes 'elm_menu_item_'
514
- #
515
- end
516
- #
517
- class ElmMenuItemSeparator < ElmObject
518
- #
519
- include Helper
520
- constructor :elm_menu_item_separator_add
521
- search_prefixes 'elm_menu_item_separator_'
522
- #
523
- end
524
- #
525
- class ElmNaviFrame < ElmObject
526
- #
527
- include Helper
528
- constructor :elm_naviframe_add
529
- search_prefixes 'elm_naviframe_'
530
- #
531
- end
532
- #
533
- class ElmNotify < ElmObject
534
- #
535
- include Helper
536
- constructor :elm_notify_add
537
- search_prefixes 'elm_notify_'
538
- #
539
- end
540
- #
541
- class ElmPager < ElmObject
542
- #
543
- include Helper
544
- constructor :elm_pager_add
545
- search_prefixes 'elm_pager_'
546
- #
547
- end
548
- #
549
- class ElmPanel < ElmObject
550
- #
551
- include Helper
552
- constructor :elm_panel_add
553
- search_prefixes 'elm_panel_'
554
- #
555
- end
556
- #
557
- class ElmPanes < ElmObject
558
- #
559
- include Helper
560
- constructor :elm_panes_add
561
- search_prefixes 'elm_panes_'
562
- #
563
- end
564
- #
565
- class ElmPlayer < ElmObject
566
- #
567
- include Helper
568
- constructor :elm_player_add
569
- search_prefixes 'elm_player_'
570
- #
571
- end
572
- #
573
- class ElmPhoto < ElmObject
574
- #
575
- include Helper
576
- constructor :elm_photo_add
577
- search_prefixes 'elm_photo_'
578
- end
579
- #
580
- class ElmPhotoCam < ElmObject
581
- #
582
- include Helper
583
- constructor :elm_photocam_add
584
- search_prefixes 'elm_photocam_'
585
- end
586
- #
587
- class ElmProgressBar < ElmObject
588
- #
589
- include Helper
590
- constructor :elm_progressbar_add
591
- search_prefixes 'elm_progressbar_'
592
- end
593
- #
594
- class ElmRadio < ElmObject
595
- #
596
- include Helper
597
- constructor :elm_radio_add
598
- search_prefixes 'elm_radio_'
599
- #
600
- end
601
- #
602
- class ElmScroller < ElmObject
603
- #
604
- include Helper
605
- constructor :elm_scroller_add
606
- search_prefixes 'elm_scroller_'
607
- #
608
- end
609
- #
610
- class ElmSeparator < ElmObject
611
- #
612
- include Helper
613
- constructor :elm_separator_add
614
- search_prefixes 'elm_separator_'
615
- #
616
- end
617
- #
618
- class ElmSlider < ElmObject
619
- #
620
- include Helper
621
- constructor :elm_slider_add
622
- search_prefixes 'elm_slider_'
623
- #
624
- end
625
- #
626
- class ElmSlideshow < ElmObject
627
- #
628
- include Helper
629
- constructor :elm_slideshow_add
630
- search_prefixes 'elm_slideshow_'
631
- #
632
- end
633
- #
634
- class ElmSpinner < ElmObject
635
- #
636
- include Helper
637
- constructor :elm_spinner_add
638
- search_prefixes 'elm_spinner_'
639
- #
640
- end
641
- #
642
- class ElmTable < ElmObject
643
- #
644
- include Helper
645
- constructor :elm_table_add
646
- search_prefixes 'elm_table_'
647
- end
648
- #
649
- class ElmThumb < ElmObject
650
- #
651
- include Helper
652
- constructor :elm_thumb_add
653
- search_prefixes 'elm_thumb_'
654
- end
655
- #
656
- class ElmToolbar < ElmObject
657
- #
658
- include Helper
659
- constructor :elm_toolbar_add
660
- search_prefixes 'elm_toolbar_'
661
- end
662
- #
663
- class ElmVideo < ElmObject
664
- #
665
- include Helper
666
- constructor :elm_video_add
667
- search_prefixes 'elm_video_'
668
- end
669
- #
670
- class ElmWin < ElmObject
671
- #
672
- search_prefixes 'elm_win_'
673
- #
674
- def initialize parent, title, type=:elm_win_basic, &block
675
- super Native.method(:elm_win_add), parent, title, type, &block
676
- end
677
- def inwin_add
678
- ElmInWin.new @ptr
679
- end
680
- def screen_position_get
681
- x = FFI::MemoryPointer.new :int
682
- y = FFI::MemoryPointer.new :int
683
- Native.elm_win_screen_position_get @ptr, x, y
684
- [ x.read_int, y.read_int ]
685
- end
686
- alias :screen_position :screen_position_get
687
- end
688
- #
689
27
  end
690
28
  end
691
29
  #