Class: Rabbit::Frame

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ScreenInfo
Defined in:
lib/rabbit/frame.rb

Direct Known Subclasses

EmbedFrame

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ScreenInfo

default_screen, mm_to_inch, screen_depth, screen_height, screen_height_mm, screen_width, screen_width_mm, screen_x_resolution, screen_y_resolution

Constructor Details

#initialize(logger, canvas) ⇒ Frame

Returns a new instance of Frame.



30
31
32
33
34
# File 'lib/rabbit/frame.rb', line 30

def initialize(logger, canvas)
  @logger = logger
  @canvas = canvas
  @geometry = nil
end

Instance Attribute Details

#geometryObject

Returns the value of attribute geometry.



28
29
30
# File 'lib/rabbit/frame.rb', line 28

def geometry
  @geometry
end

#loggerObject (readonly)

Returns the value of attribute logger.



27
28
29
# File 'lib/rabbit/frame.rb', line 27

def logger
  @logger
end

#windowObject (readonly)

Returns the value of attribute window.



27
28
29
# File 'lib/rabbit/frame.rb', line 27

def window
  @window
end

Instance Method Details

#destroyed?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/rabbit/frame.rb', line 36

def destroyed?
  @window.nil? or @window.destroyed?
end

#fullscreenObject



58
59
60
# File 'lib/rabbit/frame.rb', line 58

def fullscreen
  @window.fullscreen
end

#fullscreen?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/rabbit/frame.rb', line 74

def fullscreen?
  @fullscreen
end

#fullscreen_available?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/rabbit/frame.rb', line 94

def fullscreen_available?
  true
end

#heightObject



50
51
52
# File 'lib/rabbit/frame.rb', line 50

def height
  @window.size[1]
end

#iconify_available?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/rabbit/frame.rb', line 98

def iconify_available?
  true
end

#init_gui(width, height, main_window, window_type = nil) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/rabbit/frame.rb', line 86

def init_gui(width, height, main_window, window_type=nil)
  init_window(width, height, window_type)
  @fullscreen = false
  @main_window = main_window
  @window.show
  @canvas.post_init_gui
end

#main_window?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/rabbit/frame.rb', line 78

def main_window?
  @main_window
end

#parse(source, callback = nil, &block) ⇒ Object



54
55
56
# File 'lib/rabbit/frame.rb', line 54

def parse(source, callback=nil, &block)
  @canvas.parse(source, callback, &block)
end

#quitObject



40
41
42
43
44
# File 'lib/rabbit/frame.rb', line 40

def quit
  @window.destroy unless destroyed?
  @window = nil
  true
end

#toggle_fullscreenObject



66
67
68
69
70
71
72
# File 'lib/rabbit/frame.rb', line 66

def toggle_fullscreen
  if fullscreen?
    unfullscreen
  else
    fullscreen
  end
end

#unfullscreenObject



62
63
64
# File 'lib/rabbit/frame.rb', line 62

def unfullscreen
  @window.unfullscreen
end

#update_title(new_title) ⇒ Object



82
83
84
# File 'lib/rabbit/frame.rb', line 82

def update_title(new_title)
  @window.title = Utils.unescape_title(new_title)
end

#widthObject



46
47
48
# File 'lib/rabbit/frame.rb', line 46

def width
  @window.size[0]
end