diff -r b43507f222ce -r 3023fc08ee35 UIPainterView.st --- a/UIPainterView.st Sun Nov 02 19:38:35 1997 +0100 +++ b/UIPainterView.st Sun Nov 02 19:40:38 1997 +0100 @@ -388,15 +388,19 @@ !UIPainterView methodsFor:'event handling'! keyPress:key x:x y:y view:aView + "a delegated keyEvent from aView" + self keyPress:key x:x y:y - + "Modified: / 31.10.1997 / 20:27:22 / cg" ! keyRelease:key x:x y:y view:aView + "a delegated keyEvent from aView" + self keyRelease:key x:x y:y - + "Modified: / 31.10.1997 / 20:27:32 / cg" ! ! !UIPainterView methodsFor:'generating output'! @@ -638,9 +642,12 @@ ]. aProp spec valueSelectors do:[:aSel| (aSel isArray not) ifTrue:[ - (cls implements:aSel asSymbol) ifFalse:[ - thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). - code := code , thisCode + "/ uppercase: - assume its a globals name. + aSel first isUppercase ifFalse:[ + (cls implements:aSel asSymbol) ifFalse:[ + thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). + code := code , thisCode + ] ] ] ] @@ -659,7 +666,86 @@ ^ code - "Modified: / 26.10.1997 / 14:43:55 / cg" + "Modified: / 31.10.1997 / 14:22:30 / cg" +! + +generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass + ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' , + selectorSpec , '\' , + ' "automatically generated by UIPainter ..."\\' , + ' "*** the code here does nothing. It is invoked when"\' , + ' "*** ' , commentWhen , '"\' , + ' "*** Please change as required and accept in the browser."\' , + '\' , + ' "specific code to be added below ..."\' , + ' "' , (noteOrNil ? '') , '"\' , + '\' , + (defaultCode ? '^ self.') , + '!! !!\\') withCRs + + "Modified: / 25.10.1997 / 19:22:17 / cg" + "Created: / 31.10.1997 / 17:31:53 / cg" +! + +generateHookMethods + "generate hook methods + - but do not overwrite existing ones. + Return a string ready to compile into the application class." + + |cls code skip menuSelector protoSpec thisCode| + + code := ''. + + className isNil ifTrue:[ + self warn:'set the class first'. + ^ code + ]. + cls := self resolveName:className. + + code := code , (self generateHookMethodsInClass:cls). + + ^ code + + "Created: / 31.10.1997 / 17:21:29 / cg" + "Modified: / 31.10.1997 / 17:38:11 / cg" +! + +generateHookMethodsInClass:targetClass + |code| + + code := ''. + + (targetClass implements:#postBuildWith:) ifFalse:[ + code := code + , (self + generateHookMethodFor:'postBuildWith:aBuilder' + comment:'the widgets have been built, but before the view is opened' + note:nil + defaultCode:nil + inClass:targetClass) + ]. + (targetClass implements:#postOpenWith:) ifFalse:[ + code := code + , (self + generateHookMethodFor:'postOpenWith:aBuilder' + comment:'the topView has been opened, but before events are dispatched for it' + note:nil + defaultCode:nil + inClass:targetClass) + ]. + (targetClass implements:#closeRequest) ifFalse:[ + code := code + , (self + generateHookMethodFor:'closeRequest' + comment:'the topView has been asked to close' + note:'return without the ''super closeRequest'' to stay open' + defaultCode:'^ super closeRequest' + inClass:targetClass) + ]. + ^ code + + "Modified: / 31.10.1997 / 17:30:34 / cg" + "Created: / 31.10.1997 / 17:32:49 / cg" ! generateMenuMethodFor:aspect spec:protoSpec inClass:aClass @@ -811,11 +897,20 @@ treeView := aTreeView. treeView delegate:( - KeyboardForwarder toView:self - condition:nil - filter:[:k|(k isSymbol and:[k ~~ #Return and:[(k startsWith:#Cursor) not]])] + "/ + "/ I want to handle everything typed + "/ in the treeView, except for Return and Cursor-keys + "/ + KeyboardForwarder + toView:self + condition:nil + filter:[:k | (k isSymbol + and:[k ~~ #Return + and:[(k startsWith:#Cursor) not]]) + ] ) + "Modified: / 31.10.1997 / 20:22:09 / cg" ! ! !UIPainterView methodsFor:'menus'!