From 1a74fa4b04da04bd2bb33103dd3cf431438df38e Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 14 Dec 2017 15:09:35 +0000 Subject: add tag v2_2_9 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v2_2_9@61257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_2_2/ext/tk/lib/tkextlib/bwidget/combobox.rb | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 ruby_2_2/ext/tk/lib/tkextlib/bwidget/combobox.rb (limited to 'ruby_2_2/ext/tk/lib/tkextlib/bwidget/combobox.rb') diff --git a/ruby_2_2/ext/tk/lib/tkextlib/bwidget/combobox.rb b/ruby_2_2/ext/tk/lib/tkextlib/bwidget/combobox.rb new file mode 100644 index 0000000000..16143dfbc6 --- /dev/null +++ b/ruby_2_2/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 -- cgit v1.2.3