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.
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/shul.rb', line 412 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.
410 411 412 |
# File 'lib/shul.rb', line 410 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
410 411 412 |
# File 'lib/shul.rb', line 410 def width @width end |
Class Method Details
.element_by_id(id) ⇒ Object
419 420 421 |
# File 'lib/shul.rb', line 419 def @doc.element_by_id(id) self.root.element("//*[@id='#{id}']") end |
Instance Method Details
#add_element(node) ⇒ Object
449 450 451 452 453 454 |
# File 'lib/shul.rb', line 449 def add_element(node) node.obj = method(node.name.sub(':','_').to_sym).call(node) refresh() end |
#refresh ⇒ Object
456 457 458 |
# File 'lib/shul.rb', line 456 def refresh @shoes.flush if @shoes end |
#remove_element(node) ⇒ Object
460 461 462 463 |
# File 'lib/shul.rb', line 460 def remove_element(node) node.obj.clear refresh() end |