* ext/tk/lib/tk/scrollable.rb: divide Scrollable module into X_Scrollable
and Y_Scrollable * ext/tk/lib/tk/entry.rb: include X_Scrollable instead of Scrollable * ext/tk/lib/tk/autoload.rb: define autoload for X_Scrollable and Y_Scrollable git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ff814d4c37
commit
27425a52ba
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Fri Nov 5 18:12:42 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/scrollable.rb: divide Scrollable module into
|
||||||
|
X_Scrollable and Y_Scrollable
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/entry.rb: include X_Scrollable instead of Scrollable
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/autoload.rb: define autoload for X_Scrollable and
|
||||||
|
Y_Scrollable
|
||||||
|
|
||||||
Fri Nov 5 16:05:32 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Fri Nov 5 16:05:32 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tk.rb: TkComm._at() supprts both of "@x,y" and "@x"
|
* ext/tk/lib/tk.rb: TkComm._at() supprts both of "@x,y" and "@x"
|
||||||
|
@ -173,6 +173,8 @@ autoload :TkXIM, 'tk/xim'
|
|||||||
module Tk
|
module Tk
|
||||||
autoload :Clock, 'tk/clock'
|
autoload :Clock, 'tk/clock'
|
||||||
autoload :OptionObj, 'tk/optionobj'
|
autoload :OptionObj, 'tk/optionobj'
|
||||||
|
autoload :X_Scrollable, 'tk/scrollable'
|
||||||
|
autoload :Y_Scrollable, 'tk/scrollable'
|
||||||
autoload :Scrollable, 'tk/scrollable'
|
autoload :Scrollable, 'tk/scrollable'
|
||||||
autoload :Wm, 'tk/wm'
|
autoload :Wm, 'tk/wm'
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ require 'tk/scrollable'
|
|||||||
require 'tk/validation'
|
require 'tk/validation'
|
||||||
|
|
||||||
class TkEntry<TkLabel
|
class TkEntry<TkLabel
|
||||||
include Scrollable
|
include X_Scrollable
|
||||||
include TkValidation
|
include TkValidation
|
||||||
|
|
||||||
TkCommandNames = ['entry'.freeze].freeze
|
TkCommandNames = ['entry'.freeze].freeze
|
||||||
|
@ -4,17 +4,12 @@
|
|||||||
require 'tk'
|
require 'tk'
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
module Scrollable
|
module X_Scrollable
|
||||||
def xscrollcommand(cmd=Proc.new)
|
def xscrollcommand(cmd=Proc.new)
|
||||||
configure_cmd 'xscrollcommand', cmd
|
configure_cmd 'xscrollcommand', cmd
|
||||||
# Tk.update # avoid scrollbar trouble
|
# Tk.update # avoid scrollbar trouble
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
def yscrollcommand(cmd=Proc.new)
|
|
||||||
configure_cmd 'yscrollcommand', cmd
|
|
||||||
# Tk.update # avoid scrollbar trouble
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
def xview(*index)
|
def xview(*index)
|
||||||
if index.size == 0
|
if index.size == 0
|
||||||
@ -31,6 +26,25 @@ module Tk
|
|||||||
xview('scroll', *index)
|
xview('scroll', *index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def xscrollbar(bar=nil)
|
||||||
|
if bar
|
||||||
|
@xscrollbar = bar
|
||||||
|
@xscrollbar.orient 'horizontal'
|
||||||
|
self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
|
||||||
|
@xscrollbar.command {|*arg| self.xview(*arg)}
|
||||||
|
Tk.update # avoid scrollbar trouble
|
||||||
|
end
|
||||||
|
@xscrollbar
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Y_Scrollable
|
||||||
|
def yscrollcommand(cmd=Proc.new)
|
||||||
|
configure_cmd 'yscrollcommand', cmd
|
||||||
|
# Tk.update # avoid scrollbar trouble
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
def yview(*index)
|
def yview(*index)
|
||||||
if index.size == 0
|
if index.size == 0
|
||||||
list(tk_send_without_enc('yview'))
|
list(tk_send_without_enc('yview'))
|
||||||
@ -46,16 +60,6 @@ module Tk
|
|||||||
yview('scroll', *index)
|
yview('scroll', *index)
|
||||||
end
|
end
|
||||||
|
|
||||||
def xscrollbar(bar=nil)
|
|
||||||
if bar
|
|
||||||
@xscrollbar = bar
|
|
||||||
@xscrollbar.orient 'horizontal'
|
|
||||||
self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
|
|
||||||
@xscrollbar.command {|*arg| self.xview(*arg)}
|
|
||||||
Tk.update # avoid scrollbar trouble
|
|
||||||
end
|
|
||||||
@xscrollbar
|
|
||||||
end
|
|
||||||
def yscrollbar(bar=nil)
|
def yscrollbar(bar=nil)
|
||||||
if bar
|
if bar
|
||||||
@yscrollbar = bar
|
@yscrollbar = bar
|
||||||
@ -67,4 +71,9 @@ module Tk
|
|||||||
@yscrollbar
|
@yscrollbar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Scrollable
|
||||||
|
include X_Scrollable
|
||||||
|
include Y_Scrollable
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user