UIGalleryView.st
changeset 2563 c2298d24621d
parent 2561 e5a66f3365d6
child 3081 feb178704671
equal deleted inserted replaced
2562:fc0a53ce6152 2563:c2298d24621d
    16 	classVariableNames:''
    16 	classVariableNames:''
    17 	poolDictionaries:''
    17 	poolDictionaries:''
    18 	category:'Interface-UIPainter'
    18 	category:'Interface-UIPainter'
    19 !
    19 !
    20 
    20 
    21 View subclass:#Canvas
    21 View subclass:#Palette
    22 	instanceVariableNames:'clientSpecHolder selection specification lastClickPoint
    22 	instanceVariableNames:'clientSpecHolder selection specification lastClickPoint
    23 		menuSelector uiBuilder hiddenCounter showBorders
    23 		menuSelector uiBuilder hiddenCounter showBorders
    24 		didWarnAboutUnknownSpecs'
    24 		didWarnAboutUnknownSpecs'
    25 	classVariableNames:''
    25 	classVariableNames:''
    26 	poolDictionaries:''
    26 	poolDictionaries:''
    29 
    29 
    30 DropObject subclass:#DropSpec
    30 DropObject subclass:#DropSpec
    31 	instanceVariableNames:''
    31 	instanceVariableNames:''
    32 	classVariableNames:''
    32 	classVariableNames:''
    33 	poolDictionaries:''
    33 	poolDictionaries:''
    34 	privateIn:UIGalleryView::Canvas
    34 	privateIn:UIGalleryView::Palette
    35 !
    35 !
    36 
    36 
    37 !UIGalleryView class methodsFor:'documentation'!
    37 !UIGalleryView class methodsFor:'documentation'!
    38 
    38 
    39 copyright
    39 copyright
   275 !UIGalleryView methodsFor:'initialization & release'!
   275 !UIGalleryView methodsFor:'initialization & release'!
   276 
   276 
   277 initialize
   277 initialize
   278     "setup default attributes
   278     "setup default attributes
   279     "
   279     "
   280     canvas := Canvas in:self.
   280     canvas := Palette in:self.
   281 
   281 
   282     super initialize.
   282     super initialize.
   283 
   283 
   284     self action:[:something| self selectionHasChanged ].
   284     self action:[:something| self selectionHasChanged ].
   285 !
   285 !
   290         minorKeysHolder := nil.
   290         minorKeysHolder := nil.
   291     ].
   291     ].
   292     super release.
   292     super release.
   293 ! !
   293 ! !
   294 
   294 
   295 !UIGalleryView::Canvas class methodsFor:'documentation'!
   295 !UIGalleryView::Palette class methodsFor:'documentation'!
   296 
   296 
   297 documentation
   297 documentation
   298 "
   298 "
   299     I am the canvas of a gallery. Most of what I do is to allow dragging of widget out
   299     I am the palette of a gallery. Most of what I do is to allow dragging of a widget out
   300     of myself and to care for the drawing of the selection.
   300     of myself and to care for the drawing of the selection.
   301     The arrangement into multiple pages is done by my container, which holds me
   301     The arrangement into multiple pages is done by my container, which holds me
   302     in a subcanvas.
   302     in a subcanvas.
   303 "
   303 "
   304 ! !
   304 ! !
   305 
   305 
   306 !UIGalleryView::Canvas methodsFor:'accessing'!
   306 !UIGalleryView::Palette methodsFor:'accessing'!
   307 
   307 
   308 builder
   308 builder
   309     "get the builder used to setup a window from a specification (or nil in case
   309     "get the builder used to setup a window from a specification (or nil in case
   310      of using a new builder)
   310      of using a new builder)
   311     "
   311     "
   388     specification := newSpec.
   388     specification := newSpec.
   389 
   389 
   390     (builder := uiBuilder) isNil ifTrue:[
   390     (builder := uiBuilder) isNil ifTrue:[
   391         builder := UIBuilder new isEditing:true.
   391         builder := UIBuilder new isEditing:true.
   392         builder showDefaults:true.
   392         builder showDefaults:true.
       
   393         builder application:self application. "/ for resources like images
   393     ].
   394     ].
   394 
   395 
   395     specification buildViewFor:builder in:self.
   396     specification buildViewFor:builder in:self.
   396 
   397 
   397     "/ components notEmptyOrNil ifTrue:[ self halt ].
   398     "/ components notEmptyOrNil ifTrue:[ self halt ].
   405         ].
   406         ].
   406         realized ifTrue:[ self realizeAllSubViews ].
   407         realized ifTrue:[ self realizeAllSubViews ].
   407     ].
   408     ].
   408 ! !
   409 ! !
   409 
   410 
   410 !UIGalleryView::Canvas methodsFor:'building'!
   411 !UIGalleryView::Palette methodsFor:'building'!
   411 
   412 
   412 recursiveBuildSpecFromSpecPrototype:aSpec
   413 recursiveBuildSpecFromSpecPrototype:aSpec
   413     "build spec out of spec prototype"
   414     "build spec out of spec prototype"
   414 
   415 
   415     |spec comp coll|
   416     |spec comp coll|
   444     comp collection:coll.
   445     comp collection:coll.
   445     spec component:comp.
   446     spec component:comp.
   446     ^ spec
   447     ^ spec
   447 ! !
   448 ! !
   448 
   449 
   449 !UIGalleryView::Canvas methodsFor:'drag & drop'!
   450 !UIGalleryView::Palette methodsFor:'drag & drop'!
   450 
   451 
   451 startDragFrom:evView
   452 startDragFrom:evView
   452     "start drag at lastClickPoint"
   453     "start drag at lastClickPoint"
   453 
   454 
   454     |spec dragObj offset clickPos dragAndDropManager|
   455     |spec dragObj offset clickPos dragAndDropManager|
   477         offset:offset
   478         offset:offset
   478         atEnd:nil
   479         atEnd:nil
   479         display:nil.
   480         display:nil.
   480 ! !
   481 ! !
   481 
   482 
   482 !UIGalleryView::Canvas methodsFor:'event handling'!
   483 !UIGalleryView::Palette methodsFor:'event handling'!
   483 
   484 
   484 processEvent:anEvent
   485 processEvent:anEvent
   485     "filter keyboard events.
   486     "filter keyboard events.
   486      Return true, if I have eaten the event"
   487      Return true, if I have eaten the event"
   487 
   488 
   541     ].
   542     ].
   542 
   543 
   543     ^ true
   544     ^ true
   544 ! !
   545 ! !
   545 
   546 
   546 !UIGalleryView::Canvas methodsFor:'focus handling'!
   547 !UIGalleryView::Palette methodsFor:'focus handling'!
   547 
   548 
   548 subviewsInFocusOrder
   549 subviewsInFocusOrder
   549     "returns none views - focus not handled within buildin canvas"
   550     "returns none views - focus not handled within buildin canvas"
   550 
   551 
   551     ^ #()
   552     ^ #()
   552 ! !
   553 ! !
   553 
   554 
   554 !UIGalleryView::Canvas methodsFor:'initialization'!
   555 !UIGalleryView::Palette methodsFor:'initialization'!
   555 
   556 
   556 destroy
   557 destroy
   557     |winGrp|
   558     |winGrp|
   558 
   559 
   559     winGrp := self windowGroup.
   560     winGrp := self windowGroup.
   578     winGrp notNil ifTrue:[
   579     winGrp notNil ifTrue:[
   579         winGrp addPreEventHook:self.
   580         winGrp addPreEventHook:self.
   580    ].
   581    ].
   581 ! !
   582 ! !
   582 
   583 
   583 !UIGalleryView::Canvas methodsFor:'searching'!
   584 !UIGalleryView::Palette methodsFor:'searching'!
   584 
   585 
   585 findObjectAt:aPoint
   586 findObjectAt:aPoint
   586     |seeIfWidgetIsHit p x y|
   587     |seeIfWidgetIsHit p x y|
   587 
   588 
   588     seeIfWidgetIsHit := 
   589     seeIfWidgetIsHit := 
   622     ^ nil
   623     ^ nil
   623 
   624 
   624     "Modified: / 18.5.1999 / 14:47:25 / cg"
   625     "Modified: / 18.5.1999 / 14:47:25 / cg"
   625 ! !
   626 ! !
   626 
   627 
   627 !UIGalleryView::Canvas methodsFor:'selection'!
   628 !UIGalleryView::Palette methodsFor:'selection'!
   628 
   629 
   629 handlesOf:aComponent do:aOneArgBlock
   630 handlesOf:aComponent do:aOneArgBlock
   630     "evaluate the block on each handle; the argument to the block is a rectangle"
   631     "evaluate the block on each handle; the argument to the block is a rectangle"
   631 
   632 
   632     |ext|
   633     |ext|
   727         hiddenCounter := hiddenCounter - 1.
   728         hiddenCounter := hiddenCounter - 1.
   728         self redrawSelection.
   729         self redrawSelection.
   729     ].
   730     ].
   730 ! !
   731 ! !
   731 
   732 
   732 !UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'!
   733 !UIGalleryView::Palette::DropSpec class methodsFor:'instance creation'!
   733 
   734 
   734 for:aWidget specification:aSpec
   735 for:aWidget specification:aSpec
   735     "create drop object for a widget derived from a specification"
   736     "create drop object for a widget derived from a specification"
   736 
   737 
   737     |point extent rootView device inst displayObject view|
   738     |point extent rootView device inst displayObject view|