UIGalleryView.st
author Patrik Svestka <patrik.svestka@gmail.com>
Wed, 14 Nov 2018 12:07:51 +0100
branchjv
changeset 3630 5e718e0a754e
parent 3313 dc9f18489a12
permissions -rw-r--r--
Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present

- All source *.st files are now Unicode UTF8 without BOM
Files are in two groups (fileOut works this way in Smalltalk/X):
- containing a unicode character have "{ Encoding: utf8 }" at the header
- ASCII only are without the header
     1 "
     2  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
     3 	      All Rights Reserved
     4 
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    11 "
    12 "{ Package: 'stx:libtool2' }"
    13 
    14 "{ NameSpace: Smalltalk }"
    15 
    16 NoteBookView subclass:#UIGalleryView
    17 	instanceVariableNames:'majorKey minorKeys minorKeysHolder'
    18 	classVariableNames:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    21 !
    22 
    23 View subclass:#Palette
    24 	instanceVariableNames:'clientSpecHolder selection specification lastClickPoint
    25 		menuSelector uiBuilder hiddenCounter showBorders
    26 		didWarnAboutUnknownSpecs'
    27 	classVariableNames:''
    28 	poolDictionaries:''
    29 	privateIn:UIGalleryView
    30 !
    31 
    32 DropObject subclass:#DropSpec
    33 	instanceVariableNames:''
    34 	classVariableNames:''
    35 	poolDictionaries:''
    36 	privateIn:UIGalleryView::Palette
    37 !
    38 
    39 !UIGalleryView class methodsFor:'documentation'!
    40 
    41 copyright
    42 "
    43  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
    44 	      All Rights Reserved
    45 
    46  This software is furnished under a license and may be used
    47  only in accordance with the terms of that license and with the
    48  inclusion of the above copyright notice.   This software may not
    49  be provided or otherwise made available to, or used by, any
    50  other person.  No title to or ownership of the software is
    51  hereby transferred.
    52 "
    53 
    54 
    55 !
    56 
    57 documentation
    58 "
    59     implements a selection panel, keeping widgets which could be placed
    60     into other components by drag & drop or copy @ paste. The objects
    61     which are draged/droped must be kind of UISpecification's.
    62     The UISelectionPanel used by the UIPainter is implemented in this way.
    63 
    64     [author:]
    65 	Claus Gittinger
    66 	Claus Atzkern
    67 
    68     [see also:]
    69 	UIPainter
    70 	UISelectionPanel
    71 "
    72 
    73 !
    74 
    75 examples
    76 "
    77     opens a gallery
    78 
    79 									[exBegin]
    80     |top sel|
    81 
    82     top := StandardSystemView new label:'gallery'; extent:500@300.
    83     sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
    84 
    85     sel labels:#(    'Buttons'
    86 		     'Panels'
    87 		     'Text'
    88 		   ).
    89 
    90     sel minorKeys:#( #standardButtonToggle
    91 		     #standardPanels
    92 		     #standardText
    93 		   ).
    94 
    95     sel majorKey:UISelectionPanel.
    96     top open.
    97 									[exEnd]
    98 "
    99 ! !
   100 
   101 !UIGalleryView methodsFor:'accessing'!
   102 
   103 builder
   104     "get the builder used to setup a window from a specification (or nil in case
   105      of using a new builder)
   106     "
   107   ^ canvas builder
   108 !
   109 
   110 builder:aBuilderOrNil
   111     "set the builder used to setup a window from a specification (or nil in case
   112      of using a new builder)
   113     "
   114     canvas builder:aBuilderOrNil
   115 !
   116 
   117 canvas:aCanvas
   118     ^ self
   119 
   120 !
   121 
   122 labels:listOfLabels minorKeys:listOfMinorKeys majorKey:aMajorKey
   123     "setup for labels, selectors and class provider
   124     "
   125     self labels:listOfLabels.
   126     minorKeys := listOfMinorKeys.
   127     majorKey  := aMajorKey.
   128 !
   129 
   130 majorKey
   131     "get the class providing the window specifications
   132     "
   133   ^ majorKey
   134 !
   135 
   136 majorKey:aKey
   137     "get the class providing the window specifications
   138     "
   139     |appl|
   140 
   141     appl := self application.
   142 
   143     appl notNil ifTrue:[
   144 	majorKey := appl resolveName:aKey
   145     ] ifFalse:[
   146 	majorKey := Smalltalk resolveName:aKey inClass:self class
   147     ].
   148     self selection:nil
   149 !
   150 
   151 minorKeys
   152     "get the list of selector keys
   153     "
   154   ^ minorKeys
   155 !
   156 
   157 minorKeys:aListOfSelectors
   158     "set the list of selectors
   159     "
   160     minorKeys := aListOfSelectors.
   161     self selection:nil.
   162 !
   163 
   164 showBorders:aBoolean
   165     "show borders around dragable objects"
   166 
   167     canvas showBorders:aBoolean.
   168 ! !
   169 
   170 !UIGalleryView methodsFor:'accessing-colors'!
   171 
   172 viewBackground:aColor
   173     canvas notNil ifTrue:[
   174         canvas viewBackground:aColor.
   175     ].
   176     ^ super viewBackground:aColor
   177 ! !
   178 
   179 !UIGalleryView methodsFor:'accessing-holders'!
   180 
   181 clientSpecHolder
   182     "get the holder which keeps the current selection or in case of
   183      no selection the specification under the cursor
   184     "
   185   ^ canvas clientSpecHolder
   186 !
   187 
   188 clientSpecHolder:aHolder
   189     "set the holder which keeps the current selection or in case of
   190      no selection the specification under the cursor
   191     "
   192     canvas clientSpecHolder:aHolder
   193 !
   194 
   195 menuSelector
   196     ^ canvas menuSelector
   197 !
   198 
   199 menuSelector:aSelector
   200     ^ canvas menuSelector:aSelector
   201 !
   202 
   203 minorKeysHolder
   204     "get the holder keeping the minor keys; the selectors to access
   205      specifications from a class associated with the majorKey.
   206     "
   207   ^ minorKeysHolder
   208 !
   209 
   210 minorKeysHolder:aValueHolder
   211     "set the holder keeping the minor keys; the selectors to access
   212      specifications from a class associated with the majorKey.
   213     "
   214     minorKeysHolder notNil ifTrue:[
   215 	minorKeysHolder removeDependent:self. 
   216     ].
   217 
   218     (minorKeysHolder := aValueHolder) notNil ifTrue:[
   219 	minorKeysHolder addDependent:self.
   220     ].
   221     self minorKeys:(minorKeysHolder value)
   222 ! !
   223 
   224 !UIGalleryView methodsFor:'change & update'!
   225 
   226 selectionHasChanged
   227     "selection changed
   228     "
   229     |specification selector selection application|
   230 
   231     selection := self listIndexOf:(self selection).
   232 
   233     minorKeysHolder notNil ifTrue:[
   234         minorKeys := minorKeysHolder value.
   235     ].
   236     (selection notNil and:[minorKeys size >= selection]) ifTrue:[
   237         selector := minorKeys at:selection.
   238 
   239         (majorKey respondsTo:selector) ifTrue:[
   240             specification := majorKey perform:selector
   241         ] ifFalse:[
   242             (application := self application) notNil ifTrue:[
   243                 MessageNotUnderstood handle:[:ex|
   244                     (application class respondsTo:selector) ifTrue:[
   245                         specification := application class perform:selector
   246                     ]
   247                 ] do:[
   248                     specification := application aspectFor:selector
   249                 ]
   250             ]
   251         ]
   252     ].
   253 "/    self withWaitCursorDo:[
   254         [
   255             canvas specification:specification.
   256         ] on:NotFoundError do:[:ex|
   257             Transcript showCR:ex description.
   258             ex proceed.
   259         ]
   260 "/    ]
   261 !
   262 
   263 update
   264     self selectionHasChanged.
   265 !
   266 
   267 update:something with:aParameter from:changedObject
   268     "one of my models changed its value
   269     "
   270     changedObject == minorKeysHolder ifTrue:[
   271         ^ self minorKeys:( minorKeysHolder value)
   272     ].
   273     super update:something with:aParameter from:changedObject.
   274 
   275 ! !
   276 
   277 !UIGalleryView methodsFor:'initialization & release'!
   278 
   279 initialize
   280     "setup default attributes
   281     "
   282     canvas := Palette in:self.
   283 
   284     super initialize.
   285 
   286     self action:[:something| self selectionHasChanged ].
   287 !
   288 
   289 release
   290     minorKeysHolder notNil ifTrue:[
   291         minorKeysHolder removeDependent:self. 
   292         minorKeysHolder := nil.
   293     ].
   294     super release.
   295 ! !
   296 
   297 !UIGalleryView::Palette class methodsFor:'documentation'!
   298 
   299 documentation
   300 "
   301     I am the palette of a gallery. Most of what I do is to allow dragging of a widget out
   302     of myself and to care for the drawing of the selection.
   303     The arrangement into multiple pages is done by my container, which holds me
   304     in a subcanvas.
   305 "
   306 ! !
   307 
   308 !UIGalleryView::Palette methodsFor:'accessing'!
   309 
   310 builder
   311     "get the builder used to setup a window from a specification (or nil in case
   312      of using a new builder)
   313     "
   314   ^ uiBuilder
   315 !
   316 
   317 builder:something
   318     "set the builder used to setup a window from a specification (or nil in case
   319      of using a new builder)
   320     "
   321     uiBuilder := something.
   322 !
   323 
   324 clientSpecHolder
   325     "get the holder which keeps the current selection or in case of
   326      no selection the specification under the cursor
   327     "
   328     ^ clientSpecHolder
   329 !
   330 
   331 clientSpecHolder:aHolder
   332     "set the holder which keeps the current selection or in case of
   333      no selection the specification under the cursor
   334     "
   335     |spec|
   336 
   337     spec := clientSpecHolder value.
   338 
   339     aHolder notNil ifTrue:[ clientSpecHolder := aHolder ]
   340                   ifFalse:[ clientSpecHolder := nil asValue ].
   341 
   342     clientSpecHolder value:spec.
   343 !
   344 
   345 menuSelector
   346     "return the value of the instance variable 'menuSelector' (automatically generated)"
   347 
   348     ^ menuSelector
   349 !
   350 
   351 menuSelector:something
   352     "set the value of the instance variable 'menuSelector' (automatically generated)"
   353 
   354     menuSelector := something.
   355 !
   356 
   357 showBorders:aBoolean
   358     showBorders := aBoolean.
   359 !
   360 
   361 specification
   362     "get current specification
   363     "
   364     ^ specification
   365 !
   366 
   367 specification:aSpecOrSpecArray
   368     "set a new specification"
   369 
   370     |builder newSpec|
   371 
   372     self selection:nil.
   373     self destroySubViews.
   374 
   375     specification := nil.
   376     aSpecOrSpecArray isNil ifTrue:[^ self].
   377 
   378     "/ only warn once - otherwise, its annoying
   379     MissingClassInLiteralArrayErrorSignal handle:[:ex |
   380         didWarnAboutUnknownSpecs == true ifFalse:[
   381             Dialog warn:(ex description,'\\(Will not warn again - please check for unloaded classes/packages)' withCRs).
   382         ].
   383         didWarnAboutUnknownSpecs := true.
   384         ex proceed.
   385     ] do:[
   386         newSpec := UISpecification from:aSpecOrSpecArray.
   387     ].
   388     newSpec isNil ifTrue:[^ self].
   389     (newSpec respondsTo:#'buildViewFor:in:') ifFalse:[^ self].
   390     specification := newSpec.
   391 
   392     (builder := uiBuilder) isNil ifTrue:[
   393         builder := UIBuilder new isEditing:true.
   394         builder showDefaults:true.
   395         builder application:self application. "/ for resources like images
   396     ].
   397 
   398     specification buildViewFor:builder in:self.
   399 
   400     "/ components notEmptyOrNil ifTrue:[ self halt ].
   401     subViews size ~~ 0 ifTrue:[
   402         showBorders ifTrue:[
   403             subViews do:[:v|
   404                 (self findSpecFor:v) notNil ifTrue:[
   405                     v borderWidth:1
   406                 ].
   407             ].
   408         ].
   409         realized ifTrue:[ self realizeAllSubViews ].
   410     ].
   411 ! !
   412 
   413 !UIGalleryView::Palette methodsFor:'building'!
   414 
   415 recursiveBuildSpecFromSpecPrototype:aSpec
   416     "build spec out of spec prototype"
   417 
   418     |spec comp coll|
   419 
   420     (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[
   421         ^ nil
   422     ].
   423 
   424     spec := aSpec copy.
   425     (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[
   426         ^ spec
   427     ].
   428     comp := aSpec component.
   429     spec component:nil.
   430 
   431     comp canUIDrag ifFalse:[
   432         ^ spec
   433     ].
   434     coll := OrderedCollection new.
   435 
   436     comp do:[:anEntry|
   437         |spc|
   438 
   439         (spc := self recursiveBuildSpecFromSpecPrototype:anEntry) notNil ifTrue:[
   440             coll add:spc
   441         ]
   442     ].
   443     coll isEmpty ifTrue:[
   444         ^ spec
   445     ].
   446     comp := comp copy.
   447     comp collection:coll.
   448     spec component:comp.
   449     ^ spec
   450 ! !
   451 
   452 !UIGalleryView::Palette methodsFor:'drag & drop'!
   453 
   454 startDragFrom:evView
   455     "start drag at lastClickPoint"
   456 
   457     |spec dragObj offset clickPos dragAndDropManager|
   458 
   459     clickPos := lastClickPoint.
   460     clickPos isNil ifTrue:[^ self].
   461     lastClickPoint := nil.
   462 
   463     spec := clientSpecHolder value.
   464     spec isNil ifTrue:[^ self].
   465 
   466     self withSelectionHiddenDo:[
   467         spec := self recursiveBuildSpecFromSpecPrototype:spec.
   468         spec name:nil.
   469 
   470         dragObj := DropSpec for:selection specification:spec.
   471         offset  := clickPos - selection origin.
   472     ].
   473 
   474     dragAndDropManager := DragAndDropManager new.
   475     dragAndDropManager giveFocusToTargetWidget:false.
   476 
   477     dragAndDropManager 
   478         startDrag:dragObj
   479         from:self
   480         offset:offset
   481         atEnd:nil
   482         display:nil.
   483 ! !
   484 
   485 !UIGalleryView::Palette methodsFor:'event handling'!
   486 
   487 processEvent:anEvent
   488     "filter keyboard events.
   489      Return true, if I have eaten the event"
   490 
   491     |evView p|
   492 
   493     evView := anEvent view.
   494     evView isNil ifTrue:[ ^ false ].
   495     (evView ~~ self and:[ (evView isComponentOf:self) not ]) ifTrue:[ ^ false ].
   496 
   497     (anEvent isButtonPressEvent or:[anEvent isButtonReleaseEvent])ifTrue:[
   498         lastClickPoint := nil.
   499     ].
   500     anEvent isButtonEvent ifFalse:[
   501         anEvent isInputEvent ifTrue:[^ true].
   502 
   503         anEvent isDamage ifTrue:[ self redrawSelection ].
   504         ^ false
   505     ].
   506 
   507     anEvent isButtonReleaseEvent ifTrue:[ ^ true ].
   508 
   509     anEvent isButtonMotionEvent ifTrue:[
   510         (lastClickPoint notNil and:[anEvent state ~~ 0]) ifTrue:[
   511             p := Point x:(anEvent x) y:(anEvent y).
   512             p := device translatePoint:p fromView:evView toView:self.
   513 
   514             (lastClickPoint dist:p) > 20.0 ifTrue:[
   515                 self startDragFrom:evView.
   516                 lastClickPoint := nil.
   517             ]
   518         ].
   519         ^ true
   520     ].
   521 
   522     anEvent isButtonPressEvent ifTrue:[
   523         |button application|
   524 
   525         button := anEvent button.
   526 
   527         (button == 1 or:[button == #select]) ifTrue:[
   528             p := Point x:(anEvent x) y:(anEvent y).
   529             p := device translatePoint:p fromView:evView toView:self.
   530 
   531             self selection:(self findObjectAt:p).
   532 
   533             selection notNil ifTrue:[
   534                 lastClickPoint := p.
   535             ]
   536         ] ifFalse:[
   537             (menuSelector notNil and:[(application := self application) notNil]) ifTrue:[
   538                 MessageNotUnderstood catch:[
   539                     application aspectFor:menuSelector
   540                 ]
   541             ]
   542         ].
   543         ^ true
   544     ].
   545 
   546     ^ true
   547 ! !
   548 
   549 !UIGalleryView::Palette methodsFor:'focus handling'!
   550 
   551 subviewsInFocusOrder
   552     "returns none views - focus not handled within buildin canvas"
   553 
   554     ^ #()
   555 ! !
   556 
   557 !UIGalleryView::Palette methodsFor:'initialization'!
   558 
   559 destroy
   560     |winGrp|
   561 
   562     winGrp := self windowGroup.
   563     winGrp notNil ifTrue:[
   564         winGrp removePreEventHook:self.
   565     ].
   566     super destroy.
   567 !
   568 
   569 initialize
   570     super initialize.
   571     clientSpecHolder := nil asValue.
   572     hiddenCounter := 0.
   573     showBorders := true.
   574 !
   575 
   576 realize
   577     |winGrp|
   578 
   579     super realize.
   580     winGrp := self windowGroup.
   581     winGrp notNil ifTrue:[
   582         winGrp addPreEventHook:self.
   583    ].
   584 ! !
   585 
   586 !UIGalleryView::Palette methodsFor:'searching'!
   587 
   588 findObjectAt:aPoint
   589     |seeIfWidgetIsHit p x y|
   590 
   591     seeIfWidgetIsHit := 
   592         [:v |
   593             p := device translatePoint:aPoint fromView:self toView:v.
   594             x := p x.
   595             y := p y.
   596 
   597             (     x >= 0 and:[x <= v width
   598              and:[y >= 0 and:[y <= v height
   599              and:[(self findSpecFor:v) notNil]]]]
   600             ) ifTrue:[
   601                 ^ v
   602             ]
   603         ].
   604 
   605     subViews notNil ifTrue:[ subViews do:seeIfWidgetIsHit ].
   606     components notNil ifTrue:[ components do:seeIfWidgetIsHit ].
   607     ^ nil
   608 !
   609 
   610 findSpecFor:aWidget
   611     "returns the spec which is assigned to aWidget or nil"
   612 
   613     |name|
   614 
   615     aWidget notNil ifTrue:[
   616         name := aWidget name.
   617 
   618         specification do:[:aSpec|
   619             (aSpec notNil and:[aSpec name = name]) ifTrue:[
   620                 aSpec canUIDrag ifFalse:[^ nil ].
   621                 ^ aSpec
   622             ]
   623         ]
   624     ].
   625     ^ nil
   626 
   627     "Modified: / 18.5.1999 / 14:47:25 / cg"
   628 ! !
   629 
   630 !UIGalleryView::Palette methodsFor:'selection'!
   631 
   632 handlesOf:aComponent do:aOneArgBlock
   633     "evaluate the block on each handle; the argument to the block is a rectangle"
   634 
   635     |ext|
   636 
   637     ext := 8@8.
   638 
   639     aComponent notNil ifTrue:[
   640         aOneArgBlock value:(aComponent origin       - (3@3) extent:ext).
   641         aOneArgBlock value:(aComponent corner       - (2@2) extent:ext).
   642         aOneArgBlock value:(aComponent topRight     - (2@3) extent:ext).
   643         aOneArgBlock value:(aComponent bottomLeft   - (3@2) extent:ext).
   644         aOneArgBlock value:(aComponent leftCenter rounded   - (3@0) extent:ext).
   645         aOneArgBlock value:(aComponent rightCenter rounded  - (2@0) extent:ext).
   646         aOneArgBlock value:(aComponent topCenter rounded    - (0@3) extent:ext).
   647         aOneArgBlock value:(aComponent bottomCenter rounded - (0@2) extent:ext).
   648     ]
   649 !
   650 
   651 redrawSelection
   652     "redraw all items selected"
   653 
   654     (shown and:[selection notNil and:[hiddenCounter == 0]]) ifTrue:[
   655         self clippedByChildren:false.
   656 
   657         self handlesOf:selection do:[:aRectangle|
   658             self paint:self blackColor.
   659             self fillRectangle:aRectangle.
   660 
   661             self paint:self whiteColor.
   662             self displayRectangle:(aRectangle insetBy:0).
   663         ].
   664         self clippedByChildren:true.
   665     ].
   666 !
   667 
   668 selection:aView
   669     "selection changed"
   670 
   671     |spec|
   672 
   673     selection == aView ifTrue:[^ self].
   674 
   675     self withSelectionHiddenDo:[
   676         spec := self findSpecFor:aView.
   677 
   678         selection := (spec isNil) ifTrue:[nil] ifFalse:[aView].
   679         clientSpecHolder value:spec.
   680     ].
   681 !
   682 
   683 withSelectionHiddenDo:aOneArgBlock
   684     [ 
   685         |r forceExpose|
   686         
   687         hiddenCounter :=  hiddenCounter + 1.
   688         hiddenCounter == 1 ifTrue:[
   689             (shown and:[selection notNil]) ifTrue:[
   690                 self clippedByChildren:false.
   691 
   692                 self handlesOf:selection do:[:aRectangle|
   693                     self clearRectangle:aRectangle.
   694                     self invalidateRectangle:aRectangle repairNow:false.
   695                 ].
   696                 self clippedByChildren:true.
   697 
   698                 r := selection bounds.
   699 
   700                 forceExpose := 
   701                     [:sv|
   702                         |absOrg absFrame|
   703 
   704                         (sv bounds intersects:r) ifTrue:[   
   705                             sv isView ifTrue:[
   706                                 sv borderColor:(self whiteColor).           "/ kludge to force a redraw
   707                                 sv borderColor:(self blackColor).
   708 
   709                                 sv withAllSubViewsDo:[:v|
   710                                     v realized ifTrue:[
   711                                         v fill:v viewBackground.
   712                                         v exposeX:0 y:0 width:v width height:v height.
   713                                     ]
   714                                 ]
   715                             ] ifFalse:[
   716                                 sv invalidate.
   717                             ].
   718                         ]
   719                     ].
   720 
   721                 (subViews ? #()) do:forceExpose.
   722                 (components ? #()) do:forceExpose.
   723             ].
   724         ].
   725         self repairDamage.  "/ ensure that any outstanding clear/redraw of the unselect are done before
   726         aOneArgBlock value.
   727     ] ensure:[
   728         self repairDamage.  "/ ensure that any outstanding clear/redraw of the unselect are done before
   729 
   730         hiddenCounter := hiddenCounter - 1.
   731         self redrawSelection.
   732     ].
   733 ! !
   734 
   735 !UIGalleryView::Palette::DropSpec class methodsFor:'instance creation'!
   736 
   737 for:aWidget specification:aSpec
   738     "create drop object for a widget derived from a specification"
   739 
   740     |point extent rootView widgetsDevice inst displayObject view|
   741 
   742     widgetsDevice   := aWidget device.
   743     rootView := widgetsDevice rootView.
   744     extent   := aWidget extent.
   745     aWidget isView ifTrue:[
   746         view := aWidget.
   747         point := widgetsDevice translatePoint:0@0 fromView:aWidget toView:rootView.
   748     ] ifFalse:[
   749         view := aWidget container.
   750         point := widgetsDevice translatePoint:(aWidget origin) fromView:view toView:rootView.
   751     ].
   752     (point x > 0 and:[point y > 0]) ifTrue:[
   753         point := point + extent.
   754         (point x < rootView width and:[point y < rootView height]) ifTrue:[
   755             aWidget topView raise.
   756             widgetsDevice flush.
   757             aWidget invalidate.
   758             aWidget windowGroup processExposeEvents.
   759             displayObject := Image fromView:aWidget grab:false.
   760         ]
   761     ].
   762     displayObject isNil ifTrue:[
   763         displayObject := Form extent:extent depth:1.
   764         displayObject colorMap:(Array with:Color white with:Color black).
   765         displayObject fill:(Color colorId:0).
   766         displayObject paint:(Color colorId:1).
   767         displayObject displayRectangleX:0 y:0 width:aWidget extent x height:aWidget extent y.
   768     ].
   769     aSpec class == UISubSpecification ifTrue:[
   770         aSpec layout:(LayoutOrigin fromPoint:0@0)
   771     ].
   772 
   773     inst := self new.
   774     inst displayObject:displayObject.
   775     inst theObject:aSpec.
   776     ^ inst.
   777 
   778     "Modified: / 10.10.2001 / 14:03:00 / cg"
   779 ! !
   780 
   781 !UIGalleryView class methodsFor:'documentation'!
   782 
   783 version
   784     ^ '$Header$'
   785 !
   786 
   787 version_CVS
   788     ^ '$Header$'
   789 ! !
   790