2004-07-08 12:50:07 -04:00
|
|
|
#
|
|
|
|
# tkextlib/itk/incr_tk.rb
|
|
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'tk'
|
|
|
|
require 'tk/menuspec'
|
|
|
|
require 'tkextlib/itcl.rb'
|
|
|
|
|
|
|
|
# call setup script
|
|
|
|
require 'tkextlib/itk.rb'
|
|
|
|
|
|
|
|
#TkPackage.require('Itk', '3.2')
|
|
|
|
TkPackage.require('Itk')
|
|
|
|
|
|
|
|
module Tk
|
|
|
|
module Itk
|
|
|
|
include Tk
|
|
|
|
extend Tk
|
|
|
|
|
|
|
|
LIBRARY = TkVarAccess.new('::itk::library')
|
|
|
|
|
2005-05-30 10:53:52 -04:00
|
|
|
PACKAGE_NAME = 'Itk'.freeze
|
|
|
|
def self.package_name
|
|
|
|
PACKAGE_NAME
|
|
|
|
end
|
|
|
|
|
2004-07-08 12:50:07 -04:00
|
|
|
def self.package_version
|
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
TkPackage.require('Itk')
|
2004-07-08 12:50:07 -04:00
|
|
|
rescue
|
2004-10-11 00:51:21 -04:00
|
|
|
''
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.usual(arg, *args)
|
|
|
|
tk_call('::itk::usual', arg, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.usual_names
|
|
|
|
list(tk_call('::itk::usual'))
|
|
|
|
end
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
class Archetype < TkWindow
|
|
|
|
TkCommandNames = [].freeze
|
|
|
|
# WidgetClassName = 'Archetype'.freeze
|
|
|
|
# WidgetClassNames[WidgetClassName] = self
|
|
|
|
|
|
|
|
def self.to_eval
|
2004-10-11 00:51:21 -04:00
|
|
|
'::itk::' << self::WidgetClassName
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
2004-07-14 21:18:57 -04:00
|
|
|
def __destroy_hook__
|
2004-10-11 00:51:21 -04:00
|
|
|
Tk::Itk::Component::ComponentID_TBL.delete(self.path)
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
|
2004-07-08 12:50:07 -04:00
|
|
|
#### [incr Tk] public methods
|
|
|
|
def component
|
2004-10-11 00:51:21 -04:00
|
|
|
simplelist(tk_send('component'))
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def component_path(name)
|
2004-10-11 00:51:21 -04:00
|
|
|
window(tk_send('component', name))
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
2004-07-09 15:29:29 -04:00
|
|
|
alias component_widget component_path
|
2004-07-08 12:50:07 -04:00
|
|
|
|
|
|
|
def component_invoke(name, cmd, *args)
|
2004-10-11 00:51:21 -04:00
|
|
|
window(tk_send('component', name, cmd, *args))
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def component_obj(*names)
|
2004-10-11 00:51:21 -04:00
|
|
|
names = component if names.empty?
|
|
|
|
names.collect{|name| Tk::Itk::Component.new(self.path, name) }
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
#### [incr Tk] protected methods
|
|
|
|
=begin
|
|
|
|
def itk_component_add(visibility, name, create_cmds, option_cmds=None)
|
2004-10-11 00:51:21 -04:00
|
|
|
args = []
|
|
|
|
visibility.each{|v| v = v.to_s; args << ( (v[0] == ?-)? v: "-#{v}" )}
|
|
|
|
args << '--' << name << create_cmd << option_cmds
|
|
|
|
tk_call('itk_component', 'add', *args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def itk_component_delete(*names)
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_call('itk_component', 'delete', *names)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def itk_initialize(keys={})
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_call('itk_initialize', keys)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def itk_option_add(*args)
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_call('itk_option', 'add', *args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def itk_option_define(name, resource, klass, init, config=None)
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_call('itk_option', 'define', name, resource, klass, init, config)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
|
2004-07-08 12:50:07 -04:00
|
|
|
def itk_option_remove(*args)
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_call('itk_option', 'remove', *args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
=end
|
|
|
|
end
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
class Toplevel < Archetype
|
|
|
|
TkCommandNames = ['::itk::Toplevel'].freeze
|
|
|
|
WidgetClassName = 'Toplevel'.freeze
|
2009-07-12 19:08:32 -04:00
|
|
|
WidgetClassNames[WidgetClassName] ||= self
|
2004-07-08 12:50:07 -04:00
|
|
|
|
|
|
|
include Wm
|
|
|
|
include TkMenuSpec
|
* ext/tk/extconf.rb: improbe messages [ruby-core:06325].
* ext/tk/lib/tk.rb, ext/tk/lib/tk/canvas.rb, ext/tk/lib/tk/entry.rb,
ext/tk/lib/tk/frame.rb, ext/tk/lib/tk/image.rb,
ext/tk/lib/tk/itemconfig.rb, ext/tk/lib/tk/labelframe.rb,
ext/tk/lib/tk/listbox.rb, ext/tk/lib/tk/menu.rb,
ext/tk/lib/tk/radiobutton.rb, ext/tk/lib/tk/scale.rb,
ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tk/text.rb,
ext/tk/lib/tk/toplevel.rb: improve conversion of option values.
* ext/tk/lib/tkextlib/*: ditto.
* ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2.
* ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3.
* ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2.
* ext/tk/lib/tkextlib/vu/*: support vu 2.3.0.
* ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-22 18:17:08 -04:00
|
|
|
|
|
|
|
def __strval_optkeys
|
|
|
|
super() << 'title'
|
|
|
|
end
|
|
|
|
private :__strval_optkeys
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
class Widget < Archetype
|
|
|
|
TkCommandNames = ['::itk::Widget'].freeze
|
|
|
|
WidgetClassName = 'Widget'.freeze
|
2009-07-12 19:08:32 -04:00
|
|
|
WidgetClassNames[WidgetClassName] ||= self
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
class Component < TkObject
|
|
|
|
def __cget_cmd
|
2004-10-11 00:51:21 -04:00
|
|
|
[self.master, 'component', self.name, 'cget']
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
2004-11-03 03:09:55 -05:00
|
|
|
private :__cget_cmd
|
2004-07-08 12:50:07 -04:00
|
|
|
|
|
|
|
def __config_cmd
|
2004-10-11 00:51:21 -04:00
|
|
|
[self.master, 'component', self.name, 'configure']
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
2004-11-03 03:09:55 -05:00
|
|
|
private :__config_cmd
|
2004-07-08 12:50:07 -04:00
|
|
|
|
|
|
|
ComponentID_TBL = TkCore::INTERP.create_table
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
(Itk_Component_ID = ['itk:component'.freeze, TkUtil.untrust('00000')]).instance_eval{
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
@mutex = Mutex.new
|
|
|
|
def mutex; @mutex; end
|
|
|
|
freeze
|
|
|
|
}
|
|
|
|
|
|
|
|
TkCore::INTERP.init_ip_env{
|
|
|
|
ComponentID_TBL.mutex.synchronize{ ComponentID_TBL.clear }
|
|
|
|
}
|
2004-07-08 12:50:07 -04:00
|
|
|
|
|
|
|
def self.id2obj(master, id)
|
2004-10-11 00:51:21 -04:00
|
|
|
if master.kind_of?(TkObject)
|
|
|
|
master = master.path
|
|
|
|
else
|
|
|
|
master = master.to_s
|
|
|
|
end
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
ComponentID_TBL.mutex.synchronize{
|
|
|
|
if ComponentID_TBL.key?(master)
|
|
|
|
(ComponentID_TBL[master].key?(id))? ComponentID_TBL[master][id]: id
|
|
|
|
else
|
|
|
|
id
|
|
|
|
end
|
|
|
|
}
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.new(master, component=nil)
|
2004-10-11 00:51:21 -04:00
|
|
|
if master.kind_of?(TkObject)
|
|
|
|
master = master.path
|
|
|
|
else
|
|
|
|
master = master.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
if component.kind_of?(Tk::Itk::Component)
|
|
|
|
component = component.name
|
|
|
|
elsif component
|
|
|
|
component = component.to_s
|
|
|
|
else
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
Itk_Component_ID.mutex.synchronize{
|
|
|
|
component = Itk_Component_ID.join(TkCore::INTERP._ip_id_)
|
|
|
|
Itk_Component_ID[1].succ!
|
|
|
|
}
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
ComponentID_TBL.mutex.synchronize{
|
|
|
|
if ComponentID_TBL.key?(master)
|
|
|
|
if ComponentID_TBL[master].key?(component)
|
2009-03-05 22:56:38 -05:00
|
|
|
return ComponentID_TBL[master][component]
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
ComponentID_TBL[master] = {}
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
}
|
2004-10-11 00:51:21 -04:00
|
|
|
|
|
|
|
super(master, component)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(master, component)
|
2004-10-11 00:51:21 -04:00
|
|
|
@master = master
|
|
|
|
@component = component
|
2004-07-08 12:50:07 -04:00
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
ComponentID_TBL.mutex.synchronize{
|
|
|
|
ComponentID_TBL[@master][@component] = self
|
|
|
|
}
|
2004-07-08 12:50:07 -04:00
|
|
|
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
@widget = nil
|
|
|
|
@path = nil
|
|
|
|
end
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def path
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @path
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@path
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def epath
|
2004-10-11 00:51:21 -04:00
|
|
|
path()
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_eval
|
2004-10-11 00:51:21 -04:00
|
|
|
path()
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def master
|
2004-10-11 00:51:21 -04:00
|
|
|
@master
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
2004-10-11 00:51:21 -04:00
|
|
|
@component
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def widget
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@widget
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def widget_class
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
@widget.classname
|
|
|
|
rescue
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(id, *args)
|
2004-10-11 00:51:21 -04:00
|
|
|
name = id.id2name
|
|
|
|
|
|
|
|
# try 1 : component command
|
|
|
|
begin
|
|
|
|
return tk_call(@master, 'component', @component, name, *args)
|
|
|
|
rescue
|
|
|
|
end
|
|
|
|
|
|
|
|
# try 2 : component configure
|
|
|
|
len = args.length
|
|
|
|
begin
|
|
|
|
case len
|
|
|
|
when 1
|
|
|
|
if name[-1] == ?=
|
|
|
|
return configure(name[0..-2], args[0])
|
|
|
|
else
|
|
|
|
return configure(name, args[0])
|
|
|
|
end
|
|
|
|
when 0
|
|
|
|
return cget(name)
|
|
|
|
end
|
|
|
|
rescue
|
|
|
|
end
|
|
|
|
|
|
|
|
# try 3 : widget method or widget configure
|
|
|
|
begin
|
|
|
|
unless @widget
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
end
|
|
|
|
@widget.__send__(id, *args)
|
|
|
|
rescue
|
|
|
|
end
|
|
|
|
|
|
|
|
# unknown method
|
2006-07-10 05:52:30 -04:00
|
|
|
super(id, *args)
|
|
|
|
# fail RuntimeError, "unknown method '#{name}' for #{self.inspect}"
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tk_send(cmd, *rest)
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
tk_call(@master, 'component', @component, cmd, *rest)
|
|
|
|
rescue
|
|
|
|
unless @path
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tk_call(@path, cmd, *rest)
|
|
|
|
end
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tk_send_without_enc(cmd, *rest)
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
tk_call_without_enc(@master, 'component', @component, cmd, *rest)
|
|
|
|
rescue
|
|
|
|
unless @path
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tk_call_without_enc(@path, cmd, *rest)
|
|
|
|
end
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tk_send_with_enc(cmd, *rest)
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
tk_call_with_enc(@master, 'component', @component, cmd, *rest)
|
|
|
|
rescue
|
|
|
|
unless @path
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tk_call_with_enc(@path, cmd, *rest)
|
|
|
|
end
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
2004-12-08 13:14:15 -05:00
|
|
|
#def bind(*args)
|
|
|
|
# unless @widget
|
|
|
|
# begin
|
|
|
|
# @widget = window(tk_call(@master, 'component', @component))
|
|
|
|
# @path = @widget.path
|
|
|
|
# rescue
|
|
|
|
# fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# @widget.bind(*args)
|
|
|
|
#end
|
|
|
|
def bind(context, *args)
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
2004-12-16 02:13:14 -05:00
|
|
|
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
2005-01-25 00:09:22 -05:00
|
|
|
if TkComm._callback_entry?(args[0]) || !block_given?
|
2004-12-08 13:14:15 -05:00
|
|
|
cmd = args.shift
|
|
|
|
else
|
|
|
|
cmd = Proc.new
|
|
|
|
end
|
|
|
|
@widget.bind(context, cmd, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
#def bind_append(*args)
|
|
|
|
# unless @widget
|
|
|
|
# begin
|
|
|
|
# @widget = window(tk_call(@master, 'component', @component))
|
|
|
|
# @path = @widget.path
|
|
|
|
# rescue
|
|
|
|
# fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# @widget.bind_append(*args)
|
|
|
|
#end
|
|
|
|
def bind_append(context, *args)
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
2004-12-16 02:13:14 -05:00
|
|
|
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
|
2005-01-25 00:09:22 -05:00
|
|
|
if TkComm._callback_entry?(args[0]) || !block_given?
|
2004-12-08 13:14:15 -05:00
|
|
|
cmd = args.shift
|
|
|
|
else
|
|
|
|
cmd = Proc.new
|
|
|
|
end
|
|
|
|
@widget.bind_append(context, cmd, *args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def bind_remove(*args)
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@widget.bind_remove(*args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def bindinfo(*args)
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @widget
|
|
|
|
begin
|
|
|
|
@widget = window(tk_call(@master, 'component', @component))
|
|
|
|
@path = @widget.path
|
|
|
|
rescue
|
|
|
|
fail RuntimeError, 'component is not assigned to a widget'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@widget.bindinfo(*args)
|
2004-07-08 12:50:07 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|