Class: Rabbit::Frame
- Inherits:
-
Object
- Object
- Rabbit::Frame
- Extended by:
- Forwardable
- Defined in:
- lib/rabbit/frame.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#geometry ⇒ Object
Returns the value of attribute geometry.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #destroyed? ⇒ Boolean
- #fullscreen ⇒ Object
- #fullscreen? ⇒ Boolean
- #fullscreen_available? ⇒ Boolean
- #height ⇒ Object
- #iconify_available? ⇒ Boolean
- #in_terminal? ⇒ Boolean
- #init_gui(width, height, main_window, window_type = nil) ⇒ Object
-
#initialize(logger, canvas) ⇒ Frame
constructor
A new instance of Frame.
- #main_window? ⇒ Boolean
- #parse(source, callback = nil, &block) ⇒ Object
- #quit ⇒ Object
- #toggle_fullscreen ⇒ Object
- #toggle_terminal ⇒ Object
- #unfullscreen ⇒ Object
- #update_title(new_title) ⇒ Object
- #width ⇒ Object
Constructor Details
permalink #initialize(logger, canvas) ⇒ Frame
Returns a new instance of Frame.
53 54 55 56 57 58 59 60 |
# File 'lib/rabbit/frame.rb', line 53 def initialize(logger, canvas) @logger = logger @canvas = canvas @geometry = nil @notebook = nil @terminal = nil @running = true end |
Instance Attribute Details
permalink #geometry ⇒ Object
Returns the value of attribute geometry.
51 52 53 |
# File 'lib/rabbit/frame.rb', line 51 def geometry @geometry end |
permalink #logger ⇒ Object (readonly)
Returns the value of attribute logger.
50 51 52 |
# File 'lib/rabbit/frame.rb', line 50 def logger @logger end |
permalink #window ⇒ Object (readonly)
Returns the value of attribute window.
50 51 52 |
# File 'lib/rabbit/frame.rb', line 50 def window @window end |
Instance Method Details
permalink #destroyed? ⇒ Boolean
62 63 64 |
# File 'lib/rabbit/frame.rb', line 62 def destroyed? @window.nil? or @window.destroyed? end |
permalink #fullscreen ⇒ Object
[View source]
85 86 87 |
# File 'lib/rabbit/frame.rb', line 85 def fullscreen @window.fullscreen end |
permalink #fullscreen? ⇒ Boolean
101 102 103 |
# File 'lib/rabbit/frame.rb', line 101 def fullscreen? @fullscreen end |
permalink #fullscreen_available? ⇒ Boolean
123 124 125 |
# File 'lib/rabbit/frame.rb', line 123 def fullscreen_available? true end |
permalink #height ⇒ Object
[View source]
77 78 79 |
# File 'lib/rabbit/frame.rb', line 77 def height @window.size[1] end |
permalink #iconify_available? ⇒ Boolean
127 128 129 |
# File 'lib/rabbit/frame.rb', line 127 def iconify_available? true end |
permalink #in_terminal? ⇒ Boolean
141 142 143 144 |
# File 'lib/rabbit/frame.rb', line 141 def in_terminal? return false if @terminal.nil? @notebook.current_page == @notebook.page_num(@terminal) end |
permalink #init_gui(width, height, main_window, window_type = nil) ⇒ Object
[View source]
113 114 115 116 117 118 119 120 121 |
# File 'lib/rabbit/frame.rb', line 113 def init_gui(width, height, main_window, window_type=nil) init_window(width, height, window_type) @fullscreen = false @main_window = main_window @terminal.show if @terminal @notebook.show if @notebook @window.show @canvas.post_init_gui end |
permalink #main_window? ⇒ Boolean
105 106 107 |
# File 'lib/rabbit/frame.rb', line 105 def main_window? @main_window end |
permalink #parse(source, callback = nil, &block) ⇒ Object
[View source]
81 82 83 |
# File 'lib/rabbit/frame.rb', line 81 def parse(source, callback=nil, &block) @canvas.parse(source, callback, &block) end |
permalink #quit ⇒ Object
[View source]
66 67 68 69 70 71 |
# File 'lib/rabbit/frame.rb', line 66 def quit @running = false @window.destroy unless destroyed? @window = nil true end |
permalink #toggle_fullscreen ⇒ Object
[View source]
93 94 95 96 97 98 99 |
# File 'lib/rabbit/frame.rb', line 93 def toggle_fullscreen if fullscreen? unfullscreen else fullscreen end end |
permalink #toggle_terminal ⇒ Object
[View source]
131 132 133 134 135 136 137 138 139 |
# File 'lib/rabbit/frame.rb', line 131 def toggle_terminal return if @terminal.nil? terminal_page = @notebook.page_num(@terminal) if @notebook.current_page == terminal_page @notebook.current_page = 0 else @notebook.current_page = terminal_page end end |
permalink #unfullscreen ⇒ Object
[View source]
89 90 91 |
# File 'lib/rabbit/frame.rb', line 89 def unfullscreen @window.unfullscreen end |
permalink #update_title(new_title) ⇒ Object
[View source]
109 110 111 |
# File 'lib/rabbit/frame.rb', line 109 def update_title(new_title) @window.title = Utils.unescape_title(new_title) end |
permalink #width ⇒ Object
[View source]
73 74 75 |
# File 'lib/rabbit/frame.rb', line 73 def width @window.size[0] end |