diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-12 21:14:11 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-12 21:14:11 +0000 |
commit | 598e9930183162bb8cee510b7931e87a20e2e497 (patch) | |
tree | f787d2825c0c66790899ebc24a8343358cd0e86a /ext | |
parent | e921ea2d78f693c57fcb289faff3fc126dc8617a (diff) |
tk.rb : widget configure returns self (for method call chain)
tkmacpkg.rb : Mac resource (not new but not included untill now)
tkwinpkg.rb : Win DDE and registry (not new but not included untill now)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/tk/lib/tk.rb | 1 | ||||
-rw-r--r-- | ext/tk/lib/tkmacpkg.rb | 54 | ||||
-rw-r--r-- | ext/tk/lib/tkwinpkg.rb | 80 |
3 files changed, 135 insertions, 0 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 701392c875..8463e370a8 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -2507,6 +2507,7 @@ class TkObject<TkKernel tk_call path, 'configure', "-#{slot}", value end end + self end def configure_cmd(slot, value) diff --git a/ext/tk/lib/tkmacpkg.rb b/ext/tk/lib/tkmacpkg.rb new file mode 100644 index 0000000000..1bd2d711b6 --- /dev/null +++ b/ext/tk/lib/tkmacpkg.rb @@ -0,0 +1,54 @@ +# +# tkmacpkg.rb : methods for Tcl/Tk packages for Macintosh +# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp> +# +# ATTENTION !! +# This is NOT TESTED. Because I have no test-environment. +# +# +require 'tk' + +module TkMacResource + extend Tk + extend TkMacResource + + tk_call('package', 'require', 'resource') + + def close(rsrcRef) + tk_call('resource', 'close', rsrcRef) + end + + def delete(rsrcType, opts=nil) + tk_call('resource', 'delete', *(hash_kv(opts) + rsrcType)) + end + + def files(rsrcRef=nil) + if rsrcRef + tk_call('resource', 'files', rsrcRef) + else + tk_split_simplelist(tk_call('resource', 'files')) + end + end + + def list(rsrcType, rsrcRef=nil) + tk_split_simplelist(tk_call('resource', 'list', rsrcType, rsrcRef)) + end + + def open(fname, access=nil) + tk_call('resource', 'open', fname, access) + end + + def read(rsrcType, rsrcID, rsrcRef=nil) + tk_call('resource', 'read', rsrcType, rsrcID, rsrcRef) + end + + def types(rsrcRef=nil) + tk_split_simplelist(tk_call('resource', 'types', rsrcRef)) + end + + def write(rsrcType, data, opts=nil) + tk_call('resource', 'write', *(hash_kv(opts) + rsrcType + data)) + end + + module_function :close, :delete, :files, :list, :open, :read, :types, :write +end diff --git a/ext/tk/lib/tkwinpkg.rb b/ext/tk/lib/tkwinpkg.rb new file mode 100644 index 0000000000..a5ac5c7a1b --- /dev/null +++ b/ext/tk/lib/tkwinpkg.rb @@ -0,0 +1,80 @@ +# +# tkwinpkg.rb : methods for Tcl/Tk packages for Microsoft Windows +# 2000/11/22 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp> +# +# ATTENTION !! +# This is NOT TESTED. Because I have no test-environment. +# +# +require 'tk' + +module TkWinDDE + extend Tk + extend TkWinDDE + + tk_call('package', 'require', 'dde') + + def servername(topic=nil) + tk_call('dde', 'servername', topic) + end + + def execute(service, topic, data) + tk_call('dde', 'execute', service, topic, data) + end + + def async_execute(service, topic, data) + tk_call('dde', '-async', 'execute', service, topic, data) + end + + def poke(service, topic, item, data) + tk_call('dde', 'poke', service, topic, item, data) + end + + def request(service, topic, item) + tk_call('dde', 'request', service, topic, item) + end + + def services(service, topic) + tk_call('dde', 'services', service, topic) + end + + def eval(topic, cmd, *args) + tk_call('dde', 'eval', topic, cmd, *args) + end + + module_function :servername, :execute, :async_execute, + :poke, :request, :services, :eval +end + +module TkWinRegistry + extend Tk + extend TkWinRegistry + + tk_call('package', 'require', 'registry') + + def delete(keynam, valnam=nil) + tk_call('registry', 'delete', keynam, valnam) + end + + def get(keynam, valnam) + tk_call('registry', 'get', keynam, valnam) + end + + def keys(keynam) + tk_split_simplelist(tk_call('registry', 'keys', keynam)) + end + + def set(keynam, valnam=nil, data=nil, dattype=nil) + tk_call('registry', 'set', keynam, valnam, data, dattype) + end + + def type(keynam, valnam) + tk_call('registry', 'type', keynam, valnam) + end + + def values(keynam) + tk_split_simplelist(tk_call('registry', 'values', keynam)) + end + + module_function :delete, :get, :keys, :set, :type, :values +end |