[squeak-dev] The Trunk: System-ul.493.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Aug 19 12:38:07 UTC 2012
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.493.mcz
==================== Summary ====================
Name: System-ul.493
Author: ul
Time: 16 August 2012, 4:07:05.302 pm
UUID: 9b43acfa-a8e6-6442-a8cb-34aa8ca2370a
Ancestors: System-cmm.492
- enh: Clipboard instances send notifications (triggerEvent) to their subscribers when their content changes.
=============== Diff against System-cmm.492 ===============
Item was changed:
Object subclass: #Clipboard
instanceVariableNames: 'contents recent interpreter'
classVariableNames: 'Default'
poolDictionaries: ''
category: 'System-Support'!
+ !Clipboard commentStamp: 'ul 8/16/2012 15:26' prior: 0!
+ The Clipboard class implements a basic buffering scheme for text. The currently selected text is also exported to the OS so that text can be copied from and to other applications. Commonly only a single instance is used (the default clipboard) but applications are free to use other than the default clipboard if necessary.
+
+ If you'd like to be notified of the changes of the clipboard, you can subscribe to it's #contentChanged event. For example:
+
+ | subscriber |
+ subscriber := [ :newClipboardText :updateSource |
+ Transcript show: ('Clipboard was updated by {1}, the new content is: {2}'
+ format: {
+ updateSource.
+ newClipboardText }); cr ].
+ Clipboard default
+ when: #contentChanged
+ send: #value:value:
+ to: subscriber.
+
+ To unsubscribe from the clipboard changes, just evaluate:
+
+ Clipboard default removeActionsWithReceiver: subscriber!
- !Clipboard commentStamp: '<historical>' prior: 0!
- The Clipboard class implements a basic buffering scheme for text. The currently selected text is also exported to the OS so that text can be copied from and to other applications. Commonly only a single instance is used (the default clipboard) but applications are free to use other than the default clipboard if necessary.!
Item was changed:
----- Method: Clipboard>>clipboardText: (in category 'accessing') -----
clipboardText: text
+ self clipboardText: text notifyWith: nil!
- | string |
- string := text asString.
- self noteRecentClipping: text asText.
- contents := text asText.
- string := self interpreter toSystemClipboard: string.
- self primitiveClipboardText: string.
- !
Item was added:
+ ----- Method: Clipboard>>clipboardText:notifyWith: (in category 'accessing') -----
+ clipboardText: text notifyWith: anObject
+ "Set the contents of the clipboard to text. anObject can be used as a marker for the source of the clipboard change, the default value is nil."
+
+ | string |
+ string := text asString.
+ self noteRecentClipping: text asText.
+ contents := text asText.
+ string := self interpreter toSystemClipboard: string.
+ self primitiveClipboardText: string.
+ self triggerEvent: #contentChanged withArguments: { text. anObject }!
More information about the Squeak-dev
mailing list
|