From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- .../ext/tk/lib/tkextlib/bwidget/pagesmanager.rb | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 jni/ruby/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb (limited to 'jni/ruby/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb') diff --git a/jni/ruby/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb b/jni/ruby/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb new file mode 100644 index 0000000..31bbf1f --- /dev/null +++ b/jni/ruby/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb @@ -0,0 +1,73 @@ +# +# tkextlib/bwidget/pagesmanager.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# + +require 'tk' +require 'tk/frame' +require 'tkextlib/bwidget.rb' + +module Tk + module BWidget + class PagesManager < TkWindow + end + end +end + +class Tk::BWidget::PagesManager + TkCommandNames = ['PagesManager'.freeze].freeze + WidgetClassName = 'PagesManager'.freeze + WidgetClassNames[WidgetClassName] ||= self + + def tagid(id) + # id.to_s + _get_eval_string(id) + end + + def add(page, &b) + win = window(tk_send('add', tagid(page))) + if b + if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!! + win.instance_exec(self, &b) + else + win.instance_eval(&b) + end + end + win + end + + def compute_size + tk_send('compute_size') + self + end + + def delete(page) + tk_send('delete', tagid(page)) + self + end + + def get_frame(page, &b) + win = window(tk_send('getframe', tagid(page))) + if b + if TkCore::WITH_RUBY_VM ### Ruby 1.9 !!!! + win.instance_exec(self, &b) + else + win.instance_eval(&b) + end + end + win + end + + def get_page(page) + tk_send('pages', page) + end + + def pages(first=None, last=None) + list(tk_send('pages', first, last)) + end + + def raise(page=None) + tk_send('raise', page) + self + end +end -- cgit v1.2.3