21 ! |
21 ! |
22 |
22 |
23 SelectionInTreeView subclass:#TreeView |
23 SelectionInTreeView subclass:#TreeView |
24 instanceVariableNames:'lastDrawnMaster cvsEventsDisabled imageMasterParent |
24 instanceVariableNames:'lastDrawnMaster cvsEventsDisabled imageMasterParent |
25 imageEmptyParent imageMasterChild windowSpec' |
25 imageEmptyParent imageMasterChild windowSpec' |
26 classVariableNames:'ImageMasterParent ImageMasterChild ImageEmptyParent' |
26 classVariableNames:'Images' |
27 poolDictionaries:'' |
27 poolDictionaries:'' |
28 privateIn:UIPainter |
28 privateIn:UIPainter |
29 ! |
29 ! |
30 |
30 |
31 !UIPainter class methodsFor:'documentation'! |
31 !UIPainter class methodsFor:'documentation'! |
2871 |
2871 |
2872 defaultNameOfCanvas |
2872 defaultNameOfCanvas |
2873 "returns the default name (id) of the application |
2873 "returns the default name (id) of the application |
2874 " |
2874 " |
2875 ^ 'Canvas' |
2875 ^ 'Canvas' |
2876 ! |
|
2877 |
|
2878 imageEmptyParent |
|
2879 <resource: #fileImage> |
|
2880 |
|
2881 |
|
2882 ImageEmptyParent isNil ifTrue:[ |
|
2883 ImageEmptyParent := Image fromFile:('xpmBitmaps/document_images/tiny_dir.xpm'). |
|
2884 ]. |
|
2885 ^ ImageEmptyParent |
|
2886 |
|
2887 " |
|
2888 ImageEmptyParent := nil |
|
2889 " |
|
2890 |
|
2891 "Modified: / 29.10.1997 / 03:36:37 / cg" |
|
2892 ! |
|
2893 |
|
2894 imageMasterChild |
|
2895 <resource: #fileImage> |
|
2896 |
|
2897 |
|
2898 ImageMasterChild isNil ifTrue:[ |
|
2899 ImageMasterChild := Image fromFile:('xpmBitmaps/document_images/tiny_file_plain_gray.xpm'). |
|
2900 ]. |
|
2901 ^ ImageMasterChild |
|
2902 |
|
2903 " |
|
2904 ImageMasterChild := nil |
|
2905 " |
|
2906 |
|
2907 "Modified: / 29.10.1997 / 03:36:42 / cg" |
|
2908 ! |
|
2909 |
|
2910 imageMasterParent |
|
2911 <resource: #fileImage> |
|
2912 |
|
2913 |
|
2914 ImageMasterParent isNil ifTrue:[ |
|
2915 ImageMasterParent := Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir_gray.xpm'). |
|
2916 ]. |
|
2917 ^ ImageMasterParent |
|
2918 |
|
2919 " |
|
2920 ImageMasterParent := nil |
|
2921 " |
|
2922 |
|
2923 "Modified: / 29.10.1997 / 03:36:47 / cg" |
|
2924 ! ! |
2876 ! ! |
2925 |
2877 |
2926 !UIPainter::TreeView class methodsFor:'documentation'! |
2878 !UIPainter::TreeView class methodsFor:'documentation'! |
2927 |
2879 |
2928 documentation |
2880 documentation |
3349 |
3301 |
3350 ! ! |
3302 ! ! |
3351 |
3303 |
3352 !UIPainter::TreeView methodsFor:'initialization'! |
3304 !UIPainter::TreeView methodsFor:'initialization'! |
3353 |
3305 |
3354 fetchImageResources |
|
3355 "get special images for UIPainter, |
|
3356 returns the maximum extent of all images" |
|
3357 |
|
3358 |extent| |
|
3359 |
|
3360 extent := super fetchImageResources. |
|
3361 |
|
3362 imageMasterChild := self class imageMasterChild. |
|
3363 imageMasterChild notNil ifTrue:[ |
|
3364 imageMasterChild := imageMasterChild onDevice:device. |
|
3365 extent := extent max:(imageMasterChild extent). |
|
3366 ]. |
|
3367 imageMasterParent := self class imageMasterParent. |
|
3368 imageMasterParent notNil ifTrue:[ |
|
3369 imageMasterParent := imageMasterParent onDevice:device. |
|
3370 extent := extent max:(imageMasterParent extent). |
|
3371 ]. |
|
3372 imageEmptyParent := self class imageEmptyParent. |
|
3373 imageEmptyParent notNil ifTrue:[ |
|
3374 imageEmptyParent := imageEmptyParent onDevice:device. |
|
3375 extent := extent max:(imageEmptyParent extent). |
|
3376 ]. |
|
3377 |
|
3378 ^ extent. |
|
3379 |
|
3380 "Modified: 19.9.1997 / 17:18:46 / stefan" |
|
3381 ! |
|
3382 |
|
3383 initialize |
3306 initialize |
3384 "initialization; set multiple select and model |
3307 "initialization; set multiple select and model |
3385 " |
3308 " |
|
3309 Images := Images ? IdentityDictionary new. |
3386 super initialize. |
3310 super initialize. |
3387 self multipleSelectOk:true. |
3311 self multipleSelectOk:true. |
3388 cvsEventsDisabled := false. |
3312 cvsEventsDisabled := false. |
3389 |
3313 self showDirectoryIndicator: true. |
|
3314 self showDirectoryIndicatorForRoot: false |
3390 ! ! |
3315 ! ! |
3391 |
3316 |
3392 !UIPainter::TreeView methodsFor:'private'! |
3317 !UIPainter::TreeView methodsFor:'private'! |
3393 |
3318 |
3394 figureFor:aNode |
3319 figureFor:aNode |
3395 "returns image for an item; testing whether item is the first |
3320 "returns image for an spec item" |
3396 entry into the selection |
3321 |
3397 " |
3322 |cls| |
3398 |master subComp| |
3323 |
3399 |
3324 cls := aNode contents spec class. |
3400 subComp := (aNode parent isNil or:[aNode contents spec class supportsSubComponents]). |
3325 aNode contents spec isNil ifTrue: [cls := UISpecification]. |
3401 |
3326 cls := cls withAllSuperclasses detect: [:cls| cls class implements: #icon] ifNone: [^nil]. |
3402 selection size == 0 ifFalse:[ |
3327 ^Images at: cls name ifAbsent: [Images at: cls name put: (cls icon onDevice: device)] |
3403 master := listOfNodes at:(selection first). |
|
3404 |
|
3405 aNode == master ifTrue:[ |
|
3406 lastDrawnMaster := master. |
|
3407 subComp ifFalse:[^ imageMasterChild] |
|
3408 ifTrue:[^ imageMasterParent]. |
|
3409 ] |
|
3410 ]. |
|
3411 subComp ifFalse:[ |
|
3412 ^ imageItem |
|
3413 ]. |
|
3414 aNode hasChildren ifTrue:[ |
|
3415 aNode isExpandable ifTrue:[ ^ imageClosed ] |
|
3416 ifFalse:[ ^ imageOpened ] |
|
3417 ]. |
|
3418 ^ imageEmptyParent |
|
3419 |
|
3420 ! |
3328 ! |
3421 |
3329 |
3422 selectionChangedFrom:oldSelection |
3330 selectionChangedFrom:oldSelection |
3423 "selection has changed. update master selection and raise notification |
3331 "selection has changed. update master selection and raise notification |
3424 to canvas in case of enabled cvs events |
3332 to canvas in case of enabled cvs events |