summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/efl/elementary.rb82
1 files changed, 40 insertions, 42 deletions
diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb
index f3c278b..e71ac88 100644
--- a/lib/efl/elementary.rb
+++ b/lib/efl/elementary.rb
@@ -11,6 +11,18 @@ module Efl
Native::VersionStruct.new(Native.elm_version)
end
#
+ module Helper
+ def self.included kls
+ def kls.constructor meth
+ self.class_eval <<-EOF
+ def initialize parent, &block
+ super Native.method(:#{meth}), parent, &block
+ end
+ EOF
+ end
+ end
+ end
+ #
class << self
def init *args
a = args.select { |e| e.is_a? String }
@@ -56,11 +68,10 @@ module Efl
#
class ElmBg < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_bg_add
search_prefixes 'elm_bg_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_bg_add), parent, &block
- end
def file_get
f = FFI::MemoryPointer.new :pointer
g = FFI::MemoryPointer.new :pointer
@@ -80,12 +91,10 @@ module Efl
#
class ElmLayout < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_layout_add
search_prefixes 'elm_layout_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_layout_add), parent, &block
- end
- #
def edje_get &block
Efl::Edje::REdje.new Native.method(:elm_layout_edje_get), @ptr, &block
end
@@ -94,12 +103,10 @@ module Efl
#
class ElmBox < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_box_add
search_prefixes 'elm_box_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_box_add), parent, &block
- end
- #
def padding_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
@@ -124,22 +131,18 @@ module Efl
#
class ElmList < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_list_add
search_prefixes 'elm_list_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_list_add), parent, &block
- end
- #
end
#
class ElmIcon < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_icon_add
search_prefixes 'elm_icon_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_icon_add), parent, &block
- end
- #
def scale_set args
Native.elm_icon_scale_set @ptr, *args
end
@@ -148,39 +151,34 @@ module Efl
#
class ElmLabel < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_label_add
search_prefixes 'elm_label_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_label_add), parent, &block
- end
end
#
class ElmPager < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_pager_add
search_prefixes 'elm_pager_', 'elm_object_'
#
- def initialize parent, &block
- super Native.method(:elm_pager_add), parent, &block
- end
end
#
class ElmPanel < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_panel_add
search_prefixes 'elm_panel_', 'elm_object'
#
- def initialize parent, &block
- super Native.method(:elm_panel_add), parent, &block
- end
end
#
class ElmDiskSelector < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_diskselector_add
search_prefixes 'elm_diskselector_', 'elm_object'
#
- def initialize parent, &block
- super Native.method(:elm_diskselector_add), parent, &block
- end
- #
def item_selected_set it, b
Native::elm_diskselector_item_selected_set it, b
end
@@ -189,6 +187,8 @@ module Efl
#
class ElmDiskSelectorItem < Efl::Evas::REvasObject
#
+# include Helper
+# constructor :elm_icon_add
search_prefixes 'elm_diskselector_item_', 'elm_object'
#
def data_get
@@ -199,30 +199,26 @@ module Efl
#
class ElmNotify < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_notify_add
search_prefixes 'elm_notify_', 'elm_object'
#
- def initialize parent, &block
- super Native.method(:elm_notify_add), parent, &block
- end
end
#
class ElmEntry < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_entry_add
search_prefixes 'elm_entry_', 'elm_object'
#
- def initialize parent, &block
- super Native.method(:elm_entry_add), parent, &block
- end
end
#
class ElmFlipSelector < Efl::Evas::REvasObject
#
+ include Helper
+ constructor :elm_flipselector_add
search_prefixes 'elm_flipselector_', 'elm_object'
#
- def initialize parent, &block
- super Native.method(:elm_flipselector_add), parent, &block
- end
- #
def item_append label, cb, data
ElmFlipSelectorItem.new Native::elm_flipselector_item_append @ptr, label, cb, data
end
@@ -235,6 +231,8 @@ module Efl
#
class ElmFlipSelectorItem < Efl::Evas::REvasObject
#
+# include Helper
+# constructor :elm_icon_add
search_prefixes 'elm_flipselector_item_', 'elm_object'
#
end