diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-22 22:17:08 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-22 22:17:08 +0000 |
commit | 3dd3b2136b0050c669d0881ae804b1fae8ea6567 (patch) | |
tree | c2a856bc39c824fe9c2a549d412935b568340956 /ext/tk/lib/tkextlib/tile.rb | |
parent | d6837060becd0cb4586eca08515fc4ee6c8bb2f0 (diff) | |
download | ruby-3dd3b2136b0050c669d0881ae804b1fae8ea6567.tar.gz |
* 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
Diffstat (limited to 'ext/tk/lib/tkextlib/tile.rb')
-rw-r--r-- | ext/tk/lib/tkextlib/tile.rb | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 3296b62517..de079ca53d 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -20,14 +20,24 @@ if ver[0].to_i == 0 && ver[1].to_i <= 4 # version 0.4 or former module Tk module Tile - USE_TTK_NAMESPACE = false + USE_TILE_NAMESPACE = true + TILE_SPEC_VERSION_ID = 0 + end + end +elsif ver[0].to_i == 0 && ver[1].to_i <= 6 + # version 0.5 -- version 0.6 + module Tk + module Tile + USE_TILE_NAMESPACE = true + TILE_SPEC_VERSION_ID = 5 end end else - # version 0.5 or later + # version 0.7 or later module Tk module Tile - USE_TTK_NAMESPACE = true + USE_TILE_NAMESPACE = false + TILE_SPEC_VERSION_ID = 7 end end end @@ -50,6 +60,10 @@ module Tk end end + def self.__Import_Tile_Widgets__! + Tk.tk_call('namespace', 'import', 'ttk::*') + end + def self.load_images(imgdir, pat=TkComm::None) images = Hash[*TkComm.simplelist(Tk.tk_call('::tile::LoadImages', imgdir, pat))] @@ -87,7 +101,42 @@ module Tk Icon = 'TkIconFont' end + module ParseStyleLayout + def _style_layout(lst) + ret = [] + until lst.empty? + sub = [lst.shift] + keys = {} + + until lst.empty? + if lst[0][0] == ?- + k = lst.shift[1..-1] + children = lst.shift + children = _style_layout(children) if children.kind_of?(Array) + keys[k] = children + else + break + end + end + + sub << keys unless keys.empty? + ret << sub + end + ret + end + private :_style_layout + end + module TileWidget + include Tk::Tile::ParseStyleLayout + + def __val2ruby_optkeys # { key=>proc, ... } + # The method is used to convert a opt-value to a ruby's object. + # When get the value of the option "key", "proc.call(value)" is called. + super().update('style'=>proc{|v| _style_layout(list(v))}) + end + private :__val2ruby_optkeys + def instate(state, script=nil, &b) if script tk_send('instate', state, script) @@ -117,6 +166,8 @@ module Tk autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton' autoload :Checkbutton, 'tkextlib/tile/tcheckbutton' + autoload :Dialog, 'tkextlib/tile/dialog' + autoload :TEntry, 'tkextlib/tile/tentry' autoload :Entry, 'tkextlib/tile/tentry' |