1#
2#  tkextlib/bwidget/statusbar.rb
3#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
4#
5
6require 'tk'
7require 'tk/frame'
8require 'tkextlib/bwidget.rb'
9
10module Tk
11  module BWidget
12    class StatusBar < TkWindow
13    end
14  end
15end
16
17class Tk::BWidget::StatusBar
18  TkCommandNames = ['StatusBar'.freeze].freeze
19  WidgetClassName = 'StatusBar'.freeze
20  WidgetClassNames[WidgetClassName] ||= self
21
22  def __boolval_optkeys
23    super() << 'showresize' << 'showseparator' << 'showresizesep'
24  end
25  private :__boolval_optkeys
26
27  def add(win, keys={})
28    tk_send('add', win, keys)
29    self
30  end
31
32  def remove(*wins)
33    tk_send('remove', *wins)
34    self
35  end
36
37  def remove_with_destroy(*wins)
38    tk_send('remove', '-destroy', *wins)
39    self
40  end
41
42  def delete(*wins) # same to 'remove_with_destroy'
43    tk_send('delete', *wins)
44    self
45  end
46
47  def get_frame(&b)
48    win = window(tk_send_without_enc('getframe'))
49    if b
50      if TkCore::WITH_RUBY_VM  ### Ruby 1.9 !!!!
51        win.instance_exec(self, &b)
52      else
53        win.instance_eval(&b)
54      end
55    end
56    win
57  end
58
59  def items
60    simplelist(tk_send('items')).map{|w| window(w)}
61  end
62end
63