Sha256: f6171c8273202e4103ce0f9f38b1869b3e6c40394cb2444f55fd5b6dfc9eab47

Contents?: true

Size: 954 Bytes

Versions: 8

Compression:

Stored size: 954 Bytes

Contents

class Wx::Clipboard
  # See if we like these better
  alias :place :set_data
  alias :fetch :get_data

  class << self
    # This is provided internally by the SWIG interface file, but all
    # public access should be via Clipboard.open; see below
    private :get_global_clipboard

    # Class method to provide access to the clipboard within a ruby
    # block. Tests that the clipboard could be accessed, and ensures
    # that it is closed when the block is finished.
    def open
      clip = nil
      # Trying to access the segfault outside main_loop will segfault on
      # some platforms (eg, GTK)
      unless Wx::const_defined?(:THE_APP)
        raise RuntimeError, 
              "The clipboard can only be accessed when the App is running"
      end

      clip = get_global_clipboard
      unless clip.open
        Kernel.raise "Could not open clipboard"
      end
      yield clip
     ensure
       clip.close if clip
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
wxruby-1.9.10-universal-darwin-9 lib/wx/classes/clipboard.rb
wxruby-1.9.10-x86-linux lib/wx/classes/clipboard.rb
wxruby-1.9.10-x86-mswin32-60 lib/wx/classes/clipboard.rb
wxruby-1.9.10-x86-mingw32 lib/wx/classes/clipboard.rb
wxruby-1.9.10-x86_64-linux lib/wx/classes/clipboard.rb
wxruby-ruby19-1.9.10-x86-darwin-9 lib/wx/classes/clipboard.rb
wxruby-ruby19-1.9.10-x86-linux lib/wx/classes/clipboard.rb
wxruby-ruby19-1.9.10-x86-mingw32 lib/wx/classes/clipboard.rb