aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tkextlib/bwidget/spinbox.rb
blob: 4380e383556ec50da510c5d36e3fb9be8e28bc68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
#  tkextlib/bwidget/entry.rb
#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#

require 'tk'
require 'tkextlib/bwidget.rb'
require 'tkextlib/bwidget/arrowbutton'
require 'tkextlib/bwidget/entry'

module Tk
  module BWidget
    class SpinBox < TkEntry
    end
  end
end

class Tk::BWidget::SpinBox
  include Scrollable

  TkCommandNames = ['SpinBox'.freeze].freeze
  WidgetClassName = 'SpinBox'.freeze
  WidgetClassNames[WidgetClassName] = self

  def entrybind(*args)
    _bind([path, 'bind'], *args)
    self
  end

  def entrybind_append(*args)
    _bind_append([path, 'bind'], *args)
    self
  end

  def entrybind_remove(*args)
    _bind_remove([path, 'bind'], *args)
    self
  end

  def entrybindinfo(*args)
    _bindinfo([path, 'bind'], *args)
    self
  end

  def get_index_of_value
    number(tk_send_without_enc('getvalue'))
  end
  alias get_value get_index_of_value
  alias get_value_index get_index_of_value

  def set_value_by_index(idx)
    idx = "@#{idx}" if idx.kind_of?(Integer)
    tk_send_without_enc('setvalue', idx)
    self
  end
  alias set_value set_value_by_index
  alias set_index_value set_value_by_index
end