LabelAndIcon.st
changeset 175 44a363de85f5
parent 172 c30e1ff9f9dd
child 176 ad0996413af4
equal deleted inserted replaced
174:4e9288efc48c 175:44a363de85f5
    52 
    52 
    53 !
    53 !
    54 
    54 
    55 examples
    55 examples
    56 "
    56 "
       
    57   in a listView:
    57                                                                         [exBegin]
    58                                                                         [exBegin]
    58     |top slv wrapper l fileImage dirImage|
    59     |top slv wrapper l fileImage dirImage|
    59 
    60 
    60     fileImage := Image 
    61     fileImage := Image 
    61                    width:16 
    62                    width:16 
   117 
   118 
   118     top := StandardSystemView extent:150@200.
   119     top := StandardSystemView extent:150@200.
   119     top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
   120     top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
   120     top open.
   121     top open.
   121                                                                         [exEnd]
   122                                                                         [exEnd]
       
   123   in a selectionInListView:
   122                                                                         [exBegin]
   124                                                                         [exBegin]
   123     |top slv wrapper l fileImage dirImage|
   125     |top slv wrapper l fileImage dirImage|
   124 
   126 
   125     dirImage := Image fromFile:'DirObj.xbm'.
   127     dirImage := Image fromFile:'DirObj.xbm'.
   126     fileImage := Image fromFile:'FileObj.xbm'.
   128     fileImage := Image fromFile:'FileObj.xbm'.
   141 
   143 
   142     top := StandardSystemView extent:150@200.
   144     top := StandardSystemView extent:150@200.
   143     top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
   145     top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
   144     top open.
   146     top open.
   145                                                                         [exEnd]
   147                                                                         [exEnd]
       
   148   in a menu:
       
   149                                                                         [exBegin]
       
   150     |top l fileImage dirImage|
       
   151 
       
   152     dirImage := Image fromFile:'DirObj.xbm'.
       
   153     fileImage := Image fromFile:'FileObj.xbm'.
       
   154 
       
   155 
       
   156     l := OrderedCollection new.
       
   157     l add:(LabelAndIcon icon:dirImage string:'create directory').
       
   158     l add:(LabelAndIcon icon:fileImage string:'create file').
       
   159 
       
   160     top := View new.
       
   161 
       
   162     top middleButtonMenu:(PopUpMenu labels:l
       
   163                         selectors:#(foo bar)).
       
   164 
       
   165     top open.
       
   166                                                                         [exEnd]
   146 "
   167 "
   147 ! !
   168 ! !
   148 
   169 
   149 !LabelAndIcon class methodsFor:'instance creation'!
   170 !LabelAndIcon class methodsFor:'instance creation'!
   150 
   171 
   184 
   205 
   185     icon := anIcon.
   206     icon := anIcon.
   186     string := aString
   207     string := aString
   187 
   208 
   188     "Created: 12.5.1996 / 20:00:52 / cg"
   209     "Created: 12.5.1996 / 20:00:52 / cg"
       
   210 !
       
   211 
       
   212 string
       
   213     ^ string
   189 ! !
   214 ! !
   190 
   215 
   191 !LabelAndIcon methodsFor:'displaying'!
   216 !LabelAndIcon methodsFor:'displaying'!
   192 
   217 
   193 displayOn:aGC x:x y:y opaque:opaque
   218 displayOn:aGC x:x y:y opaque:opaque
   240 ! !
   265 ! !
   241 
   266 
   242 !LabelAndIcon class methodsFor:'documentation'!
   267 !LabelAndIcon class methodsFor:'documentation'!
   243 
   268 
   244 version
   269 version
   245     ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.1 1996-05-12 19:05:36 cg Exp $'
   270     ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.2 1996-05-12 19:14:52 cg Exp $'
   246 ! !
   271 ! !