2 # tkextlib/iwidgets/selectiondialog.rb
3 # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
7 require 'tkextlib/iwidgets.rb'
11 class Selectiondialog < Tk::Iwidgets::Dialog
16 class Tk::Iwidgets::Selectiondialog
17 TkCommandNames = ['::iwidgets::selectiondialog'.freeze].freeze
18 WidgetClassName = 'Selectiondialog'.freeze
19 WidgetClassNames[WidgetClassName] = self
22 window(tk_call(@path, 'childsite'))
26 tk_call(@path, 'clear', 'items')
31 tk_call(@path, 'clear', 'selection')
39 def insert_items(idx, *args)
40 tk_call(@path, 'insert', 'items', idx, *args)
43 def insert_selection(pos, text)
44 tk_call(@path, 'insert', 'selection', pos, text)
48 tk_call(@path, 'selectitem')
52 # based on Tk::Listbox ( and TkTextWin )
54 list(tk_send_without_enc('curselection'))
56 def delete(first, last=None)
57 tk_send_without_enc('delete', first, last)
61 tk_send_without_enc('index', idx).to_i
64 tk_send_without_enc('nearest', y).to_i
67 tk_send_without_enc('scan', 'mark', x, y)
71 tk_send_without_enc('scan', 'dragto', x, y)
74 def selection_anchor(index)
75 tk_send_without_enc('selection', 'anchor', index)
78 def selection_clear(first, last=None)
79 tk_send_without_enc('selection', 'clear', first, last)
82 def selection_includes(index)
83 bool(tk_send_without_enc('selection', 'includes', index))
85 def selection_set(first, last=None)
86 tk_send_without_enc('selection', 'set', first, last)
90 tk_send_without_enc('size').to_i