Class Limelight::Stage
In: lib/limelight/stage.rb
Parent: Object

In the metephorical sense, a Stage is a platform which may hold a scene. In a more, to-the-point sence, a Stage represents a window on the computer screen. The Stage objects within a Production are configured by the StagesBuilder. By default a Production will have one Stage. A Stage may open any number of Scenes but it may only have one current scene loaded at a time.

Methods

Included Modules

UI::Api::Stage

Attributes

current_scene  [R] 
default_scene  [RW] 
frame  [R] 
name  [R] 
theater  [R] 

Public Class methods

To create a new Stage, it be given a Theater to which it belongs, and the name is optional. If no name is provided it will default to ‘default’. A stage name must be unique, so it is recommended you provide a name.

[Source]

    # File lib/limelight/stage.rb, line 26
26:     def initialize(theater, name, options = {})
27:       @theater = theater
28:       @name = name
29:       build_frame
30:       self.title = @name
31:       apply_options(options)
32:     end

Public Instance methods

Invoked when the stage has become the active stage on the desktop. Only 1 stage my be active at a time. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 306
306:     def activated(e)
307:       @theater.stage_activated(self)
308:     end

Pops up a simple modal dialog with the provided message.

[Source]

     # File lib/limelight/stage.rb, line 231
231:     def alert(message)
232:       Thread.new do
233:         begin
234:           Context.instance.studio.utilities_production.alert(message)
235:         rescue StandardError => e
236:           puts "Error on alert: #{e}"
237:         end
238:       end
239:     end

When true, the stage will remain on top of all other windows.

[Source]

     # File lib/limelight/stage.rb, line 162
162:     def always_on_top=(value)
163:       @frame.always_on_top = value
164:     end

Return true if the stage has been set to always be on top.

[Source]

     # File lib/limelight/stage.rb, line 168
168:     def always_on_top?
169:       return @frame.always_on_top
170:     end

Returns the background color of the stage in the format RRGGBB(AA)

[Source]

     # File lib/limelight/stage.rb, line 143
143:     def background_color
144:       return @frame.background_color
145:     end

Sets the background color of the stage

[Source]

     # File lib/limelight/stage.rb, line 137
137:     def background_color=(value)
138:       @frame.background_color = value.to_s
139:     end

Opens a file chooser window to select a file on the file system. Options may include:

  • :description => a string describing the desired file
  • :directory => starting directory
  • :title => title of the window
  • :directories_only => boolean, true if the user must select a directory
  • :files_only => boolean, true if the user must select a file

[Source]

     # File lib/limelight/stage.rb, line 223
223:     def choose_file(options={}, &block)
224:       options[:parent] = @frame
225:       chooser = FileChooser.new(options, &block)
226:       return chooser.choose_file
227:     end

Closes the Stage. It‘s window will no longer be displayed on the screen.

[Source]

     # File lib/limelight/stage.rb, line 200
200:     def close
201:       @frame.close
202:     end

Invoked when the stage has been closed. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 270
270:     def closed(e)
271:       @current_scene.visible = false if @current_scene
272:       @current_scene = nil
273:       @theater.stage_closed(self)
274:     end

returns true if the stage has been closed. Closed stages may not be reopened.

[Source]

     # File lib/limelight/stage.rb, line 257
257:     def closed?
258:       return @frame.closed?
259:     end

Invoked when the stage is being closed. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 264
264:     def closing(e)
265:     end

Invoked when the stage has lost status as the active stage. Only 1 stage my have focus at a time. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 313
313:     def deactivated(e)
314:       @theater.stage_deactivated(self)  
315:     end

Invoked when the stage has been deiconified. This occurs when the icon for the stage has been removed from the taskbar or dock, and the stage is again visible on the desktop. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 300
300:     def deiconified(e)
301:     end

Invoked when the stage has gained focus on the desktop. Only 1 stage my have focus at a time. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 279
279:     def focus_gained(e)
280:       @theater.stage_activated(self)
281:     end

Invoked when the stage has lost focus on the desktop. Only 1 stage my have focus at a time. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 286
286:     def focus_lost(e)
287:     end

When true, the stage will be frame with the operating system‘s standard window frame including close, minimize, and maximize buttons

[Source]

     # File lib/limelight/stage.rb, line 150
150:     def framed=(value)
151:       @frame.setUndecorated(!value)
152:     end

Return true if the stage is framed.

[Source]

     # File lib/limelight/stage.rb, line 156
156:     def framed?
157:       return !@frame.isUndecorated()
158:     end

Turns fullscreen mode on and off. In fullscreen mode, the stage will fill the entire screen and appear on top of all other windows.

  stage.fullscreen = true

[Source]

    # File lib/limelight/stage.rb, line 87
87:     def fullscreen=(on)
88:       @frame.setFullScreen(on)
89:     end

Returns true if the stage is in fullscreen mode.

[Source]

    # File lib/limelight/stage.rb, line 93
93:     def fullscreen?
94:       return @frame.isFullScreen()
95:     end

Hides the stage so that it is not visible on the screen without destroying it.

