class Gtk2HTML::WidgetInstructions

Attributes

layout[RW]

Public Class Methods

new(layout=nil) click to toggle source
# File lib/gtk2html.rb, line 422
def initialize(layout=nil)

  @layout = layout if layout

end

Public Instance Methods

add_inputbox(margin, coords, padding, style) click to toggle source
# File lib/gtk2html.rb, line 429
def add_inputbox(margin, coords, padding, style)
  
  h2 = style.clone
  h2.delete :color

  x1, y1, x2, y2 = coords

  width = x2 - x1
  height = y2 - y1
        
  entry = Gtk::Entry.new
  entry.set_text('type something')        
  @layout.put entry, 10,40 
  
end
render(a) click to toggle source
# File lib/gtk2html.rb, line 445
def render(a)      
  add a
end

Private Instance Methods

add(a) click to toggle source
# File lib/gtk2html.rb, line 452
def add(a)

  return unless a
  
  if a.first.is_a? Symbol then
    
    name, margin, coords, padding, style, _, *children = a                  
    return if name =~ /^draw_/
    method(name).call(margin, coords, padding, style)
    add children
    
  else
  
    a.each do |row|

      next unless row

      x = row

      case row[0].class.to_s.to_sym

      when :Symbol

        name, margin, coords, padding, style, _, *children = x
                
        next if name =~ /^draw_/
        method(name).call(margin, coords, padding, style)
        add children
        
      when :'Rexle::Element::Value' then

        next 

      when :Array

        if row[-1][0].is_a? String then
          next
        else
          add row[-1]
        end
      else    
        
        name, *args = x

        next if name =~ /^draw_/
        method(name).call(args)
        add row[-1]
      end

    end
  end
    
end