summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--ext/tk/lib/tk.rb58
-rw-r--r--ext/tk/lib/tk/autoload.rb1
-rw-r--r--ext/tk/lib/tk/event.rb1
-rw-r--r--ext/tk/lib/tk/text.rb92
-rw-r--r--ext/tk/lib/tk/virtevent.rb15
6 files changed, 181 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e78345a..53f4743 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Wed Nov 23 20:59:01 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/lib/tk.rb: add Tk.pkgconfig_list and Tk.pkgconfig_get
+ [Tk8.5 feature].
+
+ * ext/tk/lib/tk/text.rb: supports new indices modifires on a Text
+ widget [Tk8.5 feature].
+
+ * ext/tk/lib/tk/virtevent.rb: add TkNamedVirtualEvent.
+
+ * ext/tk/lib/tk/autoload.rb: ditto.
+
+ * ext/tk/lib/tk/event.rb: add :data key for virtual events [Tk8.5
+ feature].
+
Wed Nov 23 18:55:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* file.c (w32_io_info): should not call GetFileInformationByHandle
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 0d18882..4afaaec 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1921,6 +1921,62 @@ module Tk
end
end
+ def Tk.pkgconfig_list(mod)
+ # Tk8.5 feature
+ if mod.kind_of?(Module)
+ if mod.respond_to?(:package_name)
+ pkgname = mod.package_name
+ elsif mod.const_defined?(:PACKAGE_NAME)
+ pkgname = mod::PACKAGE_NAME
+ else
+ fail NotImplementedError, 'may not be a module for a Tcl extension'
+ end
+ else
+ pkgname = mod.to_s
+ end
+
+ pkgname = '::' << pkgname unless pkgname =~ /^::/
+
+ tk_split_list(tk_call(pkgname + '::pkgconfig', 'list'))
+ end
+
+ def Tk.pkgconfig_get(mod, key)
+ # Tk8.5 feature
+ if mod.kind_of?(Module)
+ if mod.respond_to?(:package_name)
+ pkgname = mod.package_name
+ else
+ fail NotImplementedError, 'may not be a module for a Tcl extension'
+ end
+ else
+ pkgname = mod.to_s
+ end
+
+ pkgname = '::' << pkgname unless pkgname =~ /^::/
+
+ tk_call(pkgname + '::pkgconfig', 'get', key)
+ end
+
+ def Tk.tcl_pkgconfig_list
+ # Tk8.5 feature
+ Tk.pkgconfig_list('::tcl')
+ end
+
+ def Tk.tcl_pkgconfig_get(key)
+ # Tk8.5 feature
+ Tk.pkgconfig_get('::tcl', key)
+ end
+
+ def Tk.tk_pkgconfig_list
+ # Tk8.5 feature
+ Tk.pkgconfig_list('::tk')
+ end
+
+ def Tk.tk_pkgconfig_get(key)
+ # Tk8.5 feature
+ Tk.pkgconfig_get('::tk', key)
+ end
+
def Tk.bell(nice = false)
if nice
tk_call_without_enc('bell', '-nice')
@@ -4499,7 +4555,7 @@ end
#Tk.freeze
module Tk
- RELEASE_DATE = '2005-11-19'.freeze
+ RELEASE_DATE = '2005-11-23'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index 73544e1..6b3773f 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -162,6 +162,7 @@ autoload :TkVariable, 'tk/variable'
autoload :TkVarAccess, 'tk/variable'
autoload :TkVirtualEvent, 'tk/virtevent'
+autoload :TkNamedVirtualEvent,'tk/virtevent'
autoload :TkWinfo, 'tk/winfo'
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index b538bfd..af05dc9 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -384,6 +384,7 @@ module TkEvent
=end
ALIAS_TBL = {
:button => :num,
+ :data => :detail,
:delta => :wheel_delta,
:root => :rootwin_id,
:rootx => :x_root,
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index bd5de27..49d4b56 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -103,6 +103,58 @@ class TkText<TkTextWin
end
alias char chars
+ def display_chars(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars')
+ end
+ end
+ alias display_char display_chars
+
+ def any_chars(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars')
+ end
+ end
+ alias any_char any_chars
+
+ def indices(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices')
+ end
+ end
+
+ def display_indices(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices')
+ end
+ end
+
+ def any_indices(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices')
+ end
+ end
+
def lines(mod)
fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
if mod < 0
@@ -113,6 +165,28 @@ class TkText<TkTextWin
end
alias line lines
+ def display_lines(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines')
+ end
+ end
+ alias display_line display_lines
+
+ def any_lines(mod)
+ # Tk8.5 feature
+ fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer)
+ if mod < 0
+ TkText::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines')
+ else
+ TkText::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines')
+ end
+ end
+ alias any_line any_lines
+
def linestart
TkText::IndexString.new(String.new(id) << ' linestart')
end
@@ -120,12 +194,30 @@ class TkText<TkTextWin
TkText::IndexString.new(String.new(id) << ' lineend')
end
+ def display_linestart
+ # Tk8.5 feature
+ TkText::IndexString.new(String.new(id) << ' display linestart')
+ end
+ def display_lineend
+ # Tk8.5 feature
+ TkText::IndexString.new(String.new(id) << ' display lineend')
+ end
+
def wordstart
TkText::IndexString.new(String.new(id) << ' wordstart')
end
def wordend
TkText::IndexString.new(String.new(id) << ' wordend')
end
+
+ def display_wordstart
+ # Tk8.5 feature
+ TkText::IndexString.new(String.new(id) << ' display wordstart')
+ end
+ def display_wordend
+ # Tk8.5 feature
+ TkText::IndexString.new(String.new(id) << ' display wordend')
+ end
end
class IndexString < String
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index a1a94d3..d47e80a 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -15,6 +15,19 @@ class TkVirtualEvent<TkObject
TkCore::INTERP.init_ip_env{ TkVirtualEventTBL.clear }
class PreDefVirtEvent<self
+ def self.new(event, *sequences)
+ if event =~ /^<(<.*>)>$/
+ event = $1
+ elsif event !~ /^<.*>$/
+ event = '<' + event + '>'
+ end
+ if TkVirtualEvent::TkVirtualEventTBL.has_key?(event)
+ TkVirtualEvent::TkVirtualEventTBL[event]
+ else
+ super(event, *sequences)
+ end
+ end
+
def initialize(event, *sequences)
@path = @id = event
TkVirtualEvent::TkVirtualEventTBL[@id] = self
@@ -89,3 +102,5 @@ class TkVirtualEvent<TkObject
}
end
end
+
+TkNamedVirtualEvent = TkVirtualEvent::PreDefVirtEvent