UIPainterView.st
changeset 376 3023fc08ee35
parent 361 6624bb5d9a1a
child 392 53a63b0e8279
equal deleted inserted replaced
375:b43507f222ce 376:3023fc08ee35
   386 ! !
   386 ! !
   387 
   387 
   388 !UIPainterView methodsFor:'event handling'!
   388 !UIPainterView methodsFor:'event handling'!
   389 
   389 
   390 keyPress:key x:x y:y view:aView
   390 keyPress:key x:x y:y view:aView
       
   391     "a delegated keyEvent from aView"
       
   392 
   391     self keyPress:key x:x y:y
   393     self keyPress:key x:x y:y
   392 
   394 
   393 
   395     "Modified: / 31.10.1997 / 20:27:22 / cg"
   394 !
   396 !
   395 
   397 
   396 keyRelease:key x:x y:y view:aView
   398 keyRelease:key x:x y:y view:aView
       
   399     "a delegated keyEvent from aView"
       
   400 
   397     self keyRelease:key x:x y:y
   401     self keyRelease:key x:x y:y
   398 
   402 
   399 
   403     "Modified: / 31.10.1997 / 20:27:32 / cg"
   400 ! !
   404 ! !
   401 
   405 
   402 !UIPainterView methodsFor:'generating output'!
   406 !UIPainterView methodsFor:'generating output'!
   403 
   407 
   404 aspectMethods
   408 aspectMethods
   636                 ]
   640                 ]
   637             ]
   641             ]
   638         ].
   642         ].
   639         aProp spec valueSelectors do:[:aSel|
   643         aProp spec valueSelectors do:[:aSel|
   640             (aSel isArray not) ifTrue:[
   644             (aSel isArray not) ifTrue:[
   641                 (cls implements:aSel asSymbol) ifFalse:[
   645                 "/ uppercase: - assume its a globals name.
   642                     thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
   646                 aSel first isUppercase ifFalse:[
   643                     code := code , thisCode
   647                     (cls implements:aSel asSymbol) ifFalse:[
       
   648                         thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
       
   649                         code := code , thisCode
       
   650                     ]
   644                 ]
   651                 ]
   645             ]
   652             ]
   646         ]
   653         ]
   647     ].
   654     ].
   648 
   655 
   657         ]
   664         ]
   658     ].
   665     ].
   659 
   666 
   660     ^ code
   667     ^ code
   661 
   668 
   662     "Modified: / 26.10.1997 / 14:43:55 / cg"
   669     "Modified: / 31.10.1997 / 14:22:30 / cg"
       
   670 !
       
   671 
       
   672 generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
       
   673     ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
       
   674       selectorSpec , '\' ,
       
   675       '    "automatically generated by UIPainter ..."\\' ,
       
   676       '    "*** the code here does nothing. It is invoked when"\' ,
       
   677       '    "*** ' , commentWhen , '"\' ,
       
   678       '    "*** Please change as required and accept in the browser."\' ,
       
   679       '\' ,
       
   680       '    "specific code to be added below ..."\' ,
       
   681       '    "' , (noteOrNil ? '') , '"\' ,
       
   682       '\' ,
       
   683       (defaultCode ? '^ self.') ,
       
   684       '!! !!\\') withCRs
       
   685 
       
   686     "Modified: / 25.10.1997 / 19:22:17 / cg"
       
   687     "Created: / 31.10.1997 / 17:31:53 / cg"
       
   688 !
       
   689 
       
   690 generateHookMethods
       
   691     "generate hook methods
       
   692      - but do not overwrite existing ones.
       
   693      Return a string ready to compile into the application class."
       
   694 
       
   695     |cls code skip menuSelector protoSpec thisCode|
       
   696 
       
   697     code := ''.
       
   698 
       
   699     className isNil ifTrue:[
       
   700         self warn:'set the class first'.
       
   701         ^ code
       
   702     ].
       
   703     cls := self resolveName:className.
       
   704 
       
   705     code := code , (self generateHookMethodsInClass:cls).
       
   706 
       
   707     ^ code
       
   708 
       
   709     "Created: / 31.10.1997 / 17:21:29 / cg"
       
   710     "Modified: / 31.10.1997 / 17:38:11 / cg"
       
   711 !
       
   712 
       
   713 generateHookMethodsInClass:targetClass
       
   714     |code|
       
   715 
       
   716     code := ''.
       
   717 
       
   718     (targetClass implements:#postBuildWith:) ifFalse:[
       
   719         code := code 
       
   720                 , (self 
       
   721                     generateHookMethodFor:'postBuildWith:aBuilder'
       
   722                     comment:'the widgets have been built, but before the view is opened'
       
   723                     note:nil
       
   724                     defaultCode:nil
       
   725                     inClass:targetClass)
       
   726     ].
       
   727     (targetClass implements:#postOpenWith:) ifFalse:[
       
   728         code := code 
       
   729                 , (self 
       
   730                     generateHookMethodFor:'postOpenWith:aBuilder'
       
   731                     comment:'the topView has been opened, but before events are dispatched for it'
       
   732                     note:nil
       
   733                     defaultCode:nil
       
   734                     inClass:targetClass)
       
   735     ].
       
   736     (targetClass implements:#closeRequest) ifFalse:[
       
   737         code := code 
       
   738                 , (self 
       
   739                     generateHookMethodFor:'closeRequest'
       
   740                     comment:'the topView has been asked to close'
       
   741                     note:'return without the ''super closeRequest'' to stay open'
       
   742                     defaultCode:'^ super closeRequest'
       
   743                     inClass:targetClass)
       
   744     ].
       
   745     ^ code
       
   746 
       
   747     "Modified: / 31.10.1997 / 17:30:34 / cg"
       
   748     "Created: / 31.10.1997 / 17:32:49 / cg"
   663 !
   749 !
   664 
   750 
   665 generateMenuMethodFor:aspect spec:protoSpec inClass:aClass
   751 generateMenuMethodFor:aspect spec:protoSpec inClass:aClass
   666     |code cperf performer category|
   752     |code cperf performer category|
   667 
   753 
   809 
   895 
   810 treeView:aTreeView
   896 treeView:aTreeView
   811     treeView := aTreeView.
   897     treeView := aTreeView.
   812 
   898 
   813     treeView delegate:(
   899     treeView delegate:(
   814         KeyboardForwarder toView:self
   900         "/
   815                        condition:nil
   901         "/ I want to handle everything typed
   816                           filter:[:k|(k isSymbol and:[k ~~ #Return and:[(k startsWith:#Cursor) not]])]
   902         "/ in the treeView, except for Return and Cursor-keys
       
   903         "/
       
   904         KeyboardForwarder 
       
   905             toView:self
       
   906             condition:nil
       
   907             filter:[:k | (k isSymbol 
       
   908                          and:[k ~~ #Return 
       
   909                          and:[(k startsWith:#Cursor) not]])
       
   910                    ]
   817     )
   911     )
   818 
   912 
       
   913     "Modified: / 31.10.1997 / 20:22:09 / cg"
   819 ! !
   914 ! !
   820 
   915 
   821 !UIPainterView methodsFor:'menus'!
   916 !UIPainterView methodsFor:'menus'!
   822 
   917 
   823 showMiddleButtonMenu
   918 showMiddleButtonMenu