* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,

ext/tk/sample/ttk_wrapper.rb: improve treating and control themes. 
  add Tk::Tile.themes and Tk::Tile.set_theme(theme).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2008-05-03 13:52:47 +00:00
parent 7542aa5b39
commit 8f5ddf723f
4 changed files with 73 additions and 27 deletions

View file

@ -201,6 +201,38 @@ module Tk
args.map!{|arg| TkComm._get_eval_string(arg)}.join('.')
end
def self.themes(glob_ptn = nil)
if TILE_SPEC_VERSION_ID < 8 && Tk.info(:commands, '::ttk::themes').empty?
fail RuntimeError, 'not support glob option' if glob_ptn
cmd = ['::tile::availableThemes']
else
glob_ptn = '*' unless glob_ptn
cmd = ['::ttk::themes', glob_ptn]
end
begin
TkComm.simplelist(Tk.tk_call_without_enc(*cmd))
rescue
TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline',
Tk::Tile::Style.theme_names,
glob_ptn))
end
end
def self.set_theme(theme)
if TILE_SPEC_VERSION_ID < 8 && Tk.info(:commands, '::ttk::setTheme').empty?
cmd = '::tile::setTheme'
else
cmd = '::ttk::setTheme'
end
begin
Tk.tk_call_without_enc(cmd, theme)
rescue
Tk::Tile::Style.theme_use(theme)
end
end
module KeyNav
if Tk::Tile::TILE_SPEC_VERSION_ID < 8
def self.enableMnemonics(w)