1# 2# tkextlib/blt/stripchart.rb 3# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) 4# 5 6require 'tk' 7require 'tkextlib/blt.rb' 8require 'tkextlib/blt/component.rb' 9 10module Tk::BLT 11 class Stripchart < TkWindow 12 TkCommandNames = ['::blt::stripchart'.freeze].freeze 13 WidgetClassName = 'Stripchart'.freeze 14 WidgetClassNames[WidgetClassName] ||= self 15 16 include PlotComponent 17 include GraphCommand 18 19 def __boolval_optkeys 20 ['bufferelements', 'buffergraph', 'invertxy'] 21 end 22 private :__boolval_optkeys 23 24 def __strval_optkeys 25 ['text', 'label', 'title', 'file', 26 'background', 'plotbackground'] 27 end 28 private :__strval_optkeys 29 30=begin 31 BarElement_ID = ['blt_stripchart_bar'.freeze, TkUtil.untrust('00000')].freeze 32 33 def bar(elem=nil, keys={}) 34 if elem.kind_of?(Hash) 35 keys = elem 36 elem = nil 37 end 38 unless elem 39 elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze 40 BarElement_ID[1].succ! 41 end 42 tk_send('bar', elem, keys) 43 Element.new(self, elem, :without_creating=>true) 44 end 45=end 46 47 def extents(item) 48 num_or_str(tk_send_without_enc('extents', item)) 49 end 50 51 def invtransform(x, y) 52 list(tk_send_without_enc('invtransform', x, y)) 53 end 54 55 def inside(x, y) 56 bool(tk_send_without_enc('inside', x, y)) 57 end 58 59 def metafile(file=None) 60 # Windows only 61 tk_send('metafile', file) 62 self 63 end 64 65 def snap(output, keys={}) 66 tk_send_without_enc('snap', *(hash_kv(keys, false) + output)) 67 self 68 end 69 70 def transform(x, y) 71 list(tk_send_without_enc('transform', x, y)) 72 end 73 end 74end 75