1# 2# tkextlib/iwidgets/messagebox.rb 3# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) 4# 5 6require 'tk' 7require 'tkextlib/iwidgets.rb' 8 9module Tk 10 module Iwidgets 11 class Messagebox < Tk::Iwidgets::Scrolledwidget 12 end 13 end 14end 15 16class Tk::Iwidgets::Messagebox 17 TkCommandNames = ['::iwidgets::messagebox'.freeze].freeze 18 WidgetClassName = 'Messagebox'.freeze 19 WidgetClassNames[WidgetClassName] ||= self 20 21 #################################### 22 23 include TkItemConfigMethod 24 25 def __item_cget_cmd(id) 26 [self.path, 'type', 'cget', id] 27 end 28 private :__item_cget_cmd 29 30 def __item_config_cmd(id) 31 [self.path, 'type', 'configure', id] 32 end 33 private :__item_config_cmd 34 35 def tagid(tagOrId) 36 if tagOrId.kind_of?(Tk::Itk::Component) 37 tagOrId.name 38 else 39 #_get_eval_string(tagOrId) 40 tagOrId 41 end 42 end 43 44 def __item_boolval_optkeys(id) 45 super(id) << 'bell' << 'show' 46 end 47 private :__item_boolval_optkeys 48 49 alias typecget_tkstring itemcget_tkstring 50 alias typecget itemcget 51 alias typecget_strict itemcget_strict 52 alias typeconfigure itemconfigure 53 alias typeconfiginfo itemconfiginfo 54 alias current_typeconfiginfo current_itemconfiginfo 55 56 private :itemcget_tkstring, :itemcget, :itemcget_strict 57 private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo 58 59 #################################### 60 61 def __strval_optkeys 62 super() << 'filename' << 'savedir' 63 end 64 private :__strval_optkeys 65 66 def type_add(tag=nil, keys={}) 67 if tag.kind_of?(Hash) 68 keys = tag 69 tag = nil 70 end 71 unless tag 72 tag = Tk::Itk::Component.new(self) 73 end 74 tk_call(@path, 'type', 'add', tagid(tag), *hash_kv(keys)) 75 tag 76 end 77 78 def clear 79 tk_call(@path, 'clear') 80 self 81 end 82 83 def export(file) 84 tk_call(@path, 'export', file) 85 self 86 end 87 88 def issue(string, type=None, *args) 89 tk_call(@path, 'issue', string, tagid(type), *args) 90 self 91 end 92 93end 94