1#
2#  tkextlib/bwidget/labelentry.rb
3#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4#
5
6require 'tk'
7require 'tk/entry'
8require 'tkextlib/bwidget.rb'
9require 'tkextlib/bwidget/labelframe'
10require 'tkextlib/bwidget/entry'
11
12module Tk
13  module BWidget
14    class LabelEntry < Tk::Entry
15    end
16  end
17end
18
19class Tk::BWidget::LabelEntry
20  include Scrollable
21
22  TkCommandNames = ['LabelEntry'.freeze].freeze
23  WidgetClassName = 'LabelEntry'.freeze
24  WidgetClassNames[WidgetClassName] ||= self
25
26  def __strval_optkeys
27    super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg'
28  end
29  private :__strval_optkeys
30
31  def __tkvariable_optkeys
32    super() << 'helpvar'
33  end
34  private :__tkvariable_optkeys
35
36  def __font_optkeys
37    super() << 'labelfont'
38  end
39  private :__font_optkeys
40
41  #def entrybind(*args)
42  #  _bind([path, 'bind'], *args)
43  #  self
44  #end
45  def entrybind(context, *args)
46    # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
47    if TkComm._callback_entry?(args[0]) || !block_given?
48      cmd = args.shift
49    else
50      cmd = Proc.new
51    end
52    _bind([path, 'bind'], context, cmd, *args)
53    self
54  end
55
56  #def entrybind_append(*args)
57  #  _bind_append([path, 'bind'], *args)
58  #  self
59  #end
60  def entrybind_append(context, *args)
61    #if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
62    if TkComm._callback_entry?(args[0]) || !block_given?
63      cmd = args.shift
64    else
65      cmd = Proc.new
66    end
67    _bind_append([path, 'bind'], context, cmd, *args)
68    self
69  end
70
71  def entrybind_remove(*args)
72    _bind_remove([path, 'bind'], *args)
73    self
74  end
75
76  def entrybindinfo(*args)
77    _bindinfo([path, 'bind'], *args)
78    self
79  end
80end
81