lib/shoes/swt/app.rb in shoes-swt-4.0.0.pre8 vs lib/shoes/swt/app.rb in shoes-swt-4.0.0.pre9
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
class Shoes
module Swt
shoes_icon = ::Shoes::ICON
if shoes_icon.include? 'uri:classloader'
ICON = File.join(Dir.tmpdir, 'shoes-icon.png').freeze
@@ -87,14 +88,22 @@
def height
shell.client_area.height
end
+ def open?
+ !disposed?
+ end
+
def disposed?
@shell.disposed? || @real.disposed?
end
+ def focus
+ @shell.force_active
+ end
+
def redraw(left = nil, top = nil, width = nil, height = nil, all = true)
unless @real.disposed?
if left.nil? || top.nil? || width.nil? || height.nil?
@real.redraw
else
@@ -126,11 +135,12 @@
end
def clipboard=(str)
::Swt::Clipboard.new(Shoes.display).setContents(
[str].to_java,
- [::Swt::TextTransfer.getInstance].to_java(::Swt::TextTransfer)
+ [::Swt::TextTransfer.getInstance].to_java(::Swt::TextTransfer),
+ ::Swt::DND::DND::CLIPBOARD
)
end
def fullscreen=(state)
@shell.full_screen = state
@@ -326,10 +336,10 @@
shell = event.widget
width = shell.client_area.width
height = shell.client_area.height
@app.real.setSize width, height
@app.real.layout
- @app.dsl.resize_callbacks.each(&:call)
+ @app.dsl.trigger_resize_callbacks
end
def controlMoved(_e)
end
end