Class: TkInspect::CanvasWindow::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/tk_inspect/canvas_window/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



9
10
11
12
# File 'lib/tk_inspect/canvas_window/base.rb', line 9

def initialize
  @tk_root = nil
  @main_component = nil
end

Instance Attribute Details

#main_componentObject

Returns the value of attribute main_component.



5
6
7
# File 'lib/tk_inspect/canvas_window/base.rb', line 5

def main_component
  @main_component
end

#tk_rootObject

Returns the value of attribute tk_root.



4
5
6
# File 'lib/tk_inspect/canvas_window/base.rb', line 4

def tk_root
  @tk_root
end

Instance Method Details

#create_rootObject



19
20
21
22
23
24
# File 'lib/tk_inspect/canvas_window/base.rb', line 19

def create_root
  @tk_root = TkComponent::Window.new(title: "Canvas Window")
  @main_component = RootComponent.new
  @main_component.canvas_window = self
  @tk_root.place_root_component(@main_component)
end

#new_turtleObject



26
27
28
# File 'lib/tk_inspect/canvas_window/base.rb', line 26

def new_turtle
  TkComponent::Turtle.new(canvas: main_component.canvas)
end

#refreshObject



14
15
16
17
# File 'lib/tk_inspect/canvas_window/base.rb', line 14

def refresh
  @main_component.nil? ? create_root : @main_component.regenerate
  self
end