Class: Wx::Clipboard
- Inherits:
-
Object
- Object
- Wx::Clipboard
- Defined in:
- lib/wx/classes/clipboard.rb
Constant Summary collapse
- @@__clip_data =
Need to do some internal record-keeping to protect data objects on the clipboard from garbage collection
[]
Class Method Summary collapse
-
.open ⇒ Object
Class method to provide access to the clipboard within a ruby block.
Class Method Details
.open ⇒ Object
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.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wx/classes/clipboard.rb', line 10 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 |