summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/tk/lib/tkextlib/tile
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/tk/lib/tkextlib/tile
Fresh start
Diffstat (limited to 'jni/ruby/ext/tk/lib/tkextlib/tile')
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/dialog.rb102
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/setup.rb8
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/sizegrip.rb32
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/style.rb336
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tbutton.rb34
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tcheckbutton.rb38
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tcombobox.rb55
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tentry.rb49
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tframe.rb34
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tlabel.rb34
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tlabelframe.rb38
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tmenubutton.rb38
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tnotebook.rb147
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tpaned.rb245
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tprogressbar.rb57
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tradiobutton.rb38
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/treeview.rb1336
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tscale.rb56
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tscrollbar.rb63
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tseparator.rb34
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tspinbox.rb107
-rw-r--r--jni/ruby/ext/tk/lib/tkextlib/tile/tsquare.rb30
22 files changed, 2911 insertions, 0 deletions
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/dialog.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/dialog.rb
new file mode 100644
index 0000000..b112e61
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/dialog.rb
@@ -0,0 +1,102 @@
+#
+# ttk::dialog (tile-0.7+)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class Dialog < TkWindow
+ end
+ end
+end
+
+begin
+ TkPackage.require('ttk::dialog') # this may be required.
+rescue RuntimeError
+ # ignore
+end
+
+class Tk::Tile::Dialog
+ TkCommandNames = ['::ttk::dialog'.freeze].freeze
+
+ def self.show(*args)
+ dialog = self.new(*args)
+ dialog.show
+ [dialog.status, dialog.value]
+ end
+ def self.display(*args)
+ self.show(*args)
+ end
+
+ def self.define_dialog_type(name, keys)
+ Tk.tk_call('::ttk::dialog::define', name, keys)
+ name
+ end
+
+ def self.style(*args)
+ ['Dialog', *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ #########################
+
+ def initialize(keys={})
+ @keys = _symbolkey2str(keys)
+ super(*args)
+ end
+
+ def create_self(keys)
+ # dummy
+ end
+ private :create_self
+
+ def show
+ tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))
+ end
+ alias display show
+
+ def client_frame
+ window(tk_call_without_enc('::ttk::dialog::clientframe', @path))
+ end
+
+ def cget_strict(slot)
+ @keys[slot.to_s]
+ end
+ def cget(slot)
+ @keys[slot.to_s]
+ end
+=begin
+ def cget(slot)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(slot)
+ else
+ cget_strict(slot) rescue nil
+ end
+ end
+=end
+
+ def configure(slot, value=None)
+ if slot.kind_of?(Hash)
+ slot.each{|k, v| configure(k, v)}
+ else
+ slot = slot.to_s
+ value = _symbolkey2str(value) if value.kind_of?(Hash)
+ if value && value != None
+ @keys[slot] = value
+ else
+ @keys.delete(slot)
+ end
+ end
+ self
+ end
+
+ def configinfo(slot = nil)
+ if slot
+ slot = slot.to_s
+ [ slot, nil, nil, nil, @keys[slot] ]
+ else
+ @keys.collect{|k, v| [ k, nil, nil, nil, v ] }
+ end
+ end
+end
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/setup.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/setup.rb
new file mode 100644
index 0000000..ee406c6
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/setup.rb
@@ -0,0 +1,8 @@
+#
+# setup.rb -- setup script before calling TkPackage.require()
+#
+# If you need some setup operations (for example, add a library path
+# to the library search path) before using Tcl/Tk library packages
+# wrapped by Ruby scripts in this directory, please write the setup
+# operations in this file.
+#
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/sizegrip.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/sizegrip.rb
new file mode 100644
index 0000000..9947e0d
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/sizegrip.rb
@@ -0,0 +1,32 @@
+#
+# ttk::sizegrip widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class SizeGrip < TkWindow
+ end
+ Sizegrip = SizeGrip
+ end
+end
+
+class Tk::Tile::SizeGrip < TkWindow
+ include Tk::Tile::TileWidget
+
+ TkCommandNames = ['::ttk::sizegrip'.freeze].freeze
+ WidgetClassName = 'TSizegrip'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip,
+# :TkSizegrip, :TkSizeGrip)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/sizegrip.rb',
+ :Ttk, Tk::Tile::Sizegrip,
+ :TkSizegrip, :TkSizeGrip)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/style.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/style.rb
new file mode 100644
index 0000000..83a0c9a
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/style.rb
@@ -0,0 +1,336 @@
+#
+# style commands
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ module Style
+ end
+ end
+end
+
+module Tk::Tile::Style
+ extend TkCore
+end
+
+class << Tk::Tile::Style
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 8
+ TkCommandNames = ['style'.freeze].freeze
+
+ # --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! ---
+ # On Ttk (Tile) extension, 'style' command has incompatible changes
+ # depend on the version of the extension. It requires modifying the
+ # Tcl/Tk scripts to define local styles. The rule for modification
+ # is a simple one. But, if users want to keep compatibility between
+ # versions of the extension, they will have to contrive to do that.
+ # It may be troublesome, especially for Ruby/Tk users.
+ # This method may help such work. This method make some definitions
+ # on the Tcl/Tk interpreter to work with different version of style
+ # command format. Please give attention to use this method. It may
+ # conflict with some definitions on Tcl/Tk scripts.
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 7
+ def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
+ unless Tk.info(:commands, '::ttk::style').empty?
+ # fail RuntimeError,
+ # "can't define '::ttk::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::ttk::style' command (already exist)" if $DEBUG
+ return
+ end
+ TkCore::INTERP.add_tk_procs('::ttk::style', 'args', <<-'EOS')
+ if [string equal [lrange $args 0 1] {element create}] {
+ if [string equal [lindex $args 3] image] {
+ set spec [lindex $args 4]
+ set map [lrange $spec 1 end]
+ if [llength $map] {
+ # return [eval [concat [list ::style element create [lindex $args 2] image [lindex $spec 0] -map $map] [lrange $args 5 end]]]
+ return [uplevel 1 [list ::style element create [lindex $args 2] image [lindex $spec 0] -map $map] [lrange $args 5 end]]
+ }
+ }
+ }
+ # return [eval "::style $args"]
+ return [uplevel 1 ::style $args]
+ EOS
+ #########################
+ end
+ else ### TILE_SPEC_VERSION_ID == 7
+ def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
+ unless Tk.info(:commands, '::ttk::style').empty?
+ # fail RuntimeError,
+ # "can't define '::ttk::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::ttk::style' command (already exist)" if $DEBUG
+ return
+ end
+ TkCore::INTERP.add_tk_procs('::ttk::style', 'args', <<-'EOS')
+ if [string equal [lrange $args 0 1] {element create}] {
+ if [string equal [lindex $args 3] image] {
+ set spec [lindex $args 4]
+ set map [lrange $spec 1 end]
+ if [llength $map] {
+ # return [eval [concat [list ::style element create [lindex $args 2] image [lindex $spec 0] -map $map] [lrange $args 5 end]]]
+ return [uplevel 1 [list ::style element create [lindex $args 2] image [lindex $spec 0] -map $map] [lrange $args 5 end]]]
+ }
+ }
+ } elseif [string equal [lindex $args 0] default] {
+ # return [eval "::style [lreplace $args 0 0 configure]"]
+ return [uplevel 1 ::style [lreplace $args 0 0 configure]]
+ }
+ # return [eval "::style $args"]
+ return [uplevel 1 ::style $args]
+ EOS
+ #########################
+ end
+ end
+ else ### TILE_SPEC_VERSION_ID >= 8
+ TkCommandNames = ['::ttk::style'.freeze].freeze
+
+ def __define_wrapper_proc_for_compatibility__!
+ __define_themes_and_setTheme_proc__!
+
+ unless Tk.info(:commands, '::style').empty?
+ # fail RuntimeError, "can't define '::style' command (already exist)"
+
+ # do nothing !!!
+ warn "Warning: can't define '::style' command (already exist)" if $DEBUG
+ return
+ end
+ TkCore::INTERP.add_tk_procs('::style', 'args', <<-'EOS')
+ if [string equal [lrange $args 0 1] {element create}] {
+ if [string equal [lindex $args 3] image] {
+ set name [lindex $args 4]
+ set opts [lrange $args 5 end]
+ set idx [lsearch $opts -map]
+ if {$idx >= 0 && [expr $idx % 2 == 0]} {
+ # return [eval [concat [list ::ttk::style element create [lindex $args 2] image [concat $name [lindex $opts [expr $idx + 1]]]] [lreplace $opts $idx [expr $idx + 1]]]]
+ return [uplevel 1 [list ::ttk::style element create [lindex $args 2] image [concat $name [lindex $opts [expr $idx + 1]]]] [lreplace $opts $idx [expr $idx + 1]]]
+ }
+ }
+ } elseif [string equal [lindex $args 0] default] {
+ # return [eval "::ttk::style [lreplace $args 0 0 configure]"]
+ return [uplevel 1 ::ttk::style [lreplace $args 0 0 configure]]
+ }
+ # return [eval "::ttk::style $args"]
+ return [uplevel 1 ::ttk::style $args]
+ EOS
+ #########################
+ end
+ end
+
+ def __define_themes_and_setTheme_proc__!
+ TkCore::INTERP.add_tk_procs('::ttk::themes', '{ptn *}', <<-'EOS')
+ #set themes [list]
+ set themes [::ttk::style theme names]
+ foreach pkg [lsearch -inline -all -glob [package names] ttk::theme::$ptn] {
+ set theme [namespace tail $pkg]
+ if {[lsearch -exact $themes $theme] < 0} {
+ lappend themes $theme
+ }
+ }
+ foreach pkg [lsearch -inline -all -glob [package names] tile::theme::$ptn] {
+ set theme [namespace tail $pkg]
+ if {[lsearch -exact $themes $theme] < 0} {
+ lappend themes $theme
+ }
+ }
+ return $themes
+ EOS
+ #########################
+ TkCore::INTERP.add_tk_procs('::ttk::setTheme', 'theme', <<-'EOS')
+ variable currentTheme
+ if {[lsearch -exact [::ttk::style theme names] $theme] < 0} {
+ package require [lsearch -inline -regexp [package names] (ttk|tile)::theme::$theme]
+ }
+ ::ttk::style theme use $theme
+ set currentTheme $theme
+ EOS
+ end
+ private :__define_themes_and_setTheme_proc__!
+
+ def configure(style=nil, keys=nil)
+ if style.kind_of?(Hash)
+ keys = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 7
+ sub_cmd = 'default'
+ else
+ sub_cmd = 'configure'
+ end
+
+ if keys && keys != None
+ tk_call(TkCommandNames[0], sub_cmd, style, *hash_kv(keys))
+ else
+ tk_call(TkCommandNames[0], sub_cmd, style)
+ end
+ end
+ alias default configure
+
+ def map(style=nil, keys=nil)
+ if style.kind_of?(Hash)
+ keys = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if keys && keys != None
+ if keys.kind_of?(Hash)
+ tk_call(TkCommandNames[0], 'map', style, *hash_kv(keys))
+ else
+ simplelist(tk_call(TkCommandNames[0], 'map', style, '-' << keys.to_s))
+ end
+ else
+ ret = {}
+ Hash[*(simplelist(tk_call(TkCommandNames[0], 'map', style)))].each{|k, v|
+ ret[k[1..-1]] = list(v)
+ }
+ ret
+ end
+ end
+ alias map_configure map
+
+ def map_configinfo(style=nil, key=None)
+ style = '.' unless style
+ map(style, key)
+ end
+
+ def map_default_configinfo(key=None)
+ map('.', key)
+ end
+
+ def lookup(style, opt, state=None, fallback_value=None)
+ tk_call(TkCommandNames[0], 'lookup', style,
+ '-' << opt.to_s, state, fallback_value)
+ end
+
+ include Tk::Tile::ParseStyleLayout
+
+ def layout(style=nil, spec=nil)
+ if style.kind_of?(Hash)
+ spec = style
+ style = nil
+ end
+ style = '.' unless style
+
+ if spec
+ tk_call(TkCommandNames[0], 'layout', style, spec)
+ else
+ _style_layout(list(tk_call(TkCommandNames[0], 'layout', style)))
+ end
+ end
+
+ def element_create(name, type, *args)
+ if type == 'image' || type == :image
+ element_create_image(name, *args)
+ elsif type == 'vsapi' || type == :vsapi
+ element_create_vsapi(name, *args)
+ else
+ tk_call(TkCommandNames[0], 'element', 'create', name, type, *args)
+ end
+ end
+
+ def element_create_image(name, *args)
+ fail ArgumentError, 'Must supply a base image' unless (spec = args.shift)
+ if (opts = args.shift)
+ if opts.kind_of?(Hash)
+ opts = _symbolkey2str(opts)
+ else
+ fail ArgumentError, 'bad option'
+ end
+ end
+ fail ArgumentError, 'too many arguments' unless args.empty?
+
+ if spec.kind_of?(Array)
+ # probably, command format is tile 0.8+ (Tcl/Tk8.5+) style
+ if Tk::Tile::TILE_SPEC_VERSION_ID >= 8
+ if opts
+ tk_call(TkCommandNames[0],
+ 'element', 'create', name, 'image', spec, opts)
+ else
+ tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
+ end
+ else
+ fail ArgumentError, 'illegal arguments' if opts.key?('map')
+ base = spec.shift
+ opts['map'] = spec
+ tk_call(TkCommandNames[0],
+ 'element', 'create', name, 'image', base, opts)
+ end
+ else
+ # probably, command format is tile 0.7.8 or older style
+ if Tk::Tile::TILE_SPEC_VERSION_ID >= 8
+ spec = [spec, *(opts.delete('map'))] if opts.key?('map')
+ end
+ if opts
+ tk_call(TkCommandNames[0],
+ 'element', 'create', name, 'image', spec, opts)
+ else
+ tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec)
+ end
+ end
+ end
+
+ def element_create_vsapi(name, class_name, part_id, *args)
+ # supported on Tcl/Tk 8.6 or later
+
+ # argument check
+ if (state_map = args.shift || None)
+ if state_map.kind_of?(Hash)
+ opts = _symbolkey2str(state_map)
+ state_map = None
+ end
+ end
+ opts = args.shift || None
+ fail ArgumentError, "too many arguments" unless args.empty?
+
+ # define a Microsoft Visual Styles element
+ tk_call(TkCommandNames[0], 'element', 'create', name, 'vsapi',
+ class_name, part_id, state_map, opts)
+ end
+
+ def element_names()
+ list(tk_call(TkCommandNames[0], 'element', 'names'))
+ end
+
+ def element_options(elem)
+ simplelist(tk_call(TkCommandNames[0], 'element', 'options', elem))
+ end
+
+ def theme_create(name, keys=nil)
+ name = name.to_s
+ if keys && keys != None
+ tk_call(TkCommandNames[0], 'theme', 'create', name, *hash_kv(keys))
+ else
+ tk_call(TkCommandNames[0], 'theme', 'create', name)
+ end
+ name
+ end
+
+ def theme_settings(name, cmd=nil, &b)
+ name = name.to_s
+ cmd = Proc.new(&b) if !cmd && b
+ tk_call(TkCommandNames[0], 'theme', 'settings', name, cmd)
+ name
+ end
+
+ def theme_names()
+ list(tk_call(TkCommandNames[0], 'theme', 'names'))
+ end
+
+ def theme_use(name)
+ name = name.to_s
+ tk_call(TkCommandNames[0], 'theme', 'use', name)
+ name
+ end
+end
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tbutton.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tbutton.rb
new file mode 100644
index 0000000..c852024
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tbutton.rb
@@ -0,0 +1,34 @@
+#
+# tbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TButton < Tk::Button
+ end
+ Button = TButton
+ end
+end
+
+class Tk::Tile::TButton < Tk::Button
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::button'.freeze].freeze
+ else
+ TkCommandNames = ['::tbutton'.freeze].freeze
+ end
+ WidgetClassName = 'TButton'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tbutton.rb',
+ :Ttk, Tk::Tile::Button, :TkButton)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
new file mode 100644
index 0000000..01751ed
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tcheckbutton.rb
@@ -0,0 +1,38 @@
+#
+# tcheckbutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TCheckButton < Tk::CheckButton
+ end
+ TCheckbutton = TCheckButton
+ CheckButton = TCheckButton
+ Checkbutton = TCheckButton
+ end
+end
+
+class Tk::Tile::TCheckButton < Tk::CheckButton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::checkbutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tcheckbutton'.freeze].freeze
+ end
+ WidgetClassName = 'TCheckbutton'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton,
+# :TkCheckbutton, :TkCheckButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcheckbutton.rb',
+ :Ttk, Tk::Tile::Checkbutton,
+ :TkCheckbutton, :TkCheckButton)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tcombobox.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tcombobox.rb
new file mode 100644
index 0000000..b5ab827
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tcombobox.rb
@@ -0,0 +1,55 @@
+#
+# tcombobox widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TCombobox < Tk::Tile::TEntry
+ end
+ Combobox = TCombobox
+ end
+end
+
+class Tk::Tile::TCombobox < Tk::Tile::TEntry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::combobox'.freeze].freeze
+ else
+ TkCommandNames = ['::tcombobox'.freeze].freeze
+ end
+ WidgetClassName = 'TCombobox'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def __boolval_optkeys
+ super() << 'exportselection'
+ end
+ private :__boolval_optkeys
+
+ def __listval_optkeys
+ super() << 'values'
+ end
+ private :__listval_optkeys
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def current
+ number(tk_send_without_enc('current'))
+ end
+ def current=(idx)
+ tk_send_without_enc('current', idx)
+ end
+
+ def set(val)
+ tk_send('set', val)
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcombobox.rb',
+ :Ttk, Tk::Tile::Combobox, :TkCombobox)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tentry.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tentry.rb
new file mode 100644
index 0000000..8d2633a
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tentry.rb
@@ -0,0 +1,49 @@
+#
+# tentry widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TEntry < Tk::Entry
+ end
+ Entry = TEntry
+ end
+end
+
+class Tk::Tile::TEntry < Tk::Entry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::entry'.freeze].freeze
+ else
+ TkCommandNames = ['::tentry'.freeze].freeze
+ end
+ WidgetClassName = 'TEntry'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def __optkey_aliases
+ {:vcmd=>:validatecommand, :invcmd=>:invalidcommand}
+ end
+ private :__optkey_aliases
+
+ def __boolval_optkeys
+ super() << 'exportselection'
+ end
+ private :__boolval_optkeys
+
+ def __strval_optkeys
+ super() << 'show'
+ end
+ private :__strval_optkeys
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tentry.rb',
+ :Ttk, Tk::Tile::Entry, :TkEntry)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tframe.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tframe.rb
new file mode 100644
index 0000000..d6d4312
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tframe.rb
@@ -0,0 +1,34 @@
+#
+# tframe widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TFrame < Tk::Frame
+ end
+ Frame = TFrame
+ end
+end
+
+class Tk::Tile::TFrame < Tk::Frame
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::frame'.freeze].freeze
+ else
+ TkCommandNames = ['::tframe'.freeze].freeze
+ end
+ WidgetClassName = 'TFrame'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tframe.rb',
+ :Ttk, Tk::Tile::Frame, :TkFrame)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tlabel.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tlabel.rb
new file mode 100644
index 0000000..55b98ac
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tlabel.rb
@@ -0,0 +1,34 @@
+#
+# tlabel widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TLabel < Tk::Label
+ end
+ Label = TLabel
+ end
+end
+
+class Tk::Tile::TLabel < Tk::Label
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::label'.freeze].freeze
+ else
+ TkCommandNames = ['::tlabel'.freeze].freeze
+ end
+ WidgetClassName = 'TLabel'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabel.rb',
+ :Ttk, Tk::Tile::Label, :TkLabel)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tlabelframe.rb
new file mode 100644
index 0000000..a34c985
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tlabelframe.rb
@@ -0,0 +1,38 @@
+#
+# tlabelframe widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TLabelframe < Tk::Tile::TFrame
+ end
+ TLabelFrame = TLabelframe
+ Labelframe = TLabelframe
+ LabelFrame = TLabelframe
+ end
+end
+
+class Tk::Tile::TLabelframe < Tk::Tile::TFrame
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::labelframe'.freeze].freeze
+ else
+ TkCommandNames = ['::tlabelframe'.freeze].freeze
+ end
+ WidgetClassName = 'TLabelframe'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe,
+# :TkLabelframe, :TkLabelFrame)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabelframe.rb',
+ :Ttk, Tk::Tile::Labelframe,
+ :TkLabelframe, :TkLabelFrame)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tmenubutton.rb
new file mode 100644
index 0000000..1cf553e
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tmenubutton.rb
@@ -0,0 +1,38 @@
+#
+# tmenubutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TMenubutton < Tk::Menubutton
+ end
+ TMenuButton = TMenubutton
+ Menubutton = TMenubutton
+ MenuButton = TMenubutton
+ end
+end
+
+class Tk::Tile::TMenubutton < Tk::Menubutton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::menubutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tmenubutton'.freeze].freeze
+ end
+ WidgetClassName = 'TMenubutton'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton,
+# :TkMenubutton, :TkMenuButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tmenubutton.rb',
+ :Ttk, Tk::Tile::Menubutton,
+ :TkMenubutton, :TkMenuButton)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tnotebook.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tnotebook.rb
new file mode 100644
index 0000000..9e27e2c
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tnotebook.rb
@@ -0,0 +1,147 @@
+#
+# tnotebook widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TNotebook < TkWindow
+ end
+ Notebook = TNotebook
+ end
+end
+
+class Tk::Tile::TNotebook < TkWindow
+ ################################
+ include TkItemConfigMethod
+
+ def __item_cget_cmd(id)
+ [self.path, 'tab', id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, 'tab', id]
+ end
+ private :__item_config_cmd
+
+ def __item_listval_optkeys(id)
+ []
+ end
+ private :__item_listval_optkeys
+
+ def __item_methodcall_optkeys(id) # { key=>method, ... }
+ {}
+ end
+ private :__item_methodcall_optkeys
+
+ #alias tabcget itemcget
+ #alias tabcget_strict itemcget_strict
+ alias tabconfigure itemconfigure
+ alias tabconfiginfo itemconfiginfo
+ alias current_tabconfiginfo current_itemconfiginfo
+
+ def tabcget_tkstring(tagOrId, option)
+ tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{option}")), false, true)[-1]
+ end
+ def tabcget_strict(tagOrId, option)
+ tabconfiginfo(tagOrId, option)[-1]
+ end
+ def tabcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ tabcget_strict(tagOrId, option)
+ else
+ begin
+ tabcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_tabconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+ ################################
+
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::notebook'.freeze].freeze
+ else
+ TkCommandNames = ['::tnotebook'.freeze].freeze
+ end
+ WidgetClassName = 'TNotebook'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def enable_traversal()
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::enableNotebookTraversal', @path)
+ elsif Tk::Tile::TILE_SPEC_VERSION_ID < 7
+ tk_call_without_enc('::tile::notebook::enableTraversal', @path)
+ else
+ tk_call_without_enc('::ttk::notebook::enableTraversal', @path)
+ end
+ self
+ end
+
+ def add(child, keys=nil)
+ if keys && keys != None
+ tk_send('add', _epath(child), *hash_kv(keys))
+ else
+ tk_send('add', _epath(child))
+ end
+ self
+ end
+
+ def forget(idx)
+ tk_send('forget', idx)
+ self
+ end
+
+ def hide(idx)
+ tk_send('hide', idx)
+ end
+
+ def index(idx)
+ number(tk_send('index', idx))
+ end
+
+ def insert(idx, subwin, keys=nil)
+ if keys && keys != None
+ tk_send('insert', idx, subwin, *hash_kv(keys))
+ else
+ tk_send('insert', idx, subwin)
+ end
+ self
+ end
+
+ def select(idx)
+ tk_send('select', idx)
+ self
+ end
+
+ def selected
+ window(tk_send_without_enc('select'))
+ end
+
+ def tabs
+ list(tk_send('tabs'))
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tnotebook.rb',
+ :Ttk, Tk::Tile::Notebook, :TkNotebook)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tpaned.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tpaned.rb
new file mode 100644
index 0000000..d6ad234
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tpaned.rb
@@ -0,0 +1,245 @@
+#
+# tpaned widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TPaned < TkWindow
+ end
+ PanedWindow = Panedwindow = Paned = TPaned
+ end
+end
+
+class Tk::Tile::TPaned < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 8
+ TkCommandNames = ['::ttk::paned'.freeze].freeze
+ else
+ TkCommandNames = ['::ttk::panedwindow'.freeze].freeze
+ end
+ else
+ TkCommandNames = ['::tpaned'.freeze].freeze
+ end
+ WidgetClassName = 'TPaned'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def add(*args)
+ keys = args.pop
+ fail ArgumentError, "no window in arguments" unless keys
+
+ if keys && keys.kind_of?(Hash)
+ fail ArgumentError, "no window in arguments" if args == []
+ opts = hash_kv(keys)
+ else
+ args.push(keys) if keys
+ opts = []
+ end
+
+ args.each{|win|
+ tk_send_without_enc('add', _epath(win), *opts)
+ }
+ self
+ end
+
+ def forget(pane)
+ pane = _epath(pane)
+ tk_send_without_enc('forget', pane)
+ self
+ end
+
+ def insert(pos, win, keys)
+ win = _epath(win)
+ tk_send_without_enc('insert', pos, win, *hash_kv(keys))
+ self
+ end
+
+ def panecget_tkstring(pane, slot)
+ pane = _epath(pane)
+ tk_send_without_enc('pane', pane, "-#{slot}")
+ end
+ alias pane_cget_tkstring panecget_tkstring
+
+ def panecget_strict(pane, slot)
+ pane = _epath(pane)
+ tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}"))
+ end
+ alias pane_cget_strict panecget_strict
+
+ def panecget(pane, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ panecget_strict(pane, slot)
+ else
+ begin
+ panecget_strict(pane, slot)
+ rescue => e
+ begin
+ if current_paneconfiginfo(pane).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+ alias pane_cget panecget
+
+ def paneconfigure(pane, key, value=nil)
+ pane = _epath(pane)
+ if key.kind_of? Hash
+ params = []
+ key.each{|k, v|
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
+ }
+ tk_send_without_enc('pane', pane, *params)
+ else
+ # value = value.epath if value.kind_of?(TkObject)
+ value = _epath(value)
+ tk_send_without_enc('pane', pane, "-#{key}", value)
+ end
+ self
+ end
+ alias pane_config paneconfigure
+ alias pane_configure paneconfigure
+
+ def paneconfiginfo(win)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
+ conf[0] = conf[0][1..-1]
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ end
+ conf
+ else
+ tk_split_simplelist(tk_send_without_enc('pane',
+ win)).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ if conf[3]
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf[4]
+ if conf[0] == 'hide'
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ elsif conf[4].index('{')
+ conf[4] = tk_split_list(conf[4])
+ else
+ conf[4] = tk_tcl2ruby(conf[4])
+ end
+ end
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ win = _epath(win)
+ if key
+ conf = tk_split_list(tk_send_without_enc('pane', win, "-#{key}"))
+ key = conf.shift[1..-1]
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ end
+ { key => conf }
+ else
+ ret = {}
+ tk_split_simplelist(tk_send_without_enc('pane',
+ win)).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ if key
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ elsif conf[2].index('{')
+ conf[2] = tk_split_list(conf[2])
+ else
+ conf[2] = tk_tcl2ruby(conf[2])
+ end
+ end
+ if conf[3]
+ if key == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
+ conf[3] = tk_split_list(conf[3])
+ else
+ conf[3] = tk_tcl2ruby(conf[3])
+ end
+ end
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
+ end
+ end
+ end
+ alias pane_configinfo paneconfiginfo
+
+ def current_paneconfiginfo(win, key=nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if key
+ conf = paneconfiginfo(win, key)
+ {conf[0] => conf[4]}
+ else
+ ret = {}
+ paneconfiginfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ paneconfiginfo(win, key).each{|k, conf|
+ ret[k] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+ alias current_pane_configinfo current_paneconfiginfo
+
+ def panes
+ tk_split_simplelist(tk_send_without_enc('panes')).map{|w|
+ (obj = window(w))? obj: w
+ }
+ end
+
+ def identify(x, y)
+ num_or_nil(tk_send_without_enc('identify', x, y))
+ end
+
+ def sashpos(idx, newpos=None)
+ num_or_str(tk_send_without_enc('sashpos', idx, newpos))
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow,
+# :TkPanedwindow, :TkPanedWindow)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tpaned.rb',
+ :Ttk, Tk::Tile::Panedwindow,
+ :TkPanedwindow, :TkPanedWindow)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tprogressbar.rb
new file mode 100644
index 0000000..0c9d15e
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tprogressbar.rb
@@ -0,0 +1,57 @@
+#
+# tprogressbar widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TProgressbar < TkWindow
+ end
+ Progressbar = TProgressbar
+ end
+end
+
+class Tk::Tile::TProgressbar
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::progressbar'.freeze].freeze
+ else
+ TkCommandNames = ['::tprogressbar'.freeze].freeze
+ end
+ WidgetClassName = 'TProgressbar'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def step(amount=None)
+ tk_send_without_enc('step', amount).to_f
+ end
+ #def step=(amount)
+ # tk_send_without_enc('step', amount)
+ #end
+
+ def start(interval=None)
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::progressbar::start', @path, interval)
+ else
+ tk_send_without_enc('start', interval)
+ end
+ end
+
+ def stop(amount=None)
+ if Tk::Tile::TILE_SPEC_VERSION_ID < 5
+ tk_call_without_enc('::tile::progressbar::stop', @path)
+ else
+ tk_send_without_enc('stop', amount)
+ end
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tprogressbar.rb',
+ :Ttk, Tk::Tile::Progressbar, :TkProgressbar)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tradiobutton.rb
new file mode 100644
index 0000000..5dbf260
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tradiobutton.rb
@@ -0,0 +1,38 @@
+#
+# tradiobutton widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TRadioButton < Tk::RadioButton
+ end
+ TRadiobutton = TRadioButton
+ RadioButton = TRadioButton
+ Radiobutton = TRadioButton
+ end
+end
+
+class Tk::Tile::TRadioButton < Tk::RadioButton
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::radiobutton'.freeze].freeze
+ else
+ TkCommandNames = ['::tradiobutton'.freeze].freeze
+ end
+ WidgetClassName = 'TRadiobutton'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton,
+# :TkRadiobutton, :TkRadioButton)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tradiobutton.rb',
+ :Ttk, Tk::Tile::Radiobutton,
+ :TkRadiobutton, :TkRadioButton)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/treeview.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/treeview.rb
new file mode 100644
index 0000000..85d7831
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/treeview.rb
@@ -0,0 +1,1336 @@
+#
+# treeview widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class Treeview < TkWindow
+ end
+ end
+end
+
+module Tk::Tile::TreeviewConfig
+ include TkItemConfigMethod
+
+ def __item_configinfo_struct(id)
+ # maybe need to override
+ {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
+ :default_value=>nil, :current_value=>1}
+ end
+ private :__item_configinfo_struct
+
+ def __itemconfiginfo_core(tagOrId, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ fontkey = $2
+ return [slot.to_s, tagfontobj(tagid(tagOrId), fontkey)]
+ else
+ if slot
+ slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
+ case slot
+ when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << slot))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ end
+ return [slot, val]
+
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
+ optval = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ begin
+ val = method.call(tagOrId, optval)
+ rescue => e
+ warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
+ val = optval
+ end
+ return [slot, val]
+
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return [slot, self.__send__(method, tagOrId)]
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ val = number(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ rescue
+ val = nil
+ end
+ return [slot, val]
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = num_or_str(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ return [slot, val]
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ val = bool(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ rescue
+ val = nil
+ end
+ return [slot, val]
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ return [slot, val]
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val =~ /^[0-9]/
+ return [slot, list(val)]
+ else
+ return [slot, val]
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ return [slot, val]
+
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val.empty?
+ return [slot, nil]
+ else
+ return [slot, TkVarAccess.new(val)]
+ end
+
+ else
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val.index('{')
+ return [slot, tk_split_list(val)]
+ else
+ return [slot, tk_tcl2ruby(val)]
+ end
+ end
+
+ else # ! slot
+ ret = Hash[*(tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false))].to_a.collect{|conf|
+ conf[0] = conf[0][1..-1] if conf[0][0] == ?-
+ case conf[0]
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[conf[0]]
+ optval = conf[1]
+ begin
+ val = method.call(tagOrId, optval)
+ rescue => e
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
+ val = optval
+ end
+ conf[1] = val
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ conf[1] = number(conf[1])
+ rescue
+ conf[1] = nil
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf[1] = num_or_str(conf[1])
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ conf[1] = bool(conf[1])
+ rescue
+ conf[1] = nil
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf[1] = simplelist(conf[1])
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if conf[1] =~ /^[0-9]/
+ conf[1] = list(conf[1])
+ end
+
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+ if conf[1].empty?
+ conf[1] = nil
+ else
+ conf[1] = TkVarAccess.new(conf[1])
+ end
+
+ else
+ if conf[1].index('{')
+ conf[1] = tk_split_list(conf[1])
+ else
+ conf[1] = tk_tcl2ruby(conf[1])
+ end
+ end
+
+ conf
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret.assoc(optkey)
+ if fontconf
+ ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fontconf[1] = tagfontobj(tagid(tagOrId), optkey)
+ ret.push(fontconf)
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret << [optkey.to_s, self.__send__(method, tagOrId)]
+ }
+
+ ret
+ end
+ end
+
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
+ fontkey = $2
+ return {slot.to_s => tagfontobj(tagid(tagOrId), fontkey)}
+ else
+ if slot
+ slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
+ case slot
+ when /^(#{__tile_specific_item_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ # On tile-0.7.{2-8}, 'state' option has no '-' at its head.
+ val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << slot))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ val = tk_call(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ end
+ return {slot => val}
+
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
+ optval = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ begin
+ val = method.call(tagOrId, optval)
+ rescue => e
+ warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
+ val = optval
+ end
+ return {slot => val}
+
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return {slot => self.__send__(method, tagOrId)}
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ val = number(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ rescue
+ val = nil
+ end
+ return {slot => val}
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = num_or_str(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ return {slot => val}
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ val = bool(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ rescue
+ val = nil
+ end
+ return {slot => val}
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))
+ return {slot => val}
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val =~ /^[0-9]/
+ return {slot => list(val)}
+ else
+ return {slot => val}
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ return {slot => val}
+
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val.empty?
+ return {slot => nil}
+ else
+ return {slot => TkVarAccess.new(val)}
+ end
+
+ else
+ val = tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}"))
+ if val.index('{')
+ return {slot => tk_split_list(val)}
+ else
+ return {slot => tk_tcl2ruby(val)}
+ end
+ end
+
+ else # ! slot
+ ret = {}
+ ret = Hash[*(tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false))].to_a.collect{|conf|
+ conf[0] = conf[0][1..-1] if conf[0][0] == ?-
+
+ optkey = conf[0]
+ case optkey
+ when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
+ optval = conf[1]
+ begin
+ val = method.call(tagOrId, optval)
+ rescue => e
+ warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
+ val = optval
+ end
+ conf[1] = val
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ conf[1] = number(conf[1])
+ rescue
+ conf[1] = nil
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf[1] = num_or_str(conf[1])
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ begin
+ conf[1] = bool(conf[1])
+ rescue
+ conf[1] = nil
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf[1] = simplelist(conf[1])
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if conf[1] =~ /^[0-9]/
+ conf[1] = list(conf[1])
+ end
+
+ when /^(#{__item_tkvariable_optkeys(tagid(tagOrId)).join('|')})$/
+ if conf[1].empty?
+ conf[1] = nil
+ else
+ conf[1] = TkVarAccess.new(conf[1])
+ end
+
+ else
+ if conf[1].index('{')
+ return [slot, tk_split_list(conf[1])]
+ else
+ return [slot, tk_tcl2ruby(conf[1])]
+ end
+ end
+
+ ret[conf[0]] = conf[1]
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret[optkey]
+ if fontconf.kind_of?(Array)
+ ret.delete(optkey)
+ ret.delete('latin' << optkey)
+ ret.delete('ascii' << optkey)
+ ret.delete('kanji' << optkey)
+ fontconf[1] = tagfontobj(tagid(tagOrId), optkey)
+ ret[optkey] = fontconf
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret[optkey.to_s] = self.__send__(method, tagOrId)
+ }
+
+ ret
+ end
+ end
+ end
+ end
+
+ ###################
+
+ def __item_cget_cmd(id)
+ [self.path, *id]
+ end
+ private :__item_cget_cmd
+
+ def __item_config_cmd(id)
+ [self.path, *id]
+ end
+ private :__item_config_cmd
+
+ def __item_numstrval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['width']
+ when :column, 'column'
+ super(id[1]) + ['minwidth']
+ when :tag, 'tag'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ else
+ super(id[1])
+ end
+ end
+ private :__item_numstrval_optkeys
+
+ def __item_strval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ super(id) + ['id']
+ when :column, 'column'
+ super(id[1])
+ when :tag, 'tag'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ else
+ super(id[1])
+ end
+ end
+ private :__item_strval_optkeys
+
+ def __item_boolval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['open']
+ when :column, 'column'
+ super(id[1]) + ['stretch']
+ when :tag, 'tag'
+ super(id[1])
+ when :heading, 'heading'
+ super(id[1])
+ end
+ end
+ private :__item_boolval_optkeys
+
+ def __item_listval_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ ['values']
+ when :column, 'column'
+ []
+ when :heading, 'heading'
+ []
+ else
+ []
+ end
+ end
+ private :__item_listval_optkeys
+
+ def __item_val2ruby_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ {
+ 'tags'=>proc{|arg_id, val|
+ simplelist(val).collect{|tag|
+ Tk::Tile::Treeview::Tag.id2obj(self, tag)
+ }
+ }
+ }
+ when :column, 'column'
+ {}
+ when :heading, 'heading'
+ {}
+ else
+ {}
+ end
+ end
+ private :__item_val2ruby_optkeys
+
+ def __tile_specific_item_optkeys(id)
+ case id[0]
+ when :item, 'item'
+ []
+ when :column, 'column'
+ []
+ when :heading, 'heading'
+ ['state'] # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ else
+ []
+ end
+ end
+ private :__item_val2ruby_optkeys
+
+ def itemconfiginfo(tagOrId, slot = nil)
+ __itemconfiginfo_core(tagOrId, slot)
+ end
+
+ def current_itemconfiginfo(tagOrId, slot = nil)
+ if TkComm::GET_CONFIGINFO_AS_ARRAY
+ if slot
+ org_slot = slot
+ begin
+ conf = __itemconfiginfo_core(tagOrId, slot)
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ return {conf[0] => conf[-1]}
+ end
+ slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
+ end while(org_slot != slot)
+ fail RuntimeError,
+ "there is a configure alias loop about '#{org_slot}'"
+ else
+ ret = {}
+ __itemconfiginfo_core(tagOrId).each{|conf|
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ ret[conf[0]] = conf[-1]
+ end
+ }
+ ret
+ end
+ else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
+ ret = {}
+ __itemconfiginfo_core(tagOrId, slot).each{|key, conf|
+ ret[key] = conf[-1] if conf.kind_of?(Array)
+ }
+ ret
+ end
+ end
+
+ alias __itemcget_tkstring itemcget_tkstring
+ alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
+ alias __itemconfigure itemconfigure
+ alias __itemconfiginfo itemconfiginfo
+ alias __current_itemconfiginfo current_itemconfiginfo
+
+ private :__itemcget_tkstring, :__itemcget, :__itemcget_strict
+ private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
+
+ # Treeview Item
+ def itemcget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:item, tagOrId], option)
+ end
+ def itemcget(tagOrId, option)
+ __itemcget([:item, tagOrId], option)
+ end
+ def itemcget_strict(tagOrId, option)
+ __itemcget_strict([:item, tagOrId], option)
+ end
+ def itemconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:item, tagOrId], slot, value)
+ end
+ def itemconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:item, tagOrId], slot)
+ end
+ def current_itemconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:item, tagOrId], slot)
+ end
+
+ # Treeview Column
+ def columncget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:column, tagOrId], option)
+ end
+ def columncget(tagOrId, option)
+ __itemcget([:column, tagOrId], option)
+ end
+ def columncget_strict(tagOrId, option)
+ __itemcget_strict([:column, tagOrId], option)
+ end
+ def columnconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:column, tagOrId], slot, value)
+ end
+ def columnconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:column, tagOrId], slot)
+ end
+ def current_columnconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:column, tagOrId], slot)
+ end
+ alias column_cget_tkstring columncget_tkstring
+ alias column_cget columncget
+ alias column_cget_strict columncget_strict
+ alias column_configure columnconfigure
+ alias column_configinfo columnconfiginfo
+ alias current_column_configinfo current_columnconfiginfo
+
+ # Treeview Heading
+ def headingcget_tkstring(tagOrId, option)
+ if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
+ begin
+ # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
+ end
+ else
+ __itemcget_tkstring([:heading, tagOrId], option)
+ end
+ end
+ def headingcget_strict(tagOrId, option)
+ if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s)
+ begin
+ # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}"))
+ end
+ else
+ __itemcget_strict([:heading, tagOrId], option)
+ end
+ end
+ def headingcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ headingcget_strict(tagOrId, option)
+ else
+ begin
+ headingcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_headingconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+ def headingconfigure(tagOrId, slot, value=None)
+ if slot.kind_of?(Hash)
+ slot = _symbolkey2str(slot)
+ sp_kv = []
+ __tile_specific_item_optkeys([:heading, tagOrId]).each{|k|
+ sp_kv << k << _get_eval_string(slot.delete(k)) if slot.has_key?(k)
+ }
+ tk_call(*(__item_config_cmd([:heading, tagOrId]).concat(sp_kv)))
+ tk_call(*(__item_config_cmd([:heading, tagOrId]).concat(hash_kv(slot))))
+ elsif __tile_specific_item_optkeys([:heading, tagOrId]).index(slot.to_s)
+ begin
+ # On tile-0.7.{2-8}, 'state' options has no '-' at its head.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << slot.to_s << value))
+ rescue
+ # Maybe, 'state' option has '-' in future.
+ tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{slot}" << value))
+ end
+ else
+ __itemconfigure([:heading, tagOrId], slot, value)
+ end
+ self
+ end
+ def headingconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:heading, tagOrId], slot)
+ end
+ def current_headingconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:heading, tagOrId], slot)
+ end
+ alias heading_cget_tkstring headingcget_tkstring
+ alias heading_cget headingcget
+ alias heading_cget_strict headingcget_strict
+ alias heading_configure headingconfigure
+ alias heading_configinfo headingconfiginfo
+ alias current_heading_configinfo current_headingconfiginfo
+
+ # Treeview Tag
+ def tagcget_tkstring(tagOrId, option)
+ __itemcget_tkstring([:tag, :configure, tagOrId], option)
+ end
+ def tagcget(tagOrId, option)
+ __itemcget([:tag, :configure, tagOrId], option)
+ end
+ def tagcget_strict(tagOrId, option)
+ __itemcget_strict([:tag, :configure, tagOrId], option)
+ end
+ def tagconfigure(tagOrId, slot, value=None)
+ __itemconfigure([:tag, :configure, tagOrId], slot, value)
+ end
+ def tagconfiginfo(tagOrId, slot=nil)
+ __itemconfiginfo([:tag, :configure, tagOrId], slot)
+ end
+ def current_tagconfiginfo(tagOrId, slot=nil)
+ __current_itemconfiginfo([:tag, :configure, tagOrId], slot)
+ end
+ alias tag_cget_tkstring tagcget_tkstring
+ alias tag_cget tagcget
+ alias tag_cget_strict tagcget_strict
+ alias tag_configure tagconfigure
+ alias tag_configinfo tagconfiginfo
+ alias current_tag_configinfo current_tagconfiginfo
+end
+
+########################
+
+class Tk::Tile::Treeview::Item < TkObject
+ ItemID_TBL = TkCore::INTERP.create_table
+
+ TkCore::INTERP.init_ip_env{
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ Tk::Tile::Treeview::Item::ItemID_TBL.clear
+ }
+ }
+
+ def self.id2obj(tree, id)
+ tpath = tree.path
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ if Tk::Tile::Treeview::Item::ItemID_TBL[tpath]
+ (Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id])? \
+ Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id]: id
+ else
+ id
+ end
+ }
+ end
+
+ def self.assign(tree, id)
+ tpath = tree.path
+ obj = nil
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ if Tk::Tile::Treeview::Item::ItemID_TBL[tpath] &&
+ Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id]
+ return Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id]
+ end
+
+ obj = self.allocate
+ obj.instance_eval{
+ @parent = @t = tree
+ @tpath = tpath
+ @path = @id = id
+ }
+ Tk::Tile::Treeview::Item::ItemID_TBL[tpath] ||= {}
+ Tk::Tile::Treeview::Item::ItemID_TBL[tpath][id] = obj
+ }
+ obj
+ end
+
+ def _insert_item(tree, parent_item, idx, keys={})
+ keys = _symbolkey2str(keys)
+ id = keys.delete('id')
+ if id
+ num_or_str(tk_call(tree, 'insert',
+ parent_item, idx, '-id', id, *hash_kv(keys)))
+ else
+ num_or_str(tk_call(tree, 'insert', parent_item, idx, *hash_kv(keys)))
+ end
+ end
+ private :_insert_item
+
+ def initialize(tree, parent_item = '', idx = 'end', keys = {})
+ if parent_item.kind_of?(Hash)
+ keys = parent_item
+ idx = 'end'
+ parent_item = ''
+ elsif idx.kind_of?(Hash)
+ keys = idx
+ idx = 'end'
+ end
+
+ @parent = @t = tree
+ @tpath = tree.path
+ @path = @id = _insert_item(@t, parent_item, idx, keys)
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ ItemID_TBL[@tpath] = {} unless ItemID_TBL[@tpath]
+ ItemID_TBL[@tpath][@id] = self
+ }
+ end
+ def id
+ @id
+ end
+
+ def cget_tkstring(option)
+ @t.itemcget_tkstring(@id, option)
+ end
+ def cget(option)
+ @t.itemcget(@id, option)
+ end
+ def cget_strict(option)
+ @t.itemcget_strict(@id, option)
+ end
+
+ def configure(key, value=None)
+ @t.itemconfigure(@id, key, value)
+ self
+ end
+
+ def configinfo(key=nil)
+ @t.itemconfiginfo(@id, key)
+ end
+
+ def current_configinfo(key=nil)
+ @t.current_itemconfiginfo(@id, key)
+ end
+
+ def open?
+ cget('open')
+ end
+ def open
+ configure('open', true)
+ self
+ end
+ def close
+ configure('open', false)
+ self
+ end
+
+ def tag_has?(tag)
+ @t.tag_has?(tag, @id)
+ end
+ alias has_tag? tag_has?
+
+ def bbox(column=None)
+ @t.bbox(@id, column)
+ end
+
+ def children
+ @t.children(@id)
+ end
+ def set_children(*items)
+ @t.set_children(@id, *items)
+ self
+ end
+
+ def delete
+ @t.delete(@id)
+ self
+ end
+
+ def detach
+ @t.detach(@id)
+ self
+ end
+
+ def exist?
+ @t.exist?(@id)
+ end
+
+ def focus
+ @t.focus_item(@id)
+ end
+
+ def index
+ @t.index(@id)
+ end
+
+ def insert(idx='end', keys={})
+ @t.insert(@id, idx, keys)
+ end
+
+ def move(parent, idx)
+ @t.move(@id, parent, idx)
+ self
+ end
+
+ def next_item
+ @t.next_item(@id)
+ end
+
+ def parent_item
+ @t.parent_item(@id)
+ end
+
+ def prev_item
+ @t.prev_item(@id)
+ end
+
+ def see
+ @t.see(@id)
+ self
+ end
+
+ def selection_add
+ @t.selection_add(@id)
+ self
+ end
+
+ def selection_remove
+ @t.selection_remove(@id)
+ self
+ end
+
+ def selection_set
+ @t.selection_set(@id)
+ self
+ end
+
+ def selection_toggle
+ @t.selection_toggle(@id)
+ self
+ end
+
+ def get_directory
+ @t.get_directory(@id)
+ end
+ alias get_dictionary get_directory
+
+ def get(col)
+ @t.get(@id, col)
+ end
+
+ def set(col, value)
+ @t.set(@id, col, value)
+ end
+end
+
+########################
+
+class Tk::Tile::Treeview::Root < Tk::Tile::Treeview::Item
+ def self.new(tree, keys = {})
+ tpath = tree.path
+ obj = nil
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ if Tk::Tile::Treeview::Item::ItemID_TBL[tpath] &&
+ Tk::Tile::Treeview::Item::ItemID_TBL[tpath]['']
+ obj = Tk::Tile::Treeview::Item::ItemID_TBL[tpath]['']
+ else
+ #super(tree, keys)
+ (obj = self.allocate).instance_eval{
+ @parent = @t = tree
+ @tpath = tree.path
+ @path = @id = ''
+ Tk::Tile::Treeview::Item::ItemID_TBL[@tpath] ||= {}
+ Tk::Tile::Treeview::Item::ItemID_TBL[@tpath][@id] = self
+ }
+ end
+ }
+ obj.configure(keys) if keys && ! keys.empty?
+ obj
+ end
+
+ def initialize(tree, keys = {})
+ # dummy:: not called by 'new' method
+ @parent = @t = tree
+ @tpath = tree.path
+ @path = @id = ''
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ Tk::Tile::Treeview::Item::ItemID_TBL[@tpath] ||= {}
+ Tk::Tile::Treeview::Item::ItemID_TBL[@tpath][@id] = self
+ }
+ end
+end
+
+########################
+
+class Tk::Tile::Treeview::Tag < TkObject
+ include TkTreatTagFont
+
+ TagID_TBL = TkCore::INTERP.create_table
+
+ (Tag_ID = ['tile_treeview_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{
+ @mutex = Mutex.new
+ def mutex; @mutex; end
+ freeze
+ }
+
+ TkCore::INTERP.init_ip_env{
+ Tk::Tile::Treeview::Tag::TagID_TBL.mutex.synchronize{
+ Tk::Tile::Treeview::Tag::TagID_TBL.clear
+ }
+ }
+
+ def self.id2obj(tree, id)
+ tpath = tree.path
+ Tk::Tile::Treeview::Tag::TagID_TBL.mutex.synchronize{
+ if Tk::Tile::Treeview::Tag::TagID_TBL[tpath]
+ (Tk::Tile::Treeview::Tag::TagID_TBL[tpath][id])? \
+ Tk::Tile::Treeview::Tag::TagID_TBL[tpath][id]: id
+ else
+ id
+ end
+ }
+ end
+
+ def initialize(tree, keys=nil)
+ @parent = @t = tree
+ @tpath = tree.path
+ Tag_ID.mutex.synchronize{
+ @path = @id = Tag_ID.join(TkCore::INTERP._ip_id_)
+ Tag_ID[1].succ!
+ }
+ TagID_TBL.mutex.synchronize{
+ TagID_TBL[@tpath] = {} unless TagID_TBL[@tpath]
+ TagID_TBL[@tpath][@id] = self
+ }
+ if keys && keys != None
+ tk_call_without_enc(@tpath, 'tag', 'configure', @id, *hash_kv(keys,true))
+ end
+ end
+ def id
+ @id
+ end
+
+ def tag_has?(item)
+ @t.tag_has?(@id, item)
+ end
+ alias added? tag_has?
+
+ def tag_has
+ @t.tag_has(@id)
+ end
+
+ def add(*items)
+ @t.tag_add(@id, *items)
+ end
+
+ def remove(*items)
+ @t.tag_remove(@id, *items)
+ end
+
+ def bind(seq, *args)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ @t.tag_bind(@id, seq, cmd, *args)
+ self
+ end
+
+ def bind_append(seq, *args)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ @t.tag_bind_append(@id, seq, cmd, *args)
+ self
+ end
+
+ def bind_remove(seq)
+ @t.tag_bind_remove(@id, seq)
+ self
+ end
+
+ def bindinfo(seq=nil)
+ @t.tag_bindinfo(@id, seq)
+ end
+
+ def cget_tkstring(option)
+ @t.tagcget_tkstring(@id, option)
+ end
+ def cget(option)
+ @t.tagcget(@id, option)
+ end
+ def cget_strict(option)
+ @t.tagcget_strict(@id, option)
+ end
+
+ def configure(key, value=None)
+ @t.tagconfigure(@id, key, value)
+ self
+ end
+
+ def configinfo(key=nil)
+ @t.tagconfiginfo(@id, key)
+ end
+
+ def current_configinfo(key=nil)
+ @t.current_tagconfiginfo(@id, key)
+ end
+end
+
+########################
+
+class Tk::Tile::Treeview < TkWindow
+ include Tk::Tile::TileWidget
+ include Scrollable
+
+ include Tk::Tile::TreeviewConfig
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::treeview'.freeze].freeze
+ else
+ TkCommandNames = ['::treeview'.freeze].freeze
+ end
+ WidgetClassName = 'Treeview'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def __destroy_hook__
+ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
+ Tk::Tile::Treeview::Item::ItemID_TBL.delete(@path)
+ }
+ Tk::Tile::Treeview::Tag::ItemID_TBL.mutex.synchronize{
+ Tk::Tile::Treeview::Tag::ItemID_TBL.delete(@path)
+ }
+ end
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def tagid(id)
+ if id.kind_of?(Tk::Tile::Treeview::Item) ||
+ id.kind_of?(Tk::Tile::Treeview::Tag)
+ id.id
+ elsif id.kind_of?(Array)
+ # size is 2 or 3
+ id[0..-2] << _get_eval_string(id[-1])
+ else
+ _get_eval_string(id)
+ end
+ end
+
+ def root
+ Tk::Tile::Treeview::Root.new(self)
+ end
+
+ def bbox(item, column=None)
+ list(tk_send('item', 'bbox', item, column))
+ end
+
+ def children(item)
+ simplelist(tk_send_without_enc('children', item)).collect{|id|
+ Tk::Tile::Treeview::Item.id2obj(self, id)
+ }
+ end
+ def set_children(item, *items)
+ tk_send_without_enc('children', item,
+ array2tk_list(items.flatten, true))
+ self
+ end
+
+ def delete(*items)
+ tk_send_without_enc('delete', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def detach(*items)
+ tk_send_without_enc('detach', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def exist?(item)
+ bool(tk_send_without_enc('exists', _get_eval_enc_str(item)))
+ end
+
+ def focus_item(item = nil)
+ if item
+ tk_send('focus', item)
+ item
+ else
+ id = tk_send('focus')
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+ end
+
+ def identify(x, y)
+ # tile-0.7.2 or previous
+ ret = simplelist(tk_send('identify', x, y))
+ case ret[0]
+ when 'heading', 'separator'
+ ret[-1] = num_or_str(ret[-1])
+ when 'cell'
+ ret[1] = Tk::Tile::Treeview::Item.id2obj(self, ret[1])
+ ret[-1] = num_or_str(ret[-1])
+ when 'item', 'row'
+ ret[1] = Tk::Tile::Treeview::Item.id2obj(self, ret[1])
+ end
+ end
+
+ def identify_region(x, y)
+ tk_send('identify', 'region', x, y)
+ end
+
+ def identify_item(x, y)
+ id = tk_send('identify', 'item', x, y)
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+
+ def identify_element(x, y)
+ tk_send('identify', 'element', x, y)
+ end
+
+ def row_identify(x, y)
+ id = tk_send('identify', 'row', x, y)
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+ alias identify_row row_identify
+
+ def column_identify(x, y)
+ tk_send('identify', 'column', x, y)
+ end
+ alias identify_column column_identify
+
+ def index(item)
+ number(tk_send('index', item))
+ end
+
+ # def insert(parent, idx='end', keys={})
+ # keys = _symbolkey2str(keys)
+ # id = keys.delete('id')
+ # if id
+ # num_or_str(tk_send('insert', parent, idx, '-id', id, *hash_kv(keys)))
+ # else
+ # num_or_str(tk_send('insert', parent, idx, *hash_kv(keys)))
+ # end
+ # end
+ def insert(parent, idx='end', keys={})
+ Tk::Tile::Treeview::Item.new(self, parent, idx, keys)
+ end
+
+ # def instate(spec, cmd=Proc.new)
+ # tk_send('instate', spec, cmd)
+ # end
+ # def state(spec=None)
+ # tk_send('state', spec)
+ # end
+
+ def move(item, parent, idx)
+ tk_send('move', item, parent, idx)
+ self
+ end
+
+ def next_item(item)
+ id = tk_send('next', item)
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+
+ def parent_item(item)
+ if (id = tk_send('parent', item)).empty?
+ Tk::Tile::Treeview::Root.new(self)
+ else
+ Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+ end
+
+ def prev_item(item)
+ id = tk_send('prev', item)
+ (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
+ end
+
+ def see(item)
+ tk_send('see', item)
+ self
+ end
+
+ def selection
+ simplelist(tk_send('selection')).collect{|id|
+ Tk::Tile::Treeview::Item.id2obj(self, id)
+ }
+ end
+ alias selection_get selection
+
+ def selection_add(*items)
+ tk_send('selection', 'add', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_remove(*items)
+ tk_send('selection', 'remove', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_set(*items)
+ tk_send('selection', 'set', array2tk_list(items.flatten, true))
+ self
+ end
+ def selection_toggle(*items)
+ tk_send('selection', 'toggle', array2tk_list(items.flatten, true))
+ self
+ end
+
+ def get_directory(item)
+ # tile-0.7+
+ ret = []
+ lst = simplelist(tk_send('set', item))
+ until lst.empty?
+ col = lst.shift
+ val = lst.shift
+ ret << [col, val]
+ end
+ ret
+ end
+ alias get_dictionary get_directory
+
+ def get(item, col)
+ tk_send('set', item, col)
+ end
+ def set(item, col, value)
+ tk_send('set', item, col, value)
+ self
+ end
+
+ def tag_has?(tag, item)
+ bool(tk_send('tag', 'has', tagid(tag), tagid(item)))
+ end
+ def tag_has(tag)
+ tk_split_simplelist(tk_send('tag', 'has', tagid(tag))).collect{|id|
+ Tk::Tile::Treeview::Item.id2obj(self, id)
+ }
+ end
+
+ def tag_bind(tag, seq, *args)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
+ self
+ end
+ alias tagbind tag_bind
+
+ def tag_bind_append(tag, seq, *args)
+ if TkComm._callback_entry?(args[0]) || !block_given?
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
+ self
+ end
+ alias tagbind_append tag_bind_append
+
+ def tag_bind_remove(tag, seq)
+ _bind_remove([@path, 'tag', 'bind', tag], seq)
+ self
+ end
+ alias tagbind_remove tag_bind_remove
+
+ def tag_bindinfo(tag, context=nil)
+ _bindinfo([@path, 'tag', 'bind', tag], context)
+ end
+ alias tagbindinfo tag_bindinfo
+
+ def tag_names
+ tk_split_simplelist(tk_send('tag', 'names')).collect{|id|
+ Tk::Tile::Treeview::Tag.id2obj(self, id)
+ }
+ end
+
+ def tag_add(tag, *items)
+ fail ArgumentError, "no target items" if items.empty?
+ tk_send('tag', 'add', tagid(tag), *(items.collect{|item| tagid(item)}))
+ self
+ end
+
+ def tag_remove(tag, *items)
+ tk_send('tag', 'remove', tagid(tag), *(items.collect{|item| tagid(item)}))
+ self
+ end
+
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/treeview.rb',
+ :Ttk, Tk::Tile::Treeview, :TkTreeview)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tscale.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tscale.rb
new file mode 100644
index 0000000..7eefcef
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tscale.rb
@@ -0,0 +1,56 @@
+#
+# tscale & tprogress widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TScale < Tk::Scale
+ end
+ Scale = TScale
+
+ class TProgress < TScale
+ end
+ Progress = TProgress
+ end
+end
+
+class Tk::Tile::TScale < Tk::Scale
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::scale'.freeze].freeze
+ else
+ TkCommandNames = ['::tscale'.freeze].freeze
+ end
+ WidgetClassName = 'TScale'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ alias identify ttk_identify
+end
+
+class Tk::Tile::TProgress < Tk::Tile::TScale
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::progress'.freeze].freeze
+ else
+ TkCommandNames = ['::tprogress'.freeze].freeze
+ end
+ WidgetClassName = 'TProgress'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscale.rb',
+ :Ttk, Tk::Tile::Scale, :TkScale)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tscrollbar.rb
new file mode 100644
index 0000000..c6bba58
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tscrollbar.rb
@@ -0,0 +1,63 @@
+#
+# tscrollbar widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TScrollbar < Tk::Scrollbar
+ end
+ Scrollbar = TScrollbar
+ end
+end
+
+class Tk::Tile::TScrollbar < Tk::Scrollbar
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::scrollbar'.freeze].freeze
+ else
+ TkCommandNames = ['::tscrollbar'.freeze].freeze
+ end
+ WidgetClassName = 'TScrollbar'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ alias identify ttk_identify
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::Scrollbar, :TkScrollbar)
+
+#######################################################################
+
+class Tk::Tile::XScrollbar < Tk::Tile::TScrollbar
+ def create_self(keys)
+ keys = {} unless keys
+ keys['orient'] = 'horizontal'
+ super(keys)
+ end
+ private :create_self
+end
+
+class Tk::Tile::YScrollbar < Tk::Tile::TScrollbar
+ def create_self(keys)
+ keys = {} unless keys
+ keys['orient'] = 'vertical'
+ super(keys)
+ end
+ private :create_self
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::XScrollbar, :TkXScrollbar)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb',
+ :Ttk, Tk::Tile::YScrollbar, :TkYScrollbar)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tseparator.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tseparator.rb
new file mode 100644
index 0000000..ffd2f6f
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tseparator.rb
@@ -0,0 +1,34 @@
+#
+# tseparator widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSeparator < TkWindow
+ end
+ Separator = TSeparator
+ end
+end
+
+class Tk::Tile::TSeparator < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::separator'.freeze].freeze
+ else
+ TkCommandNames = ['::tseparator'.freeze].freeze
+ end
+ WidgetClassName = 'TSeparator'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tseparator.rb',
+ :Ttk, Tk::Tile::Separator, :TkSeparator)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tspinbox.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tspinbox.rb
new file mode 100644
index 0000000..2f2d73c
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tspinbox.rb
@@ -0,0 +1,107 @@
+#
+# ttk::spinbox widget (Tcl/Tk 8.6b1 or later)
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSpinbox < Tk::Tile::TEntry
+ end
+ Spinbox = TSpinbox
+ end
+end
+
+class Tk::Tile::TSpinbox < Tk::Tile::TEntry
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::spinbox'.freeze].freeze
+ else
+ TkCommandNames = ['::tspinbox'.freeze].freeze
+ end
+ WidgetClassName = 'TSpinbox'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ class SpinCommand < TkValidateCommand
+ class ValidateArgs < TkUtil::CallbackSubst
+ KEY_TBL = [
+ [ ?d, ?s, :direction ],
+ [ ?s, ?e, :current ],
+ [ ?W, ?w, :widget ],
+ nil
+ ]
+
+ PROC_TBL = [
+ [ ?s, TkComm.method(:string) ],
+ [ ?w, TkComm.method(:window) ],
+
+ [ ?e, proc{|val|
+ #enc = Tk.encoding
+ enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system)
+ if enc
+ Tk.fromUTF8(TkComm::string(val), enc)
+ else
+ TkComm::string(val)
+ end
+ }
+ ],
+
+ nil
+ ]
+
+ _setup_subst_table(KEY_TBL, PROC_TBL);
+
+ def self.ret_val(val)
+ (val)? '1': '0'
+ end
+ end
+
+ def self._config_keys
+ ['command']
+ end
+ end
+
+ def __validation_class_list
+ super() << SpinCommand
+ end
+
+ Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
+
+ def __boolval_optkeys
+ super() << 'wrap'
+ end
+ private :__boolval_optkeys
+
+ def __strval_optkeys
+ super() << 'buttonbackground' << 'format'
+ end
+ private :__strval_optkeys
+
+ def __listval_optkeys
+ super() << 'values'
+ end
+ private :__listval_optkeys
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+
+ def current
+ number(tk_send_without_enc('current'))
+ end
+ def current=(idx)
+ tk_send('current', idx)
+ end
+
+ def set(val)
+ tk_send('set', val)
+ end
+
+ alias identify ttk_identify
+end
+
+#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Spinbox, :TkSpinbox)
+Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tspinbox.rb',
+ :Ttk, Tk::Tile::Spinbox, :TkSpinbox)
diff --git a/jni/ruby/ext/tk/lib/tkextlib/tile/tsquare.rb b/jni/ruby/ext/tk/lib/tkextlib/tile/tsquare.rb
new file mode 100644
index 0000000..a81cd7b
--- /dev/null
+++ b/jni/ruby/ext/tk/lib/tkextlib/tile/tsquare.rb
@@ -0,0 +1,30 @@
+#
+# tsquare widget
+# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
+#
+require 'tk'
+require 'tkextlib/tile.rb'
+
+module Tk
+ module Tile
+ class TSquare < TkWindow
+ end
+ Square = TSquare
+ end
+end
+
+class Tk::Tile::TSquare < TkWindow
+ include Tk::Tile::TileWidget
+
+ if Tk::Tile::USE_TTK_NAMESPACE
+ TkCommandNames = ['::ttk::square'.freeze].freeze
+ else
+ TkCommandNames = ['::tsquare'.freeze].freeze
+ end
+ WidgetClassName = 'TSquare'.freeze
+ WidgetClassNames[WidgetClassName] ||= self
+
+ def self.style(*args)
+ [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
+ end
+end