2004-07-01 09:38:48 +00:00
|
|
|
#
|
|
|
|
# tkextlib/tcllib/cursor.rb
|
|
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
|
|
#
|
|
|
|
# * Part of tcllib extension
|
|
|
|
# * Procedures to handle CURSOR data
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'tk'
|
2004-07-06 09:42:12 +00:00
|
|
|
require 'tkextlib/tcllib.rb'
|
2004-07-01 09:38:48 +00:00
|
|
|
|
|
|
|
module Tk
|
2004-07-06 09:42:12 +00:00
|
|
|
module Tcllib
|
|
|
|
module Cursor
|
|
|
|
def self.package_version
|
2004-10-11 04:51:21 +00:00
|
|
|
begin
|
|
|
|
TkPackage.require('cursor')
|
|
|
|
rescue
|
|
|
|
''
|
|
|
|
end
|
2004-07-06 09:42:12 +00:00
|
|
|
end
|
2004-07-15 01:18:57 +00:00
|
|
|
|
|
|
|
def self.not_available
|
2004-10-11 04:51:21 +00:00
|
|
|
fail RuntimeError, "'tkextlib/tcllib/cursor' extension is not available on your current environment."
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_display(win=None)
|
2004-10-11 04:51:21 +00:00
|
|
|
Tk::Tcllib::Cursor.not_available
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_propagate(win, cursor)
|
2004-10-11 04:51:21 +00:00
|
|
|
Tk::Tcllib::Cursor.not_available
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_restore(win, cursor = None)
|
2004-10-11 04:51:21 +00:00
|
|
|
Tk::Tcllib::Cursor.not_available
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
2004-07-06 09:42:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-07-01 09:38:48 +00:00
|
|
|
def self.cursor_display(parent=None)
|
|
|
|
# Pops up a dialog with a listbox containing all the cursor names.
|
|
|
|
# Selecting a cursor name will display it in that dialog.
|
|
|
|
# This is simply for viewing any available cursors on the platform .
|
2004-07-15 01:18:57 +00:00
|
|
|
#tk_call_without_enc('::cursor::display', parent)
|
|
|
|
Tk::Tcllib::Cursor.cursor_display(parent)
|
2004-07-01 09:38:48 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class TkWindow
|
|
|
|
def cursor_propagate(cursor)
|
|
|
|
# Sets the cursor for self and all its descendants to cursor.
|
2004-07-15 01:18:57 +00:00
|
|
|
#tk_call_without_enc('::cursor::propagate', @path, cursor)
|
|
|
|
Tk::Tcllib::Cursor.cursor_propagate(cursor)
|
2004-07-01 09:38:48 +00:00
|
|
|
end
|
|
|
|
def cursor_restore(cursor = None)
|
|
|
|
# Restore the original or previously set cursor for self and all its
|
|
|
|
# descendants. If cursor is specified, that will be used if on any
|
|
|
|
# widget that did not have a preset cursor (set by a previous call
|
|
|
|
# to TkWindow#cursor_propagate).
|
2004-07-15 01:18:57 +00:00
|
|
|
#tk_call_without_enc('::cursor::restore', @path, cursor)
|
|
|
|
Tk::Tcllib::Cursor.cursor_restore(cursor)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# TkPackage.require('cursor', '0.1')
|
|
|
|
TkPackage.require('cursor')
|
|
|
|
|
|
|
|
module Tk
|
|
|
|
module Tcllib
|
|
|
|
class << Cursor
|
|
|
|
undef not_available
|
|
|
|
end
|
|
|
|
|
|
|
|
module Cursor
|
|
|
|
def self.cursor_display(win=None)
|
2004-10-11 04:51:21 +00:00
|
|
|
tk_call_without_enc('::cursor::display', win)
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_propagate(win, cursor)
|
2004-10-11 04:51:21 +00:00
|
|
|
tk_call_without_enc('::cursor::propagate', win.path, cursor)
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.cursor_restore(win, cursor = None)
|
2004-10-11 04:51:21 +00:00
|
|
|
tk_call_without_enc('::cursor::restore', win.path, cursor)
|
2004-07-15 01:18:57 +00:00
|
|
|
end
|
|
|
|
end
|
2004-07-01 09:38:48 +00:00
|
|
|
end
|
|
|
|
end
|