--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LinkButton.st Thu Mar 05 22:18:55 2009 +0100
@@ -0,0 +1,74 @@
+"{ Package: 'stx:libwidg2' }"
+
+Button subclass:#LinkButton
+ instanceVariableNames:'labelsAndActions'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Layout'
+!
+
+!LinkButton class methodsFor:'documentation'!
+
+documentation
+"
+ Looks like a Label, but behaves like a button with individually clickable text components.
+ Can be used to create htmp-page-look-alike links in a view.
+
+ [author:]
+ cg (cg@CG-VOSTRO)
+
+ [instance variables:]
+
+ [class variables:]
+
+ [see also:]
+
+"
+!
+
+examples
+"
+ |v l|
+
+ v := StandardSystemView new.
+ l := LinkButton in:v.
+ l labelsAndActions:{
+ 'Hello' -> [ self halt:'Hello'].
+ ' ' -> nil.
+ 'World' -> [ self halt:'World'].
+ }.
+ l foregroundColor:Color blue.
+ v open
+"
+! !
+
+!LinkButton methodsFor:'accessing'!
+
+labelsAndActions
+ "returns the collection of label->action associations.
+ For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
+ When clicked on a string, the corresponding action is called"
+
+ ^ labelsAndActions
+!
+
+labelsAndActions:aCollectionOfAssociations
+ "set the collection of label->action associations.
+ For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
+ When clicked on a string, the corresponding action is called"
+
+ labelsAndActions := aCollectionOfAssociations.
+ self label:((aCollectionOfAssociations collect:[:assoc | assoc key]) asStringWith:'')
+! !
+
+!LinkButton methodsFor:'initialization'!
+
+defaultControllerClass
+ ^ LinkButtonController
+! !
+
+!LinkButton class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.1 2009-03-05 21:18:55 cg Exp $'
+! !