Class: Shul::Window
- Inherits:
-
Object
- Object
- Shul::Window
- Defined in:
- lib/shul.rb
Defined Under Namespace
Classes: Radiogroup
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #add_element(node) ⇒ Object
-
#initialize(shoes, doc) ⇒ Window
constructor
A new instance of Window.
- #refresh ⇒ Object
- #remove_element(node) ⇒ Object
Constructor Details
#initialize(shoes, doc) ⇒ Window
Returns a new instance of Window.
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/shul.rb', line 452 def initialize(shoes, doc) @shoes = shoes @width, @height = 100, 100 @doc = doc def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end @doc.root.elements.each do |x| method(x.name.sub(':','_').to_sym).call(x) unless x.name == 'script' end @doc.root.xpath('script').each {|x| script x } h = @doc.root.attributes if h[:onkeypress] then shoes.keypress do |k| method(h[:onkeypress][/^[a-z]\w+/].to_sym).call(k) end end icon = h[:icon] if icon then file = Tempfile.new('shoes').path File.write file, RXFHelper.read(icon).first shoes.win.icon = file end end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
450 451 452 |
# File 'lib/shul.rb', line 450 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
450 451 452 |
# File 'lib/shul.rb', line 450 def width @width end |
Class Method Details
.element_by_id(id) ⇒ Object
459 460 461 |
# File 'lib/shul.rb', line 459 def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end |
Instance Method Details
#add_element(node) ⇒ Object
490 491 492 493 494 495 |
# File 'lib/shul.rb', line 490 def add_element(node) node.obj = method(node.name.sub(':','_').to_sym).call(node) refresh() end |
#refresh ⇒ Object
497 498 499 |
# File 'lib/shul.rb', line 497 def refresh @shoes.flush if @shoes end |
#remove_element(node) ⇒ Object
501 502 503 504 505 506 |
# File 'lib/shul.rb', line 501 def remove_element(node) node.obj.clear node.obj = nil refresh() end |