2 # tkextlib/iwidgets/radiobox.rb
3 # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
7 require 'tkextlib/iwidgets.rb'
11 class Radiobox < Tk::Iwidgets::Labeledframe
16 class Tk::Iwidgets::Radiobox
17 TkCommandNames = ['::iwidgets::radiobox'.freeze].freeze
18 WidgetClassName = 'Radiobox'.freeze
19 WidgetClassNames[WidgetClassName] = self
21 ####################################
23 include TkItemConfigMethod
25 def __item_cget_cmd(id)
26 [self.path, 'buttoncget', id]
28 private :__item_cget_cmd
30 def __item_config_cmd(id)
31 [self.path, 'buttonconfigure', id]
33 private :__item_config_cmd
35 def __item_boolval_optkeys(id)
36 super(id) << 'defaultring'
38 private :__item_boolval_optkeys
41 if tagOrId.kind_of?(Tk::Itk::Component)
44 #_get_eval_string(tagOrId)
49 alias buttoncget itemcget
50 alias buttoncget_strict itemcget_strict
51 alias buttonconfigure itemconfigure
52 alias buttonconfiginfo itemconfiginfo
53 alias current_buttonconfiginfo current_itemconfiginfo
55 private :itemcget, :itemcget_strict
56 private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
58 ####################################
60 def add(tag=nil, keys={})
66 tag = Tk::Itk::Component.new(self, tagid(tag))
68 tag = Tk::Itk::Component.new(self)
70 tk_call(@path, 'add', tagid(tag), *hash_kv(keys))
75 tk_call(@path, 'delete', index(idx))
80 tk_call(@path, 'deselect', index(idx))
85 tk_call(@path, 'flash', index(idx))
90 ((tag = tk_call_without_enc(@path, 'get')).empty?)? nil: tag
95 (tag = get_tag)? Tk::Itk::Component.id2obj(self, tag): nil
99 number(tk_call(@path, 'index', tagid(idx)))
102 def insert(idx, tag=nil, keys={})
103 if tag.kind_of?(Hash)
108 tag = Tk::Itk::Component.new(self, tagid(tag))
110 tag = Tk::Itk::Component.new(self)
112 tk_call(@path, 'insert', index(idx), tagid(tag), *hash_kv(keys))
117 tk_call(@path, 'select', index(idx))