~ubuntu-branches/ubuntu/dapper/ruby1.9/dapper

« back to all changes in this revision

Viewing changes to ext/tk/lib/tkextlib/tcllib/panelframe.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
#  tkextlib/tcllib/panelframe.rb
 
3
#                               by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
 
4
#
 
5
#   * Part of tcllib extension
 
6
#   * Create PanelFrame widgets.
 
7
#
 
8
 
 
9
require 'tk'
 
10
require 'tkextlib/tcllib.rb'
 
11
 
 
12
# TkPackage.require('widget::panelframe', '1.0')
 
13
TkPackage.require('widget::panelframe')
 
14
 
 
15
module Tk::Tcllib
 
16
  module Widget
 
17
    class PanelFrame < TkWindow
 
18
      PACKAGE_NAME = 'widget::panelframe'.freeze
 
19
      def self.package_name
 
20
        PACKAGE_NAME
 
21
      end
 
22
 
 
23
      def self.package_version
 
24
        begin
 
25
          TkPackage.require('widget::panelframe')
 
26
        rescue
 
27
          ''
 
28
        end
 
29
      end
 
30
    end
 
31
    Panelframe = PanelFrame
 
32
  end
 
33
end
 
34
 
 
35
class Tk::Tcllib::Widget::PanelFrame
 
36
  TkCommandNames = ['::widget::panelframe'.freeze].freeze
 
37
 
 
38
  def create_self(keys)
 
39
    if keys and keys != None
 
40
      tk_call_without_enc(self.class::TkCommandNames[0], @path, 
 
41
                          *hash_kv(keys, true))
 
42
    else
 
43
      tk_call_without_enc(self.class::TkCommandNames[0], @path)
 
44
    end
 
45
  end
 
46
  private :create_self
 
47
 
 
48
  def add(what, *args)
 
49
    window(tk_send('add', *args))
 
50
  end
 
51
 
 
52
  #def get_frame
 
53
  #  window(tk_send('getframe'))
 
54
  #end
 
55
 
 
56
  def set_widget(widget)
 
57
    tk_send('setwidget', widget)
 
58
    self
 
59
  end
 
60
 
 
61
  def remove(*wins)
 
62
    tk_send('remove', *wins)
 
63
  end
 
64
  def remove_destroy(*wins)
 
65
    tk_send('remove', '-destroy', *wins)
 
66
  end
 
67
  alias delete remove_destroy
 
68
 
 
69
  def items
 
70
    simplelist(tk_send('items')).collect!{|w| window(w)}
 
71
  end
 
72
end