diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-23 16:23:30 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-23 16:23:30 +0000 |
commit | 6eb09c3d046a0cd9b7e33b48cfa51df30e7463a7 (patch) | |
tree | 38ed808ead0eb486ab852e7a7f14bf2f7ab237ad /ext/tk/lib/tkextlib/blt/htext.rb | |
parent | 4b5138d8888ad958ffc882f79d386083b5175da4 (diff) |
* ext/tk/lib/tkextlib/blt.rb: add BLT extension support
* ext/tk/lib/tkextlib/blt/*.rb: ditto
* ext/tk/lib/tkextlib/blt/tile/*.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/blt/htext.rb')
-rw-r--r-- | ext/tk/lib/tkextlib/blt/htext.rb | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb new file mode 100644 index 0000000000..29da9aa87f --- /dev/null +++ b/ext/tk/lib/tkextlib/blt/htext.rb @@ -0,0 +1,100 @@ +# +# 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 + 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 |