Class: WR::Splitter::Pane

Inherits:
Array
  • Object
show all
Defined in:
lib/wrb/components/splitter.rb

Instance Method Summary collapse

Constructor Details

#initialize(onr) ⇒ Pane

Returns a new instance of Pane.



10
11
12
# File 'lib/wrb/components/splitter.rb', line 10

def initialize(onr)
  @owner = onr
end

Instance Method Details

#<<(arg) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wrb/components/splitter.rb', line 14

def <<(arg)
  if arg.is_a?(Splitter)
    raise "Already other control exixts in this pane." if self.size>0
    arg.mother = @owner
  end
  if @owner.parent && !@owner.parent.controls.index(arg)
    if @owner.respond_to?(:owner)
      super(@owner.owner << arg)
    else
      super(@owner.parent.controls << arg)
    end
  else
    super
  end
  class << arg
    attr_reader :__ownedbysplitter
  end
  self.uniq!
  @owner.__send__(:_resize_panes) if @owner.alive? #; dpp @owner.name, arg.name, arg.x
  arg
end

#clearObject



48
49
50
51
# File 'lib/wrb/components/splitter.rb', line 48

def clear()
  self.each{|i| i.margin=nil}
  super
end

#delete(arg) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/wrb/components/splitter.rb', line 36

def delete(arg)
  if arg.is_a?(Splitter)
    arg.delete
  else
    arg.margin = nil
  end
  class << arg
    undef :__ownedbysplitter
  end
  super
end