From 64b70a165413fd14cfb90d1df856901351567da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 20 Aug 2011 21:24:11 +0200 Subject: Efl::ElmActionSlider add #texts, #indicator, #enabled, #magnet, #setup methods and @os_pos class variable --- lib/efl/elementary.rb | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb index 0329ae1..e5bd55e 100644 --- a/lib/efl/elementary.rb +++ b/lib/efl/elementary.rb @@ -96,10 +96,66 @@ module Efl # class ElmActionSlider < ElmObject # + @as_pos = Native.enum_type :elm_actionslider_pos + class << self + attr_reader :as_pos + end + # include Helper constructor :elm_actionslider_add search_prefixes 'elm_actionslider_' # + def texts_set l=nil, c=nil, r=nil + l,c,r = *l if l.is_a? Array + Native.elm_object_text_part_set @ptr, "left", l + Native.elm_object_text_part_set @ptr, "center", c + Native.elm_object_text_part_set @ptr, "right", r + end + alias :texts= :texts_set + def indicator_set str + p = self.class.as_pos + v = ( + case str + when 'l' + p[:elm_actionslider_left] + when 'c' + p[:elm_actionslider_center] + when 'r' + p[:elm_actionslider_right] + else + p[:elm_actionslider_none] + end + ) + Native.elm_actionslider_indicator_pos_set @ptr, v + end + alias :indicator= :indicator_set + def enabled_set str + p = self.class.as_pos + v = p[:elm_actionslider_none] + v |= p[:elm_actionslider_left] if str=~/l/ + v |= p[:elm_actionslider_center] if str=~/c/ + v |= p[:elm_actionslider_right] if str=~/r/ + v |= p[:elm_actionslider_all] if str=~/a/ + Native.elm_actionslider_enabled_pos_set @ptr, v + end + alias :enabled= :enabled_set + def magnet_set str + p = self.class.as_pos + v = p[:elm_actionslider_none] + v |= p[:elm_actionslider_left] if str=~/l/ + v |= p[:elm_actionslider_center] if str=~/c/ + v |= p[:elm_actionslider_right] if str=~/r/ + v |= p[:elm_actionslider_all] if str=~/a/ + Native.elm_actionslider_magnet_pos_set @ptr, v + end + alias :magnet= :magnet_set + # + def setup t=[], i='l', m='a', e='a' + texts_set *t + indicator_set i + magnet_set m + enabled_set e + end end # class ElmBg < ElmObject -- cgit v1.1-2-g2b99