LabelAndIcon.st
changeset 3782 729c0808727b
parent 3781 715591d6adff
child 4128 9782e35719f8
--- a/LabelAndIcon.st	Tue Oct 20 15:00:44 2009 +0200
+++ b/LabelAndIcon.st	Tue Oct 20 15:21:07 2009 +0200
@@ -37,15 +37,12 @@
 
 documentation
 "
-    an icon, a string and an image side by side (from left to right).
-    Each may be nil (i.e. with nil image, it's a Label-and-Icon proper (icon to the left of the string);
-    with nil icon, it's a string with an image to the right.
+    an icon, an optional additional image and a string, all by side (from left to right).
+    Each may be nil (i.e. with a nil image, it's a Label-and-Icon proper (icon to the left of the string).
 
     Usable as list entries in a listView (a fileList), as
     popUpMenuItems or as Label/Button image.
 
-    This is an example class - currently not used by the system.
-
     Notice:
         This is different from ST-80's LabelAndIcon class, which
         inherits from Label. Therefore, things may change in the future.
@@ -131,8 +128,8 @@
                                                                         [exBegin]
     |top slv wrapper l fileImage dirImage|
 
-    dirImage := Image fromFile:'DirObj.xbm'.
-    fileImage := Image fromFile:'FileObj.xbm'.
+    dirImage := Image fromFile:'../../goodies/bitmaps/xpmBitmaps/document_images/file_dir.xpm'.
+    fileImage := Image fromFile:'../../goodies/bitmaps/xpmBitmaps/document_images/file_text.xpm'.
 
 
     l := OrderedCollection new.
@@ -156,18 +153,19 @@
                                                                         [exBegin]
     |top l image1 image2|
 
-    image1 := Image fromFile:'../../goodies/bitmaps/xpmBitmaps/countries/brazil.xpm'.
+    image1 := Image fromFile:'../../goodies/bitmaps/xpmBitmaps/countries/argentina.xpm'.
     image2 := Image fromFile:'../../goodies/bitmaps/xpmBitmaps/countries/germany.xpm'.
 
     l := OrderedCollection new.
     l add:(LabelAndIcon icon:image1 string:'brazil').
     l add:(LabelAndIcon icon:image2 string:'germany').
 
-    top := View new.
+    top := StandardSystemView new.
     top middleButtonMenu:(PopUpMenu 
                         labels:l
                         selectors:#(foo bar)).
-
+    top label:'Try the right-button menu'.
+    top extent:300@300.
     top open.
                                                                         [exEnd]
   in a button/label:
@@ -390,7 +388,9 @@
     imageHeight  := imageValue notNil ifTrue:[imageValue height]  ifFalse:[0].
     stringHeight := string size > 0 ifTrue:[string heightOn:aGC] ifFalse:[0].
 
-    maxHeight := ((iconHeight max: imageHeight) + gapY) max: stringHeight.
+    "/ maxHeight := ((iconHeight max: imageHeight) + gapY) max: stringHeight.
+    maxHeight := self heightOn:aGC.
+
     x1 := x + offset.
 
     iconValue notNil ifTrue:[
@@ -512,9 +512,9 @@
 !LabelAndIcon class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.40 2009-10-20 13:00:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.41 2009-10-20 13:21:07 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.40 2009-10-20 13:00:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.41 2009-10-20 13:21:07 cg Exp $'
 ! !