Class: Canis::Tab

Inherits:
Object show all
Defined in:
lib/canis/core/widgets/rtabbedpane.rb

Overview

class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, parent_component, aconfig = {}, &block) ⇒ Tab

Returns a new instance of Tab.



549
550
551
552
553
554
555
556
557
558
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 549

def initialize text, parent_component,  aconfig={}, &block
  @text   = text
  @items  = []
  @config = aconfig
  @parent_component = parent_component
  @row_offset ||= 2
  @col_offset ||= 2
  @config.each_pair { |k,v| variable_set(k,v) }
  instance_eval &block if block_given?
end

Instance Attribute Details

#buttonObject

so you can set an event on it 2011-10-4



546
547
548
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 546

def button
  @button
end

#col_offsetObject

Returns the value of attribute col_offset.



548
549
550
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 548

def col_offset
  @col_offset
end

#configObject (readonly)

Returns the value of attribute config.



542
543
544
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 542

def config
  @config
end

#indexObject

Returns the value of attribute index.



545
546
547
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 545

def index
  @index
end

#itemsObject (readonly)

Returns the value of attribute items.



543
544
545
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 543

def items
  @items
end

#parent_componentObject

Returns the value of attribute parent_component.



544
545
546
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 544

def parent_component
  @parent_component
end

#row_offsetObject

Returns the value of attribute row_offset.



547
548
549
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 547

def row_offset
  @row_offset
end

#textObject

Returns the value of attribute text.



541
542
543
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 541

def text
  @text
end

Instance Method Details

#item(widget) ⇒ Object



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/canis/core/widgets/rtabbedpane.rb', line 559

def item widget
  widget.form = @parent_component.form
  widget.override_graphic @parent_component.form.window
  # these will fail if TP put inside some other container. NOTE
  widget.row ||= 0
  widget.col ||= 0
  # If we knew it was only widget we could expand it
  if widget.kind_of?(Canis::Container) #|| widget.respond_to?(:width)
    widget.width ||= @parent_component.width-3
  end
  # Darn ! this was setting Label to fully height
  if widget.kind_of?(Canis::Container) #|| widget.respond_to?(:height)
    widget.height ||= @parent_component.height-3
  end
  # i don't know button_offset as yet
  widget.row += @row_offset + @parent_component.row  + 1
  widget.col += @col_offset + @parent_component.col
  @items << widget
end