summaryrefslogtreecommitdiffstats
path: root/lib/efl/elm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efl/elm')
-rw-r--r--lib/efl/elm/elm_bg.rb37
-rw-r--r--lib/efl/elm/elm_label.rb22
-rw-r--r--lib/efl/elm/elm_object.rb68
-rw-r--r--lib/efl/elm/elm_win.rb33
4 files changed, 160 insertions, 0 deletions
diff --git a/lib/efl/elm/elm_bg.rb b/lib/efl/elm/elm_bg.rb
new file mode 100644
index 0000000..1eea4ce
--- /dev/null
+++ b/lib/efl/elm/elm_bg.rb
@@ -0,0 +1,37 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/elm/elm_object'
+require 'efl/native/elm/elm_bg'
+#
+module Efl
+ #
+ module Elm
+ #
+ class ElmBg < ElmObject
+ #
+ include Helper
+ constructor :elm_bg_add
+ search_prefixes 'elm_bg_'
+ #
+ def file_get
+ f = FFI::MemoryPointer.new :pointer
+ g = FFI::MemoryPointer.new :pointer
+ Native.elm_bg_file_get @ptr, f, g
+ [ f.read_pointer.read_string, g.read_pointer.read_string ]
+ end
+ alias :file :file_get
+ def color_get
+ r = FFI::MemoryPointer.new :int
+ g = FFI::MemoryPointer.new :int
+ b = FFI::MemoryPointer.new :int
+ Native.elm_bg_color_get @ptr, r, g, b
+ [ r.read_int, g.read_int, b.read_int ]
+ end
+ alias :color :color_get
+ end
+ #
+ end
+end
+#
+# EOF
diff --git a/lib/efl/elm/elm_label.rb b/lib/efl/elm/elm_label.rb
new file mode 100644
index 0000000..57460c4
--- /dev/null
+++ b/lib/efl/elm/elm_label.rb
@@ -0,0 +1,22 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/elm/elm_object'
+require 'efl/native/elm/elm_label'
+#
+module Efl
+ #
+ module Elm
+ #
+ class ElmLabel < ElmObject
+ #
+ include Helper
+ constructor :elm_label_add
+ search_prefixes 'elm_label_'
+ #
+ end
+ #
+ end
+end
+#
+# EOF
diff --git a/lib/efl/elm/elm_object.rb b/lib/efl/elm/elm_object.rb
new file mode 100644
index 0000000..f640da5
--- /dev/null
+++ b/lib/efl/elm/elm_object.rb
@@ -0,0 +1,68 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/elementary'
+require 'efl/native/elm/elm_object'
+#
+module Efl
+ #
+ module Elm
+ #
+ module Helper
+ def self.included kls
+ def kls.constructor meth
+ self.class_eval <<-EOF
+ def initialize ptr, &block
+ if ptr.is_a? FFI::Pointer
+ super ptr, &block
+ else
+ super Native.method(:#{meth}), ptr, &block
+ end
+ end
+ EOF
+ end
+ end
+ end
+ #
+ class ElmObject < Efl::Evas::REvasObject
+ #
+ search_prefixes 'elm_object_'
+ #
+ def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
+ Native.evas_object_smart_callback_add @ptr, event_str, cb, data
+ end
+ #
+ def text_set label
+ Native.elm_object_part_text_set @ptr, nil, label
+ end
+ alias :text= :text_set
+ #
+ def text_get
+ Native.elm_object_part_text_get @ptr, nil
+ end
+ alias :text :text_get
+ #
+ def content_set content
+ Native.elm_object_part_content_set @ptr, nil, content
+ end
+ alias :content= :content_set
+ #
+ def content_get
+ Native.elm_object_part_content_get @ptr, nil
+ end
+ alias :content :content_get
+ #
+ def content_unset
+ Native.elm_object_part_content_unset @ptr, nil
+ end
+ #
+ def parent_widget_get
+ ElmObject.new Native.elm_object_parent_widget_get @ptr
+ end
+ alias :parent_widget :parent_widget_get
+ end
+ #
+ end
+end
+#
+# EOF
diff --git a/lib/efl/elm/elm_win.rb b/lib/efl/elm/elm_win.rb
new file mode 100644
index 0000000..daac677
--- /dev/null
+++ b/lib/efl/elm/elm_win.rb
@@ -0,0 +1,33 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/elm/elm_object'
+require 'efl/native/elm/elm_win'
+#
+module Efl
+ #
+ module Elm
+ #
+ class ElmWin < ElmObject
+ #
+ search_prefixes 'elm_win_'
+ #
+ def initialize parent, title, type=:elm_win_basic, &block
+ super Native.method(:elm_win_add), parent, title, type, &block
+ end
+# def inwin_add
+# ElmInWin.new @ptr
+# end
+ def screen_position_get
+ x = FFI::MemoryPointer.new :int
+ y = FFI::MemoryPointer.new :int
+ Native.elm_win_screen_position_get @ptr, x, y
+ [ x.read_int, y.read_int ]
+ end
+ alias :screen_position :screen_position_get
+ end
+ #
+ end
+end
+#
+# EOF