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/tcllib/statusbar.rb | 79 ++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 jni/ruby/ext/tk/lib/tkextlib/tcllib/statusbar.rb (limited to 'jni/ruby/ext/tk/lib/tkextlib/tcllib/statusbar.rb') diff --git a/jni/ruby/ext/tk/lib/tkextlib/tcllib/statusbar.rb b/jni/ruby/ext/tk/lib/tkextlib/tcllib/statusbar.rb new file mode 100644 index 0000000..46a4b9d --- /dev/null +++ b/jni/ruby/ext/tk/lib/tkextlib/tcllib/statusbar.rb @@ -0,0 +1,79 @@ +# +# tkextlib/tcllib/statusbar.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * statusbar widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::statusbar', '1.2') +TkPackage.require('widget::statusbar') + +module Tk::Tcllib + module Widget + class Statusbar < Tk::Tile::TFrame + PACKAGE_NAME = 'widget::statusbar'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::statusbar') + rescue + '' + end + end + end + end +end + +class Tk::Tcllib::Widget::Statusbar + TkCommandNames = ['::widget::statusbar'.freeze].freeze + + def __boolval_optkeys + super() << 'separator' << 'resize' << 'resizeseparator' + end + private :__boolval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def getframe + window(tk_send_without_enc('getframe')) + end + alias get_frame getframe + + def add(w, keys={}) + window(tk_send_without_enc('setwidget', *(hash_kv(keys)))) + end + + def remove(*wins) + tk_send_without_enc('remove', *wins) + self + end + + def remove_with_destroy(*wins) + tk_send_without_enc('remove', '-destroy', *wins) + self + end + + def delete(*wins) + tk_send_without_enc('delete', *wins) + self + end + + def items(pat=None) + tk_split_list(tk_send('items', pat)) + end +end -- cgit v1.2.3