summaryrefslogtreecommitdiff
path: root/ext/tk
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-05 09:15:18 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-05 09:15:18 +0000
commit27425a52ba53d99551b2fd0d8dae672f3f423e64 (patch)
treeab78b764f6cd5f69fdac7d165aec39915dbd8781 /ext/tk
parentff814d4c375e19d246b29ce738c69fca9c3fdbe3 (diff)
* 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
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/lib/tk/autoload.rb2
-rw-r--r--ext/tk/lib/tk/entry.rb2
-rw-r--r--ext/tk/lib/tk/scrollable.rb41
3 files changed, 28 insertions, 17 deletions
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index bccd6c4c61..3006b559d6 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -173,6 +173,8 @@ autoload :TkXIM, 'tk/xim'
module Tk
autoload :Clock, 'tk/clock'
autoload :OptionObj, 'tk/optionobj'
+ autoload :X_Scrollable, 'tk/scrollable'
+ autoload :Y_Scrollable, 'tk/scrollable'
autoload :Scrollable, 'tk/scrollable'
autoload :Wm, 'tk/wm'
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index 2a8a9d413c..a3c0e51cdd 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -9,7 +9,7 @@ require 'tk/scrollable'
require 'tk/validation'
class TkEntry<TkLabel
- include Scrollable
+ include X_Scrollable
include TkValidation
TkCommandNames = ['entry'.freeze].freeze
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
index 74816a9228..ec27b76467 100644
--- a/ext/tk/lib/tk/scrollable.rb
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -4,17 +4,12 @@
require 'tk'
module Tk
- module Scrollable
+ module X_Scrollable
def xscrollcommand(cmd=Proc.new)
configure_cmd 'xscrollcommand', cmd
# Tk.update # avoid scrollbar trouble
self
end
- def yscrollcommand(cmd=Proc.new)
- configure_cmd 'yscrollcommand', cmd
- # Tk.update # avoid scrollbar trouble
- self
- end
def xview(*index)
if index.size == 0
@@ -31,6 +26,25 @@ module Tk
xview('scroll', *index)
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)
if index.size == 0
list(tk_send_without_enc('yview'))
@@ -46,16 +60,6 @@ module Tk
yview('scroll', *index)
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)
if bar
@yscrollbar = bar
@@ -67,4 +71,9 @@ module Tk
@yscrollbar
end
end
+
+ module Scrollable
+ include X_Scrollable
+ include Y_Scrollable
+ end
end