1#
2#  tkextlib/tcllib/widget.rb
3#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4#
5#   * Part of tcllib extension
6#   * megawidget package that uses snit as the object system (snidgets)
7#
8
9require 'tk'
10require 'tkextlib/tcllib.rb'
11
12# TkPackage.require('widget', '3.0')
13TkPackage.require('widget')
14
15module Tk::Tcllib
16  module Widget
17    PACKAGE_NAME = 'widget'.freeze
18    def self.package_name
19      PACKAGE_NAME
20    end
21
22    def self.package_version
23      begin
24        TkPackage.require('widget')
25      rescue
26        ''
27      end
28    end
29
30    #--- followings may be private functions of tklib
31    def self.isa(compare_as, *args)
32      begin
33        return Tk.tk_call('::widget::isa', compare_as, *args)
34      rescue => e
35        if TkComm.bool(Tk.tk_call('info','command','::widget::isa')) ||
36            ! TkComm.bool(Tk.tk_call('info','command','::widget::validate'))
37          fail e
38        end
39      end
40      Tk.tk_call('::widget::validate', compare_as, *args)
41    end
42    def self.validate(compare_as, *args)
43      begin
44        return Tk.tk_call('::widget::validate', compare_as, *args)
45      rescue => e
46        if TkComm.bool(Tk.tk_call('info','command','::widget::validate')) ||
47            ! TkComm.bool(Tk.tk_call('info','command','::widget::isa'))
48          fail e
49        end
50      end
51      Tk.tk_call('::widget::isa', compare_as, *args)
52    end
53  end
54end
55
56module Tk::Tcllib::Widget
57  TkComm::TkExtlibAutoloadModule.unshift(self)
58
59  autoload :Calendar,           'tkextlib/tcllib/calendar'
60
61  autoload :Canvas_Sqmap,       'tkextlib/tcllib/canvas_sqmap'
62  autoload :Canvas_Zoom,        'tkextlib/tcllib/canvas_zoom'
63
64  autoload :Dialog,             'tkextlib/tcllib/dialog'
65
66  autoload :Panelframe,         'tkextlib/tcllib/panelframe'
67  autoload :PanelFrame,         'tkextlib/tcllib/panelframe'
68
69  autoload :Ruler,              'tkextlib/tcllib/ruler'
70
71  autoload :Screenruler,        'tkextlib/tcllib/screenruler'
72  autoload :ScreenRuler,        'tkextlib/tcllib/screenruler'
73
74  autoload :Scrolledwindow,     'tkextlib/tcllib/scrollwin'
75  autoload :ScrolledWindow,     'tkextlib/tcllib/scrollwin'
76
77  autoload :Superframe,         'tkextlib/tcllib/superframe'
78  autoload :SuperFrame,         'tkextlib/tcllib/superframe'
79
80  autoload :Toolbar,            'tkextlib/tcllib/toolbar'
81  autoload :ToolbarItem,        'tkextlib/tcllib/toolbar'
82end
83