[Source]

     # File lib/limelight/stage.rb, line 119
119:     def hide
120:       @frame.visible = false
121:     end

Invoked when the stage has been iconified. This occurs when the stage is no longer visible on the desktop and an icon for the stage has been added to the OS‘s taskbar or dock. System hook that should NOT be called by you.

[Source]

     # File lib/limelight/stage.rb, line 293
293:     def iconified(e)
294:     end

Turns kiosk mode for this stage on and off. When on, the stage will:

  * be fullscreen
  * not be frames
  * disable OS key commands
    * OS X: Cmd-Tab, Cmd-Alt-Esc, etc...
    * Windows: Alt-Tab, Ctrl-Esc, etc... (Ctrl-Alt-Del must be disabled through a registry entry)

  stage.kiosk = true

[Source]

     # File lib/limelight/stage.rb, line 106
106:     def kiosk=(on)
107:       @frame.setKiosk(on)
108:     end

Return true if the stage is in kiosk mode.

[Source]

     # File lib/limelight/stage.rb, line 112
112:     def kiosk?
113:       return @frame.isKiosk()
114:     end

Loads a scene on the Stage. If the Stage is currently hosting a Scene, the original Scene will be removed and the new Scene will replace it.

[Source]

     # File lib/limelight/stage.rb, line 207
207:     def load_scene(scene)      
208:       #      @frame.setJMenuBar(scene.menu_bar)
209:       @frame.load(scene.panel)
210:       if (has_static_size?(scene.style))
211:         @frame.set_size(scene.style.compiled_width.value + @frame.getHorizontalInsetWidth, scene.style.compiled_height.value + @frame.getVerticalInsetWidth)
212:       end
213:       @current_scene = scene
214:     end

The location styles of the Stage.

  x, y = stage.location

[Source]

    # File lib/limelight/stage.rb, line 68
68:     def location
69:       return @frame.getXLocationStyle.to_s, @frame.getYLocationStyle.to_s
70:     end

Sets the location styles of the Stage.

  stage.location = [500, 200]

[Source]

    # File lib/limelight/stage.rb, line 76
76:     def location=(*values)
77:       values = values[0] if values.size == 1 && values[0].is_a?(Array)
78:       @frame.set_location_styles(values[0], values[1])
79:     end

Opens the Stage and loads the provided Scene.

See load_scene

[Source]

     # File lib/limelight/stage.rb, line 188
188:     def open(scene)
189:       @current_scene.visible = false if @current_scene
190:       scene.stage = self
191:       scene.illuminate
192:       load_scene(scene)
193:       @frame.open unless @should_remain_hidden
194:       scene.visible = true
195:       scene.scene_opened(self)
196:     end

Called when the user or system would like to close the stage. The stage will return true, allowing it to be closed, unless the current_scene defines the allow_close? method in which case the decision it left up to the current_scene.

[Source]

     # File lib/limelight/stage.rb, line 245
245:     def should_allow_close
246:       return true if @current_scene.nil?
247:       return true if !@current_scene.respond_to?(:allow_close?)
248:       return @current_scene.allow_close?
249:     end

Shows the stage after having hiding it.

[Source]

     # File lib/limelight/stage.rb, line 125
125:     def show
126:       @frame.visible = true unless @should_remain_hidden
127:     end

Returns the width and height styles of the Stage.

  width, height = stage.size

[Source]

    # File lib/limelight/stage.rb, line 50
50:     def size
51:       return @frame.width_style.to_s, @frame.height_style.to_s
52:     end

Sets the width and height styles of the Stage.

  state.size = [100, 200]
  state.size = ["50%", "100%"] # consuming 50% of the width and 100% of the height of the screen

[Source]

    # File lib/limelight/stage.rb, line 59
59:     def size=(*values)
60:       values = values[0] if values.size == 1 && values[0].is_a?(Array)
61:       @frame.set_size_styles(values[0], values[1])
62:     end

Returns the title that is displayed at the top of the window that this stage represents.

[Source]

    # File lib/limelight/stage.rb, line 36
36:     def title
37:       return @frame.title
38:     end

Sets the title that is displayed at the top of the window that this stage represents.

[Source]

    # File lib/limelight/stage.rb, line 42
42:     def title=(value)
43:       @frame.title = value
44:     end

Returns true if the stage is visible on the screen.

[Source]

     # File lib/limelight/stage.rb, line 131
131:     def visible?
132:       return @frame.visible
133:     end

Sets the vitality of the stage. Limelight will not exit while vital frames remain visible.

[Source]

     # File lib/limelight/stage.rb, line 174
174:     def vital=(value)
175:       @frame.vital = value
176:     end

Returns true if this is a vital stage. Limelight will not exit while vital frames remain visible.

[Source]

     # File lib/limelight/stage.rb, line 180
180:     def vital?
181:       return @frame.vital?
182:     end

Protected Instance methods

[Source]

     # File lib/limelight/stage.rb, line 319
319:     def new_frame
320:       return UI::Model::Frame.new(self)
321:     end

[Validate]