Class: Cura::Window

Overview

A window containing a drawing area.

Instance Attribute Summary

Attributes included from Attributes::HasRoot

#root

Attributes included from Attributes::HasEvents

#event_handler

Attributes included from Attributes::HasApplication

#application

Instance Method Summary collapse

Methods included from Attributes::HasRoot

#add_child, #add_children, #children, #children?, #delete_child, #delete_child_at, #delete_children

Methods included from Attributes::HasAttributes

included, #update_attributes

Methods included from Attributes::HasEvents

included, #on_event

Methods included from Attributes::HasDimensions

#height, #height=, #resize, #width, #width=

Methods included from Attributes::HasCoordinates

#x, #x=, #y, #y=

Constructor Details

#initialize(attributes = {}) ⇒ Window

Returns a new instance of Window.



26
27
28
29
30
# File 'lib/cura/window.rb', line 26

def initialize(attributes={})
  super

  @focus_controller = FocusController.new(window: self)
end

Instance Method Details

#drawWindow

Draw this window’s children.

Returns:



44
45
46
47
48
49
50
# File 'lib/cura/window.rb', line 44

def draw
  application.adapter.clear
  @root.draw
  application.adapter.present

  self
end

#hideWindow

Hide this window.

Returns:



62
63
64
# File 'lib/cura/window.rb', line 62

def hide
  self # TODO
end

#inspectString

Instance inspection.

Returns:

  • (String)


92
93
94
# File 'lib/cura/window.rb', line 92

def inspect
  "#<#{self.class}:0x#{__id__.to_s(16)} application=#{@application.class}:0x#{@application.__id__.to_s(16)}>"
end

#parentWindow

Return this window’s parent.

Returns:



69
70
71
# File 'lib/cura/window.rb', line 69

def parent # TODO: Needed?
  @application
end

#root=(value) ⇒ Component::Group

Set root component for this object.

Parameters:

Returns:

Raises:

  • (TypeError)


77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cura/window.rb', line 77

def root=(value)
  raise TypeError, "root must be a Component::Group" unless value.is_a?(Component::Group)

  @root.parent = nil unless @root.nil?

  @root = value
  @root.parent = self
  @root.focus

  @root
end

#showWindow

Show this window.

Returns:



55
56
57
# File 'lib/cura/window.rb', line 55

def show
  self # TODO
end

#updateWindow

Update this window’s components.

Returns:



35
36
37
38
39
# File 'lib/cura/window.rb', line 35

def update
  @root.update

  self
end