diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb |
Fresh start
Diffstat (limited to 'jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb')
-rw-r--r-- | jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb b/jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb new file mode 100644 index 0000000..16143df --- /dev/null +++ b/jni/ruby/ext/tk/lib/tkextlib/bwidget/combobox.rb @@ -0,0 +1,62 @@ +# +# tkextlib/bwidget/combobox.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' +require 'tk/entry' +require 'tkextlib/bwidget.rb' +require 'tkextlib/bwidget/listbox' +require 'tkextlib/bwidget/spinbox' + +module Tk + module BWidget + class ComboBox < Tk::BWidget::SpinBox + end + end +end + +class Tk::BWidget::ComboBox + include Scrollable + + TkCommandNames = ['ComboBox'.freeze].freeze + WidgetClassName = 'ComboBox'.freeze + WidgetClassNames[WidgetClassName] ||= self + + def __boolval_optkeys + super() << 'autocomplete' << 'autopost' + end + private :__boolval_optkeys + + def get_listbox(&b) + win = window(tk_send_without_enc('getlistbox')) + if b + if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!! + win.instance_exec(self, &b) + else + win.instance_eval(&b) + end + end + win + end + + def clear_value + tk_send_without_enc('clearvalue') + self + end + alias clearvalue clear_value + + def icursor(idx) + tk_send_without_enc('icursor', idx) + end + + def post + tk_send_without_enc('post') + self + end + + def unpost + tk_send_without_enc('unpost') + self + end +end |