From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb (limited to 'jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb') diff --git a/jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb b/jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb new file mode 100644 index 0000000..c34281d --- /dev/null +++ b/jni/ruby/ext/tk/lib/tkextlib/iwidgets/timefield.rb @@ -0,0 +1,58 @@ +# +# tkextlib/iwidgets/timefield.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' +require 'tkextlib/iwidgets.rb' + +module Tk + module Iwidgets + class Timefield < Tk::Iwidgets::Labeledwidget + end + end +end + +class Tk::Iwidgets::Timefield + TkCommandNames = ['::iwidgets::timefield'.freeze].freeze + WidgetClassName = 'Timefield'.freeze + WidgetClassNames[WidgetClassName] ||= self + + def __boolval_optkeys + super() << 'gmt' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'textbackground' + end + private :__strval_optkeys + + def __font_optkeys + super() << 'textfont' + end + private :__font_optkeys + + def get_string + tk_call(@path, 'get', '-string') + end + alias get get_string + + def get_clicks + number(tk_call(@path, 'get', '-clicks')) + end + + def valid? + bool(tk_call(@path, 'isvalid')) + end + alias isvalid? valid? + + def show(time=None) + tk_call(@path, 'show', time) + self + end + def show_now + tk_call(@path, 'show', 'now') + self + end +end -- cgit v1.2.3