1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/lib/tkextlib/blt/htext.rb
nagai 334325f72a * ext/tk/lib/tk.rb (_callback_entry_class?): add for checking whether
a class is available for a callback entry.
* ext/tk/lib/tk.rb (after_cancel): add Tk.after_cancel(afterID) method.
* ext/tk/lib/tk.rb (array2tk_list): change from private module method
  of TkComm to public module method.
* ext/tk/lib/tk.rb (cget): add check that slot argument is not empty string.
* ext/tk/lib/tk.rb (configinfo): ditto.
* ext/tk/lib/tk/itemconfig.rb (itemcget): add check that slot argument
  is not empty string.
* ext/tk/lib/tk/itemconfig.rb (itemconfiginfo): ditto.
* ext/tk/lib/tk/entry.rb: add TkEntry#icursor and icursor= (alias of
  cursor and cursor= method).
* ext/tk/lib/tk/font.rb: improve font treatment when the font name is
  empty string.
* ext/tk/lib/tk/variable.rb: add :variable, :window and :procedure type.
* ext/tk/lib/tk/variable.rb: improve treatment of array-type tkvariable.
* ext/tk/lib/tkextlib/blt.rb: add commands for zooming.
* ext/tk/lib/tkextlib/blt/*: bug fix.
* ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: bug fix and add methods
  to call TreeCtrl commands for bindings.
* ext/tk/sample/tkextlib/blt/*: new sample scritps.
* ext/tk/sample/tkextlib/treectrl/*: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-26 13:58:11 +00:00

105 lines
2.4 KiB
Ruby

#
# tkextlib/blt/htext.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tk/itemconfig.rb'
require 'tkextlib/blt.rb'
module Tk::BLT
class Htext<TkWindow
Htext_Var = TkVarAccess.new_hash('htext')
Htext_Widget = TkVarAccess.new('htext(widget)', :window)
Htext_File = TkVarAccess.new('htext(file)')
Htext_Line = TkVarAccess.new('htext(line)')
include TkItemConfigMethod
include Scrollable
TkCommandNames = ['::blt::htext'.freeze].freeze
WidgetClassName = 'Htext'.freeze
WidgetClassNames[WidgetClassName] = self
alias window_cget itemcget
alias window_configure itemconfigure
alias window_configuinfo itemconfiginfo
alias current_window_configuinfo current_itemconfiginfo
def append(win, keys={})
tk_send('append', _epath(win), keys)
self
end
def goto_line(idx)
tk_send_without_enc('gotoline', idx)
self
end
def current_line
number(tk_send_without_enc('gotoline'))
end
def index(str)
number(tk_send('index', str))
end
def line_pos(str)
tk_send('linepos', str)
end
def range(from=None, to=None)
tk_send_without_enc('range', from, to)
end
def scan_mark(pos)
tk_send_without_enc('scan', 'mark', pos)
self
end
def scan_dragto(pos)
tk_send_without_enc('scan', 'dragto', pos)
self
end
def search(pat, from=None, to=None)
num = number(tk_send('search', pat, from, to))
(num < 0)? nil: num
end
def selection_adjust(index)
tk_send_without_enc('selection', 'adjust', index)
self
end
def selection_clear()
tk_send_without_enc('selection', 'clear')
self
end
def selection_from(index)
tk_send_without_enc('selection', 'from', index)
self
end
def selection_line(index)
tk_send_without_enc('selection', 'line', index)
self
end
def selection_present()
bool(tk_send_without_enc('selection', 'present'))
end
def selection_range(first, last)
tk_send_without_enc('selection', 'range', first, last)
self
end
def selection_to(index)
tk_send_without_enc('selection', 'to', index)
self
end
def selection_word(index)
tk_send_without_enc('selection', 'word', index)
self
end
def windows(pat=None)
list(tk_send('windows', pat))
end
end
end