UIPainter.st
changeset 157 ce974dce3dd4
parent 156 b332d7117c40
child 160 622b88baeff6
equal deleted inserted replaced
156:b332d7117c40 157:ce974dce3dd4
   341           #'window:' 
   341           #'window:' 
   342            #(#WindowSpec
   342            #(#WindowSpec
   343               #'name:' 'uIPainterView'
   343               #'name:' 'uIPainterView'
   344               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   344               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   345               #'label:' 'unnamed canvas'
   345               #'label:' 'unnamed canvas'
   346               #'bounds:' #(#Rectangle 0 0 300 223)
   346               #'bounds:' #(#Rectangle 0 0 392 223)
   347           )
   347           )
   348           #'component:' 
   348           #'component:' 
   349            #(#SpecCollection
   349            #(#SpecCollection
   350               #'collection:' 
   350               #'collection:' 
   351                #(
   351                #(
   367                     #'label:' 'selector:'
   367                     #'label:' 'selector:'
   368                     #'adjust:' #right
   368                     #'adjust:' #right
   369                 )
   369                 )
   370                  #(#InputFieldSpec
   370                  #(#InputFieldSpec
   371                     #'name:' 'classNameField'
   371                     #'name:' 'classNameField'
   372                     #'layout:' #(#LayoutFrame 120 0 50 0 289 0 72 0)
   372                     #'layout:' #(#LayoutFrame 120 0 50 0 -2 1.0 72 0)
       
   373                     #'tabable:' true
   373                     #'model:' #classNameChannel
   374                     #'model:' #classNameChannel
   374                     #'tabable:' true
       
   375                 )
       
   376                  #(#InputFieldSpec
       
   377                     #'name:' 'superclassNameField'
       
   378                     #'layout:' #(#LayoutFrame 120 0 90 0 289 0 112 0)
       
   379                     #'model:' #superclassNameChannel
       
   380                     #'tabable:' true
       
   381                 )
   375                 )
   382                  #(#InputFieldSpec
   376                  #(#InputFieldSpec
   383                     #'name:' 'methodNameField'
   377                     #'name:' 'methodNameField'
   384                     #'layout:' #(#LayoutFrame 120 0 130 0 289 0 152 0)
   378                     #'layout:' #(#LayoutFrame 120 0 130 0 -2 1.0 152 0)
       
   379                     #'tabable:' true
   385                     #'model:' #methodNameChannel
   380                     #'model:' #methodNameChannel
   386                     #'tabable:' true
       
   387                 )
   381                 )
   388                  #(#ActionButtonSpec
   382                  #(#ActionButtonSpec
   389                     #'name:' 'button1'
   383                     #'name:' 'button1'
   390                     #'layout:' #(#LayoutFrame 30 0 180 0 129 0 209 0)
   384                     #'layout:' #(#AlignmentOrigin -2 0.5 195 0 1 0.5)
   391                     #'label:' 'cancel'
   385                     #'label:' 'cancel'
   392                     #'tabable:' true
   386                     #'tabable:' true
   393                     #'model:' #cancel
   387                     #'model:' #cancel
   394                     #'isTriggerOnDown:' false
       
   395                     #'autoRepeat:' false
       
   396                 )
   388                 )
   397                  #(#ActionButtonSpec
   389                  #(#ActionButtonSpec
   398                     #'name:' 'button2'
   390                     #'name:' 'button2'
   399                     #'layout:' #(#LayoutFrame 160 0 180 0 259 0 209 0)
   391                     #'layout:' #(#AlignmentOrigin 2 0.5 195 0 0 0.5)
   400                     #'label:' 'ok'
   392                     #'label:' 'ok'
   401                     #'tabable:' true
   393                     #'tabable:' true
   402                     #'isDefault:' true
   394                     #'isDefault:' true
   403                     #'model:' #accept
   395                     #'model:' #accept
   404                     #'isTriggerOnDown:' false
       
   405                     #'autoRepeat:' false
       
   406                 )
   396                 )
   407                  #(#LabelSpec
   397                  #(#LabelSpec
   408                     #'name:' 'boxLabel'
   398                     #'name:' 'boxLabel'
   409                     #'layout:' #(#LayoutFrame 0 0.0 11 0 0 1.0 32 0)
   399                     #'layout:' #(#LayoutFrame 0 0.0 11 0 0 1.0 32 0)
   410                     #'label:' 'class & selector for code:'
   400                     #'label:' 'class & selector for code:'
   411                     #'adjust:' #left
   401                     #'adjust:' #left
   412                 )
   402                 )
       
   403                  #(#ComboBoxSpec
       
   404                     #'name:' 'comboBox1'
       
   405                     #'layout:' #(#LayoutFrame 120 0 90 0 -2 1.0 112 0)
       
   406                     #'tabable:' true
       
   407                     #'model:' #superclassNameChannel
       
   408                     #'immediateAccept:' false
       
   409                     #'acceptOnLeave:' true
       
   410                     #'acceptOnLostFocus:' true
       
   411                     #'comboList:' #superclassNameDefaults
       
   412                 )
   413               )
   413               )
   414           )
   414           )
   415       )
   415       )
       
   416 
       
   417     "Modified: 17.6.1997 / 13:02:12 / cg"
   416 !
   418 !
   417 
   419 
   418 windowSpec
   420 windowSpec
   419     "this window spec was automatically generated by the ST/X UIPainter"
   421     "this window spec was automatically generated by the ST/X UIPainter"
   420 
   422 
   592 ! !
   594 ! !
   593 
   595 
   594 !UIPainter methodsFor:'actions'!
   596 !UIPainter methodsFor:'actions'!
   595 
   597 
   596 accept
   598 accept
   597     "automatically generated by UIPainter ..."
       
   598     |layout|
   599     |layout|
   599 
   600 
   600     tabSelection = layoutTool label ifTrue:[
   601     tabSelection = layoutTool label ifTrue:[
   601         (layout := layoutTool layout) notNil ifTrue:[
   602         (layout := layoutTool layout) notNil ifTrue:[
   602             layoutTool layoutType == #Extent ifTrue:[
   603             layoutTool layoutType == #Extent ifTrue:[
   611         ].
   612         ].
   612         self painter updateFromSpec:(specView specEdited)
   613         self painter updateFromSpec:(specView specEdited)
   613     ].
   614     ].
   614     self cancel
   615     self cancel
   615 
   616 
       
   617     "Modified: 17.6.1997 / 12:50:59 / cg"
   616 !
   618 !
   617 
   619 
   618 cancel
   620 cancel
   619     "cancel all changes and read back attributes from current view
   621     "cancel all changes and read back attributes from current view
   620     "
   622     "
   628 ! !
   630 ! !
   629 
   631 
   630 !UIPainter methodsFor:'active help'!
   632 !UIPainter methodsFor:'active help'!
   631 
   633 
   632 activeHelpTool
   634 activeHelpTool
   633     "automatically generated by UIPainter ..."
       
   634 
       
   635     |cls|
   635     |cls|
   636 
   636 
   637     activeHelpTool isNil ifTrue:[
   637     activeHelpTool isNil ifTrue:[
   638         activeHelpTool := UIHelpTool new.
   638         activeHelpTool := UIHelpTool new.
   639 
   639 
   648                 activeHelpTool dictionary:(cls helpSpec).
   648                 activeHelpTool dictionary:(cls helpSpec).
   649            ]
   649            ]
   650         ].
   650         ].
   651     ].
   651     ].
   652     ^ activeHelpTool
   652     ^ activeHelpTool
       
   653 
       
   654     "Modified: 17.6.1997 / 12:51:15 / cg"
   653 !
   655 !
   654 
   656 
   655 showHelp:aHelpText for:view
   657 showHelp:aHelpText for:view
   656     "hook to allow an application to display active help
   658     "hook to allow an application to display active help
   657      texts in its own info area.
   659      texts in its own info area.
   977     ].
   979     ].
   978     aspects at:#superclassNameChannel put:(
   980     aspects at:#superclassNameChannel put:(
   979         (specSuperclass notNil ifTrue:[specSuperclass]
   981         (specSuperclass notNil ifTrue:[specSuperclass]
   980                          ifFalse:['ApplicationModel']) asValue
   982                          ifFalse:['ApplicationModel']) asValue
   981     ).
   983     ).
       
   984     aspects at:#superclassNameDefaults put:#('ApplicationModel' 'SimpleDialog') asValue.
   982     aspects at:#methodNameChannel put:(
   985     aspects at:#methodNameChannel put:(
   983         (specSelector notNil ifTrue:[specSelector]
   986         (specSelector notNil ifTrue:[specSelector]
   984                             ifFalse:[#windowSpec]) asValue
   987                             ifFalse:[#windowSpec]) asValue
   985     ).
   988     ).
   986 
   989 
  1012     selectionPanel window openInGroup:(topView windowGroup).
  1015     selectionPanel window openInGroup:(topView windowGroup).
  1013     selectionPanel window bePartner.
  1016     selectionPanel window bePartner.
  1014     selectionPanel openWindow.
  1017     selectionPanel openWindow.
  1015     selectionPanel window application:self.
  1018     selectionPanel window application:self.
  1016 
  1019 
       
  1020     "Modified: 17.6.1997 / 13:06:25 / cg"
  1017 !
  1021 !
  1018 
  1022 
  1019 openNewWindowCanvas
  1023 openNewWindowCanvas
  1020     "open new
  1024     "open new
  1021     "
  1025     "
  1034     "open up an interface builder, fetching a spec from someClass
  1038     "open up an interface builder, fetching a spec from someClass
  1035      via some selector
  1039      via some selector
  1036     "
  1040     "
  1037     |painter|
  1041     |painter|
  1038 
  1042 
       
  1043     aClass isNil ifTrue:[
       
  1044         self warn:'nil class given (class was probably renamed ?)'.
       
  1045     ].
       
  1046 
  1039     self openInterface.
  1047     self openInterface.
  1040 
  1048 
  1041     painter        := self painter.
  1049     aClass notNil ifTrue:[
  1042     specClass      := aClass name.
  1050         painter        := self painter.
  1043     specSuperclass := aClass superclass name.
  1051         specClass      := aClass name.
  1044     specSelector   := aSelector.
  1052         specSuperclass := aClass superclass name.
  1045 
  1053         specSelector   := aSelector.
  1046     painter className:aClass name.
  1054 
  1047     painter methodName:aSelector.
  1055         (aspects at:#classNameChannel) value:specClass.
  1048     painter setupFromSpec:(aClass perform:aSelector).
  1056         (aspects at:#superclassNameChannel) value:specSuperclass.
  1049 
  1057         (aspects at:#methodNameChannel) value:specSelector.
       
  1058 
       
  1059         painter className:aClass name.
       
  1060         painter methodName:aSelector.
       
  1061         painter setupFromSpec:(aClass perform:aSelector).
       
  1062     ]
       
  1063 
       
  1064     "Modified: 17.6.1997 / 13:04:48 / cg"
  1050 ! !
  1065 ! !
  1051 
  1066 
  1052 !UIPainter methodsFor:'user interaction - dialog'!
  1067 !UIPainter methodsFor:'user interaction - dialog'!
  1053 
  1068 
  1054 checkClassAndSelector
  1069 checkClassAndSelector
  1109 
  1124 
  1110     |again|
  1125     |again|
  1111 
  1126 
  1112     [
  1127     [
  1113         again := false.
  1128         again := false.
  1114 
       
  1115         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  1129         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
  1116 
  1130 
  1117             specClass := (self aspectFor:#classNameChannel) value.
  1131             specClass := (self aspectFor:#classNameChannel) value.
  1118             specSelector := (self aspectFor:#methodNameChannel) value.
  1132             specSelector := (self aspectFor:#methodNameChannel) value.
  1119             specSuperclass := (self aspectFor:#superclassNameChannel) value.
  1133             specSuperclass := (self aspectFor:#superclassNameChannel) value.
  1125             ]
  1139             ]
  1126         ]
  1140         ]
  1127 
  1141 
  1128     ] doWhile:[again]
  1142     ] doWhile:[again]
  1129 
  1143 
  1130 
  1144     "Modified: 17.6.1997 / 13:04:26 / cg"
  1131 ! !
  1145 ! !
  1132 
  1146 
  1133 !UIPainter methodsFor:'user interaction - pullDown'!
  1147 !UIPainter methodsFor:'user interaction - pullDown'!
  1134 
  1148 
  1135 doBrowseAppClass
  1149 doBrowseAppClass