mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/multi-tk.rb: freeze callback-entry objects
* ext/tk/lib/tkextlib/tile.rb: support tile-0.6 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4783944876
commit
854f86e8ba
20 changed files with 550 additions and 63 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Mar 5 16:29:26 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/multi-tk.rb: freeze callback-entry objects
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile.rb: support tile-0.6
|
||||||
|
|
||||||
Sat Mar 5 12:52:08 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Mar 5 12:52:08 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (create_makefile): allow putting spaces between target
|
* lib/mkmf.rb (create_makefile): allow putting spaces between target
|
||||||
|
|
|
@ -1,6 +1,40 @@
|
||||||
|
2005-03-05 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile.rb: support tile-0.6
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tbutton.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tcheckbutton.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tlabel.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tmenubutton.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tnotebook.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tradiobutton.rb: ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tcombobox.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tentry.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tframe.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tlabelframe.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tprogressbar.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/treeview.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tscrollbar.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tseparator.rb: [new] ditto
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/tile/tsquare.rb: [new] ditto
|
||||||
|
|
||||||
2005-02-20 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
2005-02-20 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tclx/tclx.rb: warning TclX's 'signal' command.
|
* ext/tk/lib/tkextlib/tclx/tclx.rb: warning TclX's 'signal' command.
|
||||||
|
|
||||||
2005-01-25 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
2005-01-25 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ class MultiTkIp
|
||||||
def initialize(ip, cmd)
|
def initialize(ip, cmd)
|
||||||
@ip = ip
|
@ip = ip
|
||||||
@cmd = cmd
|
@cmd = cmd
|
||||||
|
freeze
|
||||||
end
|
end
|
||||||
attr_reader :ip, :cmd
|
attr_reader :ip, :cmd
|
||||||
def inspect
|
def inspect
|
||||||
|
|
|
@ -4002,7 +4002,7 @@ end
|
||||||
#Tk.freeze
|
#Tk.freeze
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
RELEASE_DATE = '2005-03-02'.freeze
|
RELEASE_DATE = '2005-03-05'.freeze
|
||||||
|
|
||||||
autoload :AUTO_PATH, 'tk/variable'
|
autoload :AUTO_PATH, 'tk/variable'
|
||||||
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
||||||
|
|
|
@ -13,7 +13,24 @@ require 'tkextlib/tile/setup.rb'
|
||||||
|
|
||||||
# load package
|
# load package
|
||||||
# TkPackage.require('tile', '0.4')
|
# TkPackage.require('tile', '0.4')
|
||||||
TkPackage.require('tile')
|
# TkPackage.require('tile', '0.6')
|
||||||
|
verstr = TkPackage.require('tile')
|
||||||
|
ver = verstr.split('.')
|
||||||
|
if ver[0].to_i == 0 && ver[1].to_i <= 4
|
||||||
|
# version 0.4 or former
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
USE_TTK_NAMESPACE = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# version 0.5 or later
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
USE_TTK_NAMESPACE = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# autoload
|
# autoload
|
||||||
module Tk
|
module Tk
|
||||||
|
@ -55,6 +72,12 @@ module Tk
|
||||||
autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
|
autoload :TCheckButton, 'tkextlib/tile/tcheckbutton'
|
||||||
autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
|
autoload :TCheckbutton, 'tkextlib/tile/tcheckbutton'
|
||||||
|
|
||||||
|
autoload :TEntry, 'tkextlib/tile/tentry'
|
||||||
|
autoload :TCombobox, 'tkextlib/tile/tcombobox'
|
||||||
|
|
||||||
|
autoload :TFrame, 'tkextlib/tile/tframe'
|
||||||
|
autoload :TLabelframe, 'tkextlib/tile/tlabelframe'
|
||||||
|
|
||||||
autoload :TLabel, 'tkextlib/tile/tlabel'
|
autoload :TLabel, 'tkextlib/tile/tlabel'
|
||||||
|
|
||||||
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
|
autoload :TMenubutton, 'tkextlib/tile/tmenubutton'
|
||||||
|
@ -64,6 +87,14 @@ module Tk
|
||||||
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
|
autoload :TRadioButton, 'tkextlib/tile/tradiobutton'
|
||||||
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
|
autoload :TRadiobutton, 'tkextlib/tile/tradiobutton'
|
||||||
|
|
||||||
|
autoload :TScrollbar, 'tkextlib/tile/tsrollbar'
|
||||||
|
|
||||||
|
autoload :TSeparator, 'tkextlib/tile/tseparator'
|
||||||
|
|
||||||
|
autoload :TSquare, 'tkextlib/tile/tsquare'
|
||||||
|
|
||||||
|
autoload :TreeView, 'tkextlib/tile/treeview'
|
||||||
|
|
||||||
autoload :Style, 'tkextlib/tile/style'
|
autoload :Style, 'tkextlib/tile/style'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,16 +15,11 @@ end
|
||||||
class Tk::Tile::TButton < TkButton
|
class Tk::Tile::TButton < TkButton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tbutton'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::button'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tbutton'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TButton'.freeze
|
WidgetClassName = 'TButton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tbutton', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tbutton', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,16 +16,11 @@ end
|
||||||
class Tk::Tile::TCheckButton < TkCheckButton
|
class Tk::Tile::TCheckButton < TkCheckButton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tcheckbutton'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::checkbutton'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tcheckbutton'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TCheckbutton'.freeze
|
WidgetClassName = 'TCheckbutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tcheckbutton', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tcheckbutton', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
end
|
end
|
||||||
|
|
40
ext/tk/lib/tkextlib/tile/tcombobox.rb
Normal file
40
ext/tk/lib/tkextlib/tile/tcombobox.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
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 current
|
||||||
|
number(tk_send_without_enc('current', idx))
|
||||||
|
end
|
||||||
|
def current=(idx)
|
||||||
|
tk_send_without_enc('current', idx)
|
||||||
|
end
|
||||||
|
|
||||||
|
def identify(x, y)
|
||||||
|
tk_send_without_enc('identify', x, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set(val)
|
||||||
|
tk_send('set', val)
|
||||||
|
end
|
||||||
|
end
|
25
ext/tk/lib/tkextlib/tile/tentry.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tentry.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# tentry widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TEntry < TkEntry
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Tk::Tile::TEntry < TkEntry
|
||||||
|
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
|
||||||
|
end
|
25
ext/tk/lib/tkextlib/tile/tframe.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tframe.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# tframe widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TFrame < TkFrame
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Tk::Tile::TFrame < TkFrame
|
||||||
|
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
|
||||||
|
end
|
|
@ -15,16 +15,11 @@ end
|
||||||
class Tk::Tile::TLabel < TkLabel
|
class Tk::Tile::TLabel < TkLabel
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tlabel'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::label'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tlabel'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TLabel'.freeze
|
WidgetClassName = 'TLabel'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tlabel', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tlabel', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
end
|
end
|
||||||
|
|
25
ext/tk/lib/tkextlib/tile/tlabelframe.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tlabelframe.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
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
|
||||||
|
end
|
|
@ -15,16 +15,11 @@ end
|
||||||
class Tk::Tile::TMenubutton < TkMenubutton
|
class Tk::Tile::TMenubutton < TkMenubutton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tmenubutton'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::menubutton'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tmenubutton'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TMenubutton'.freeze
|
WidgetClassName = 'TMenubutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tmenubutton', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tmenubutton', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,19 +45,14 @@ class Tk::Tile::TNotebook < TkWindow
|
||||||
|
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tnotebook'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::notebook'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tnotebook'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TNotebook'.freeze
|
WidgetClassName = 'TNotebook'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tnotebook', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tnotebook', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
|
|
||||||
def enable_traversal()
|
def enable_traversal()
|
||||||
tk_call_without_end('tile::enableNotebookTraversal', @path)
|
tk_call_without_end('tile::enableNotebookTraversal', @path)
|
||||||
self
|
self
|
||||||
|
|
40
ext/tk/lib/tkextlib/tile/tprogressbar.rb
Normal file
40
ext/tk/lib/tkextlib/tile/tprogressbar.rb
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# tprogressbar widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TProgressbar < TkWidget
|
||||||
|
end
|
||||||
|
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 step
|
||||||
|
tk_send_without_enc('step').to_f
|
||||||
|
end
|
||||||
|
def step=(amount)
|
||||||
|
tk_send_without_enc('step', amount)
|
||||||
|
end
|
||||||
|
|
||||||
|
def start
|
||||||
|
tk_call_without_enc('::tile::progressbar::start', @path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
tk_call_without_enc('::tile::progressbar::stop', @path)
|
||||||
|
end
|
||||||
|
end
|
|
@ -16,16 +16,11 @@ end
|
||||||
class Tk::Tile::TRadioButton < TkRadioButton
|
class Tk::Tile::TRadioButton < TkRadioButton
|
||||||
include Tk::Tile::TileWidget
|
include Tk::Tile::TileWidget
|
||||||
|
|
||||||
TkCommandNames = ['tradiobutton'.freeze].freeze
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::radiobutton'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::tradiobutton'.freeze].freeze
|
||||||
|
end
|
||||||
WidgetClassName = 'TRadiobutton'.freeze
|
WidgetClassName = 'TRadiobutton'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
def create_self(keys)
|
|
||||||
if keys and keys != None
|
|
||||||
tk_call_without_enc('tradiobutton', @path, *hash_kv(keys, true))
|
|
||||||
else
|
|
||||||
tk_call_without_enc('tradiobutton', @path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
private :create_self
|
|
||||||
end
|
end
|
||||||
|
|
215
ext/tk/lib/tkextlib/tile/treeview.rb
Normal file
215
ext/tk/lib/tkextlib/tile/treeview.rb
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
#
|
||||||
|
# treeview widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class Treeview < TkWindow
|
||||||
|
end
|
||||||
|
|
||||||
|
module TreeviewItemConfig
|
||||||
|
include TkItemConfigMethod
|
||||||
|
|
||||||
|
def __item_cget_cmd(id)
|
||||||
|
[self.path, 'item', id]
|
||||||
|
end
|
||||||
|
private :__item_cget_cmd
|
||||||
|
|
||||||
|
def __item_config_cmd(id)
|
||||||
|
[self.path, 'item', id]
|
||||||
|
end
|
||||||
|
private :__item_config_cmd
|
||||||
|
|
||||||
|
def __item_numstrval_optkeys(id)
|
||||||
|
['width']
|
||||||
|
end
|
||||||
|
private :__item_numstrval_optkeys
|
||||||
|
|
||||||
|
def __item_strval_optkeys(id)
|
||||||
|
# maybe need to override
|
||||||
|
super(id) + ['id']
|
||||||
|
end
|
||||||
|
private :__item_strval_optkeys
|
||||||
|
|
||||||
|
def __item_boolval_optkeys(id)
|
||||||
|
['open']
|
||||||
|
end
|
||||||
|
private :__item_boolval_optkeys
|
||||||
|
|
||||||
|
def __item_listval_optkeys(id)
|
||||||
|
['values']
|
||||||
|
end
|
||||||
|
private :__item_listval_optkeys
|
||||||
|
end
|
||||||
|
|
||||||
|
module TreeviewColumnConfig
|
||||||
|
include TkItemConfigMethod
|
||||||
|
|
||||||
|
def __item_cget_cmd(id)
|
||||||
|
[self.path, 'column', id]
|
||||||
|
end
|
||||||
|
private :__item_cget_cmd
|
||||||
|
|
||||||
|
def __item_config_cmd(id)
|
||||||
|
[self.path, 'column', id]
|
||||||
|
end
|
||||||
|
private :__item_config_cmd
|
||||||
|
|
||||||
|
def __item_listval_optkeys(id)
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
private :__item_listval_optkeys
|
||||||
|
|
||||||
|
alias columncget itemcget
|
||||||
|
alias columnconfigure itemconfigure
|
||||||
|
alias columnconfiginfo itemconfiginfo
|
||||||
|
alias current_columnconfiginfo current_itemconfiginfo
|
||||||
|
|
||||||
|
private :itemcget, :itemconfigure
|
||||||
|
private :itemconfiginfo, :current_itemconfiginfo
|
||||||
|
end
|
||||||
|
|
||||||
|
module TreeviewHeadingConfig
|
||||||
|
include TkItemConfigMethod
|
||||||
|
|
||||||
|
def __item_cget_cmd(id)
|
||||||
|
[self.path, 'heading', id]
|
||||||
|
end
|
||||||
|
private :__item_cget_cmd
|
||||||
|
|
||||||
|
def __item_config_cmd(id)
|
||||||
|
[self.path, 'heading', id]
|
||||||
|
end
|
||||||
|
private :__item_config_cmd
|
||||||
|
|
||||||
|
def __item_listval_optkeys(id)
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
private :__item_listval_optkeys
|
||||||
|
|
||||||
|
alias headingcget itemcget
|
||||||
|
alias headingconfigure itemconfigure
|
||||||
|
alias headingconfiginfo itemconfiginfo
|
||||||
|
alias current_headingconfiginfo current_itemconfiginfo
|
||||||
|
|
||||||
|
private :itemcget, :itemconfigure
|
||||||
|
private :itemconfiginfo, :current_itemconfiginfo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Tk::Tile::Treeview < TkWindow
|
||||||
|
include Tk::Tile::TileWidget
|
||||||
|
include Scrollable
|
||||||
|
|
||||||
|
include Tk::Tile::TreeviewColumnConfig
|
||||||
|
include Tk::Tile::TreeviewHeadingConfig
|
||||||
|
include Tk::Tile::TreeviewItemConfig
|
||||||
|
|
||||||
|
if Tk::Tile::USE_TTK_NAMESPACE
|
||||||
|
TkCommandNames = ['::ttk::treeview'.freeze].freeze
|
||||||
|
else
|
||||||
|
TkCommandNames = ['::treeview'.freeze].freeze
|
||||||
|
end
|
||||||
|
WidgetClassName = 'Treeview'.freeze
|
||||||
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def tagid(id)
|
||||||
|
_get_eval_string(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def children(item)
|
||||||
|
list(tk_send_without_enc('children', item))
|
||||||
|
end
|
||||||
|
def children=(item, *items)
|
||||||
|
tk_send_without_enc('children', item, ary2tk_list(items))
|
||||||
|
items
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete(*items)
|
||||||
|
tk_send_without_enc('delete', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def detach(*items)
|
||||||
|
tk_send_without_enc('detach', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def exist?(item)
|
||||||
|
bool(tk_send_without_enc('exists', item))
|
||||||
|
end
|
||||||
|
|
||||||
|
def focus_item(item = None)
|
||||||
|
tk_send_without_enc('focus', item)
|
||||||
|
end
|
||||||
|
|
||||||
|
def identify(x, y)
|
||||||
|
tk_send_without_enc('identify', x, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
def index(item)
|
||||||
|
number(tk_send_without_enc('index', item))
|
||||||
|
end
|
||||||
|
|
||||||
|
def insert(parent, idx, keys={})
|
||||||
|
keys = _symbolkey2str(keys)
|
||||||
|
id = keys.delete('id')
|
||||||
|
if id
|
||||||
|
tk_send_without_enc('insert', parent, idx, '-id', id, *hash_kv(keys))
|
||||||
|
else
|
||||||
|
tk_send_without_enc('insert', parent, idx, *hash_kv(keys))
|
||||||
|
end
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def move(item, parent, idx)
|
||||||
|
tk_send_without_enc('move', item, parent, idx)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def next(item)
|
||||||
|
tk_send_without_enc('next', item)
|
||||||
|
end
|
||||||
|
|
||||||
|
def parent(item)
|
||||||
|
tk_send_without_enc('parent', item)
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev(item)
|
||||||
|
tk_send_without_enc('prev', item)
|
||||||
|
end
|
||||||
|
|
||||||
|
def see(item)
|
||||||
|
tk_send_without_enc('see', item)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def selection_add(*items)
|
||||||
|
tk_send_without_enc('selection', 'add', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
def selection_remove(*items)
|
||||||
|
tk_send_without_enc('selection', 'remove', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
def selection_set(*items)
|
||||||
|
tk_send_without_enc('selection', 'set', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
def selection_toggle(*items)
|
||||||
|
tk_send_without_enc('selection', 'toggle', ary2tk_list(items))
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(item, col)
|
||||||
|
tk_send_without_enc('set', item, col)
|
||||||
|
end
|
||||||
|
def set(item, col, value)
|
||||||
|
tk_send_without_enc('set', item, col, value)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
end
|
25
ext/tk/lib/tkextlib/tile/tscrollbar.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tscrollbar.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# tscrollbar widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TScrollbar < TkScrollbar
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Tk::Tile::TScrollbar < TkScrollbar
|
||||||
|
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
|
||||||
|
end
|
25
ext/tk/lib/tkextlib/tile/tseparator.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tseparator.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# tseparator widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TSeparator < TkWindow
|
||||||
|
end
|
||||||
|
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
|
||||||
|
end
|
25
ext/tk/lib/tkextlib/tile/tsquare.rb
Normal file
25
ext/tk/lib/tkextlib/tile/tsquare.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#
|
||||||
|
# tsquare widget
|
||||||
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
||||||
|
#
|
||||||
|
require 'tk'
|
||||||
|
require 'tkextlib/tile.rb'
|
||||||
|
|
||||||
|
module Tk
|
||||||
|
module Tile
|
||||||
|
class TSquare < TkWindow
|
||||||
|
end
|
||||||
|
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
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue