Skip to content
Browse files

Impremented clipboard and clipboard= methods. Thanks, Roger! http://w…

…ww.ruby-forum.com/topic/4047238 This is a test snippet:

require 'purple_shoes'
Shoes.app do
  el = edit_line
  button('get'){@msg.text = clipboard}
  button('set'){self.clipboard = el.text}
  @msg = para
end
  • Loading branch information...
1 parent 003f068 commit 40e133b9e470c8fe7298a6617fa7e13ef4ecc78f @ashbb committed Apr 14, 2012
Showing with 14 additions and 3 deletions.
  1. +1 −1 VERSION
  2. +3 −0 lib/purple_shoes.rb
  3. +8 −0 lib/shoes/app.rb
  4. +2 −2 purple_shoes.gemspec
View
2 VERSION
@@ -1 +1 @@
-0.0.126
+0.0.127
View
3 lib/purple_shoes.rb
@@ -31,6 +31,9 @@ module Swt
include_package 'org.eclipse.swt.widgets'
include_package 'org.eclipse.swt.graphics'
include_package 'org.eclipse.swt.events'
+ include_package 'org.eclipse.swt.dnd'
+ import java.awt.datatransfer.StringSelection
+ import java.awt.Toolkit
end
class Object
View
8 lib/shoes/app.rb
@@ -680,6 +680,14 @@ def scroll_max
shell.getVerticalBar.getMaximum - 10
end
+ def clipboard
+ Swt::Clipboard.new(Shoes.display).getContents Swt::TextTransfer.getInstance
+ end
+
+ def clipboard=(str)
+ Swt::Toolkit.getDefaultToolkit.getSystemClipboard.setContents Swt::StringSelection.new(str), Shoes
+ end
+
def close
@shell.close
Shoes.APPS.delete self
View
4 purple_shoes.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "purple_shoes"
- s.version = "0.0.126"
+ s.version = "0.0.127"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["ashbb"]
- s.date = "2012-04-10"
+ s.date = "2012-04-14"
s.description = "Purple Shoes is one of colorful Shoes, written in JRuby and SWT."
s.email = "ashbbb@gmail.com"
s.executables = ["pshoes"]

0 comments on commit 40e133b

Please sign in to comment.
Something went wrong with that request. Please try again.