root/lang/ruby/nario/rskit/lib/ruby/1.8/tkextlib/bwidget/spinbox.rb @ 17197

Revision 17197, 2.1 kB (checked in by authorNari, 6 years ago)

add rskit

Line 
1#
2#  tkextlib/bwidget/entry.rb
3#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4#
5
6require 'tk'
7require 'tkextlib/bwidget.rb'
8require 'tkextlib/bwidget/arrowbutton'
9require 'tkextlib/bwidget/entry'
10
11module Tk
12  module BWidget
13    class SpinBox < TkEntry
14    end
15  end
16end
17
18class Tk::BWidget::SpinBox
19  include Scrollable
20
21  TkCommandNames = ['SpinBox'.freeze].freeze
22  WidgetClassName = 'SpinBox'.freeze
23  WidgetClassNames[WidgetClassName] = self
24
25  def __strval_optkeys
26    super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
27  end
28  private :__strval_optkeys
29
30  def __boolval_optkeys
31    super() << 'dragenabled' << 'dropenabled' << 'editable'
32  end
33  private :__boolval_optkeys
34
35  def __listval_optkeys
36    super() << 'values'
37  end
38  private :__listval_optkeys
39
40  def __tkvariable_optkeys
41    super() << 'helpvar'
42  end
43  private :__tkvariable_optkeys
44
45  #def entrybind(*args)
46  #  _bind([path, 'bind'], *args)
47  #  self
48  #end
49  def entrybind(context, *args)
50    #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
51    if TkComm._callback_entry?(args[0]) || !block_given?
52      cmd = args.shift
53    else
54      cmd = Proc.new
55    end
56    _bind([path, 'bind'], context, cmd, *args)
57    self
58  end
59
60  #def entrybind_append(*args)
61  #  _bind_append([path, 'bind'], *args)
62  #  self
63  #end
64  def entrybind_append(context, *args)
65    #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
66    if TkComm._callback_entry?(args[0]) || !block_given?
67      cmd = args.shift
68    else
69      cmd = Proc.new
70    end
71    _bind_append([path, 'bind'], context, cmd, *args)
72    self
73  end
74
75  def entrybind_remove(*args)
76    _bind_remove([path, 'bind'], *args)
77    self
78  end
79
80  def entrybindinfo(*args)
81    _bindinfo([path, 'bind'], *args)
82    self
83  end
84
85  def get_index_of_value
86    number(tk_send_without_enc('getvalue'))
87  end
88  alias get_value get_index_of_value
89  alias get_value_index get_index_of_value
90
91  def set_value_by_index(idx)
92    idx = "@#{idx}" if idx.kind_of?(Integer)
93    tk_send_without_enc('setvalue', idx)
94    self
95  end
96  alias set_value set_value_by_index
97  alias set_index_value set_value_by_index
98end
Note: See TracBrowser for help on using the browser.