summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tkentry.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:37:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:37:52 +0000
commit0a64817fb80016030c03518fb9459f63c11605ea (patch)
tree3ea2e607f9ea08c56830ef7b803cd259e3d67c7f /ext/tk/lib/tkentry.rb
parent210367ec889f5910e270d6ea2c7ddb8a8d939e61 (diff)
remove marshal/gtk/kconv
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkentry.rb')
-rw-r--r--ext/tk/lib/tkentry.rb73
1 files changed, 73 insertions, 0 deletions
diff --git a/ext/tk/lib/tkentry.rb b/ext/tk/lib/tkentry.rb
new file mode 100644
index 00000000000..b834c455c6c
--- /dev/null
+++ b/ext/tk/lib/tkentry.rb
@@ -0,0 +1,73 @@
+#
+# tkentry.rb - Tk entry classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
+
+require 'tk.rb'
+
+class TkEntry<TkLabel
+ WidgetClassName = 'Entry'.freeze
+ TkClassBind::WidgetClassNameTBL[WidgetClassName] = self
+ def self.to_eval
+ WidgetClassName
+ end
+
+ def create_self
+ tk_call 'entry', @path
+ end
+ def scrollcommand(cmd)
+ configure 'scrollcommand', cmd
+ end
+
+ def delete(s, e=None)
+ tk_send 'delete', s, e
+ end
+
+ def cursor
+ tk_send 'index', 'insert'
+ end
+ def cursor=(index)
+ tk_send 'icursor', index
+ end
+ def index(index)
+ number(tk_send('index', index))
+ end
+ def insert(pos,text)
+ tk_send 'insert', pos, text
+ end
+ def mark(pos)
+ tk_send 'scan', 'mark', pos
+ end
+ def dragto(pos)
+ tk_send 'scan', 'dragto', pos
+ end
+ def selection_adjust(index)
+ tk_send 'selection', 'adjust', index
+ end
+ def selection_clear
+ tk_send 'selection', 'clear', 'end'
+ end
+ def selection_from(index)
+ tk_send 'selection', 'from', index
+ end
+ def selection_present()
+ tk_send('selection', 'present') == 1
+ end
+ def selection_range(s, e)
+ tk_send 'selection', 'range', s, e
+ end
+ def selection_to(index)
+ tk_send 'selection', 'to', index
+ end
+ def xview(*index)
+ tk_send 'xview', *index
+ end
+
+ def value
+ tk_send 'get'
+ end
+ def value= (val)
+ tk_send 'delete', 0, 'end'
+ tk_send 'insert', 0, val
+ end
+end