1# 2# tkextlib/iwidgets/watch.rb 3# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) 4# 5 6require 'tk' 7require 'tkextlib/iwidgets.rb' 8 9module Tk 10 module Iwidgets 11 class Watch < Tk::Itk::Widget 12 end 13 end 14end 15 16class Tk::Iwidgets::Watch 17 TkCommandNames = ['::iwidgets::watch'.freeze].freeze 18 WidgetClassName = 'Watch'.freeze 19 WidgetClassNames[WidgetClassName] ||= self 20 21 def __boolval_optkeys 22 super() << 'showampm' 23 end 24 private :__boolval_optkeys 25 26 def __strval_optkeys 27 super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << 28 'pivotcolor' << 'secondcolor' << 'tickcolor' 29 end 30 private :__strval_optkeys 31 32 def get_string 33 tk_call(@path, 'get', '-string') 34 end 35 alias get get_string 36 37 def get_clicks 38 number(tk_call(@path, 'get', '-clicks')) 39 end 40 41 def show(time=None) 42 tk_call(@path, 'show', time) 43 self 44 end 45 def show_now 46 tk_call(@path, 'show', 'now') 47 self 48 end 49 50 def watch(*args) 51 unless args.empty? 52 tk_call(@path, 'watch', *args) 53 end 54 component_path('canvas') 55 end 56end 57