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
|
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/evas'
require 'efl/native/elementary'
#
module Efl
module Elm
#
class << self
def init *args
a = args.select { |e| e.is_a? String }
return Native.elm_init 0, FFI::MemoryPointer::NULL if a.length==0
ptr = FFI::MemoryPointer.new :pointer, a.length
a.each_with_index do |s,i|
ptr[i].write_pointer FFI::MemoryPointer.from_string(s)
end
Native.elm_init a.length, ptr
end
end
#
class ElmWin < Efl::Evas::REvasObject
#
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 smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
Native.evas_object_smart_callback_add @ptr, event_str, cb, data
end
end
#
class ElmBg < Efl::Evas::REvasObject
#
search_prefixes 'elm_bg_'
#
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
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
|