diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-27 18:44:31 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-27 18:44:31 +0000 |
commit | ee695fb164796dc203306f1585c4f6dd74f06806 (patch) | |
tree | 278f46cf1b6a9afafd3391af2b29e8a2ecf31dd4 /ext/tk/lib/tkextlib/tcllib | |
parent | 4dd9fd71b34cd21613404a2900085868dfac5cd4 (diff) |
* ext/tk/lib/tk.rb, ext/tk/lib/*: make default widget set
switchable between Tk (standard Tcl/Tk widget set) and
Ttk (Tile). Initial default widget set is Tk. Now, toplevel
widget classes are removed and defined as aliases.
For example, "TkButton" is an alias of the "Tk::Button" class.
Those aliases are replaced when switching default widget set.
"Tk.default_widget_set=" is the method for switching default
widget set. "Tk.default_widget_set = :Ttk" defines Ttk (Tile)
widget set as default. It means that "TkButton" denotes
"Tk::Tile::Button" class. And then, "TkButton.new" creates
a Tk::Tile::Button widget. Of course, you can back to use
standard Tk widgets as the default widget set by calling
"Tk.default_widget_set = :Tk", whenever you want. Based on
thie feature, you can use Ttk widget styling engine on your
old Ruby/Tk application without modifying its source, if you
don'tuse widget options unsupported on Ttk widgets (At first,
call "Tk.default_widget_set = :Ttk", and next load and run
your application).
This is one step for supporting Tcl/Tk8.5 features.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/tcllib')
-rw-r--r-- | ext/tk/lib/tkextlib/tcllib/autoscroll.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/tcllib/ctext.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/tcllib/datefield.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/tcllib/ip_entry.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/tcllib/plotchart.rb | 32 |
5 files changed, 20 insertions, 20 deletions
diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb index 6940a9174c..7db3c2e2b7 100644 --- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb +++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb @@ -108,7 +108,7 @@ module Tk end end -class TkScrollbar +class Tk::Scrollbar def autoscroll # Arranges for the already existing scrollbar to be mapped # and unmapped as needed. diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb index 70a45dd8e7..9014037f3d 100644 --- a/ext/tk/lib/tkextlib/tcllib/ctext.rb +++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb @@ -15,7 +15,7 @@ TkPackage.require('ctext') module Tk module Tcllib - class CText < TkText + class CText < Tk::Text PACKAGE_NAME = 'ctext'.freeze def self.package_name PACKAGE_NAME diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb index bd84488101..2244dd7a9a 100644 --- a/ext/tk/lib/tkextlib/tcllib/datefield.rb +++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb @@ -24,7 +24,7 @@ TkPackage.require('datefield') module Tk module Tcllib - class Datefield < TkEntry + class Datefield < Tk::Entry PACKAGE_NAME = 'datefield'.freeze def self.package_name PACKAGE_NAME diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb index 8c9e0bd683..c4b8240c04 100644 --- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb +++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb @@ -18,7 +18,7 @@ TkPackage.require('ipentry') module Tk module Tcllib - class IP_Entry < TkEntry + class IP_Entry < Tk::Entry PACKAGE_NAME = 'ipentry'.freeze def self.package_name PACKAGE_NAME diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb index f5f344ceb3..cde42c8a0a 100644 --- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb +++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb @@ -225,7 +225,7 @@ module Tk::Tcllib::Plotchart end ############################ - class XYPlot < TkCanvas + class XYPlot < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -247,7 +247,7 @@ module Tk::Tcllib::Plotchart @xaxis = args.shift @yaxis = args.shift - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -337,7 +337,7 @@ module Tk::Tcllib::Plotchart end ############################ - class PolarPlot < TkCanvas + class PolarPlot < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -356,7 +356,7 @@ module Tk::Tcllib::Plotchart @radius_data = args.shift - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -395,7 +395,7 @@ module Tk::Tcllib::Plotchart Polarplot = PolarPlot ############################ - class IsometricPlot < TkCanvas + class IsometricPlot < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -430,7 +430,7 @@ module Tk::Tcllib::Plotchart @stepsize = args.shift end - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -475,7 +475,7 @@ module Tk::Tcllib::Plotchart Isometricplot = IsometricPlot ############################ - class Plot3D < TkCanvas + class Plot3D < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -500,7 +500,7 @@ module Tk::Tcllib::Plotchart @yaxis = args.shift @zaxis = args.shift - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -557,7 +557,7 @@ module Tk::Tcllib::Plotchart end ############################ - class Piechart < TkCanvas + class Piechart < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -566,7 +566,7 @@ module Tk::Tcllib::Plotchart ].freeze def initialize(*args) # args := ([parent] [, keys]) - if args[0].kind_of?(TkCanvas) + if args[0].kind_of?(Tk::Canvas) parent = args.shift @path = parent.path else @@ -588,7 +588,7 @@ module Tk::Tcllib::Plotchart end ############################ - class Barchart < TkCanvas + class Barchart < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -626,7 +626,7 @@ module Tk::Tcllib::Plotchart @series_size = args.shift end - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -672,7 +672,7 @@ module Tk::Tcllib::Plotchart end ############################ - class Timechart < TkCanvas + class Timechart < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -699,7 +699,7 @@ module Tk::Tcllib::Plotchart @time_end = args.shift @items = args.shift - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget @@ -733,7 +733,7 @@ module Tk::Tcllib::Plotchart end ############################ - class Gnattchart < TkCanvas + class Gnattchart < Tk::Canvas include ChartMethod TkCommandNames = [ @@ -772,7 +772,7 @@ module Tk::Tcllib::Plotchart @text_width = None end - if parent.kind_of?(TkCanvas) + if parent.kind_of?(Tk::Canvas) @path = parent.path else super(parent, *args) # create canvas widget |