Class: Java::OrgEclipseSwtWidgets::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/sweet/shell.rb

Overview

TODO pack into WIDGETS

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



44
45
46
# File 'lib/sweet/shell.rb', line 44

def method_missing(name, *args, &block)
  Sweet.create_widget(sweet_containers.last, name, *args, &block) || super
end

Instance Attribute Details

#displayObject (readonly)

Returns the value of attribute display.



3
4
5
# File 'lib/sweet/shell.rb', line 3

def display
  @display
end

Instance Method Details

#busy(&block) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/sweet/shell.rb', line 26

def busy(&block)
  Thread.new do
    perform do
      custom::BusyIndicator.showWhile(display) do
        block.call
      end
    end
  end
end


36
37
38
# File 'lib/sweet/shell.rb', line 36

def menubar(&block)
  self.menu_bar = make_menu(:menubar, &block)
end

#perform(&block) ⇒ Object



22
23
24
# File 'lib/sweet/shell.rb', line 22

def perform(&block)
  display.syncExec block
end


40
41
42
# File 'lib/sweet/shell.rb', line 40

def popup(&block)
  self.menu = make_menu(:popup, &block)
end

#sweet_containersObject



18
19
20
# File 'lib/sweet/shell.rb', line 18

def sweet_containers
  @sweet_containers ||= [self]
end

#sweeten(display, name, opts = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sweet/shell.rb', line 6

def sweeten(display, name, opts = {}, &block)
  @display = display

  self.text = opts.delete(:title) || name
  w, h = opts.delete(:width), opts.delete(:height)

  super(self, opts, &block)

  pack
  size = (w || width), (h || height)
end